MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / getSystemBootTime

Method getSystemBootTime

src/os_linux.cpp:468–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468u64 OS::getSystemBootTime() {
469 static u64 system_boot_time = 0;
470
471 if (system_boot_time == 0) {
472 FILE* file = fopen("/proc/stat", "r");
473 if (!file) return 0;
474
475 char line[1024];
476 while (fgets(line, sizeof(line), file)) {
477 if (strncmp(line, "btime", 5) == 0) {
478 system_boot_time = strtoull(line + 5, NULL, 10);
479 break;
480 }
481 }
482
483 fclose(file);
484 }
485
486 return system_boot_time;
487}
488
489int OS::getProcessIds(int* pids, int max_pids) {
490 int count = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected