File tree Expand file tree Collapse file tree 1 file changed +1
-18
lines changed
Expand file tree Collapse file tree 1 file changed +1
-18
lines changed Original file line number Diff line number Diff line change @@ -54,23 +54,6 @@ void system_setup() {
5454 }
5555}
5656
57- // 获取当前进程被允许的 CPU 亲和性设置
58- int GetCpuAffinity (){
59- cpu_set_t process_mask;
60- CPU_ZERO (&process_mask);
61- int avaliable_cpus=0 ;
62-
63- // 对于单机性能测试使用 taskset 其启动的进程和很有帮助!
64- if (sched_getaffinity (0 , sizeof (process_mask), &process_mask)==0 ) {
65- avaliable_cpus = CPU_COUNT (&process_mask);
66- }else {
67- avaliable_cpus = std::thread::hardware_concurrency ();
68- }
69- spdlog::info (" mms-live-server is running on {} CPUs" , avaliable_cpus);
70-
71- return avaliable_cpus;
72- }
73-
7457int main (int argc, char *argv[]) {
7558 system_setup ();
7659 boost::program_options::variables_map vm;
@@ -106,7 +89,7 @@ int main(int argc, char *argv[]) {
10689 }
10790 }
10891
109- thread_pool_inst::get_mutable_instance ().start (GetCpuAffinity ());
92+ thread_pool_inst::get_mutable_instance ().start (std::thread::hardware_concurrency ());
11093 System::get_instance ().init (thread_pool_inst::get_mutable_instance ().get_worker (RAND_WORKER));
11194 HttpConnPools::get_instance ().set_worker (thread_pool_inst::get_mutable_instance ().get_worker (RAND_WORKER));
11295
You can’t perform that action at this time.
0 commit comments