MCPcopy Create free account
hub / github.com/OAID/Tengine / probe_func

Function probe_func

driver/cpu/cpu_driver.cpp:564–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562extern void free_probe_cpu_info(struct cpu_info*);
563
564static void probe_func(void)
565{
566 struct cpu_info* cpu_dev = probe_system_cpu();
567
568 if(cpu_dev == nullptr)
569 {
570 XLOG_ERROR() << "cannot probe system cpu setting\n";
571 return;
572 }
573
574 int* saved_list = cpu_dev->online_cpu_list;
575 int saved_number = cpu_dev->online_cpu_number;
576
577 int* online_list = NULL;
578
579 if(default_param.cpu_number)
580 {
581 online_list = ( int* )malloc(sizeof(int) * default_param.cpu_number);
582
583 for(int i = 0; i < default_param.cpu_number; i++)
584 online_list[i] = default_param.cpu_list[i];
585
586 cpu_dev->online_cpu_list = online_list;
587 cpu_dev->online_cpu_number = default_param.cpu_number;
588 }
589
590 create_cpu_device(cpu_dev->cpu_name, cpu_dev);
591
592 cpu_dev->online_cpu_list = saved_list;
593 cpu_dev->online_cpu_number = saved_number;
594
595 free_probe_cpu_info(cpu_dev);
596
597 if(online_list)
598 free(online_list);
599}
600
601namespace TEngine {
602

Callers

nothing calls this directly

Calls 3

probe_system_cpuFunction · 0.85
create_cpu_deviceFunction · 0.85
free_probe_cpu_infoFunction · 0.85

Tested by

no test coverage detected