diff --git a/configs/sample_person_shoe_two_stage_balanced.json b/configs/sample_person_shoe_two_stage_balanced.json index 6977bf5..f258688 100644 --- a/configs/sample_person_shoe_two_stage_balanced.json +++ b/configs/sample_person_shoe_two_stage_balanced.json @@ -6,6 +6,10 @@ "graphs": [ { "name": "person_shoe_two_stage_balanced", + "executor": { + "batch_size": 2, + "run_budget": 8 + }, "nodes": [ { "id": "in", @@ -139,6 +143,7 @@ "type": "publish", "role": "filter", "enable": true, + "cpu_affinity": [7], "codec": "h264", "fps": 30, "bitrate_kbps": 2000, diff --git a/src/graph_manager.cpp b/src/graph_manager.cpp index 0de6f06..c309a28 100644 --- a/src/graph_manager.cpp +++ b/src/graph_manager.cpp @@ -199,7 +199,14 @@ bool EffectiveQueueForEdge(const ParsedEdge& e, const SimpleJson* from_node_queu class Graph::Executor { public: explicit Executor(Graph& g) - : g_(g), batch_size_(DefaultGraphBatchSize()), run_budget_(DefaultGraphRunBudget()) {} + : g_(g), batch_size_(DefaultGraphBatchSize()), run_budget_(DefaultGraphRunBudget()) { + if (const SimpleJson* exec = g_.graph_cfg_.Find("executor"); exec && exec->IsObject()) { + const int batch = exec->ValueOr("batch_size", static_cast(batch_size_)); + const int budget = exec->ValueOr("run_budget", static_cast(run_budget_)); + if (batch > 0 && batch <= 1024) batch_size_ = static_cast(batch); + if (budget > 0 && budget <= 4096) run_budget_ = static_cast(budget); + } + } bool Start() { Stop();