summaryrefslogtreecommitdiffstats
path: root/tools/profiler/core/platform-macos.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/profiler/core/platform-macos.cpp')
-rw-r--r--tools/profiler/core/platform-macos.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/profiler/core/platform-macos.cpp b/tools/profiler/core/platform-macos.cpp
index 356d9f803e..78f000c470 100644
--- a/tools/profiler/core/platform-macos.cpp
+++ b/tools/profiler/core/platform-macos.cpp
@@ -15,7 +15,6 @@
#include <semaphore.h>
#include <signal.h>
#include <libkern/OSAtomic.h>
-#include <libproc.h>
#include <mach/mach.h>
#include <mach/semaphore.h>
#include <mach/task.h>
@@ -83,13 +82,12 @@ static RunningTimes GetProcessRunningTimesDiff(
{
AUTO_PROFILER_STATS(GetProcessRunningTimes_task_info);
- static const auto pid = getpid();
- struct proc_taskinfo pti;
- if ((unsigned long)proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &pti,
- PROC_PIDTASKINFO_SIZE) >=
- PROC_PIDTASKINFO_SIZE) {
- newRunningTimes.SetThreadCPUDelta(pti.pti_total_user +
- pti.pti_total_system);
+ task_power_info_data_t task_power_info;
+ mach_msg_type_number_t count = TASK_POWER_INFO_COUNT;
+ if (task_info(mach_task_self(), TASK_POWER_INFO,
+ (task_info_t)&task_power_info, &count) == KERN_SUCCESS) {
+ newRunningTimes.SetThreadCPUDelta(task_power_info.total_user +
+ task_power_info.total_system);
}
newRunningTimes.SetPostMeasurementTimeStamp(TimeStamp::Now());
};