summaryrefslogtreecommitdiffstats
path: root/darwin/DarwinProcess.c
diff options
context:
space:
mode:
authorAlexander Momchilov <alexandermomchilov@gmail.com>2021-08-22 10:47:11 -0400
committerAlexander Momchilov <alexandermomchilov@gmail.com>2021-08-25 11:55:05 -0400
commit59d0c5b26a55a68be059f2ac32a7c083b2ff01ee (patch)
tree740efac73ae33c02ca512f46c3ee2f8119c73ef8 /darwin/DarwinProcess.c
parentfa48c484cc6db90736789b9ff811fd5bc8dc119d (diff)
Refactor Darwin platform unit conversion helpers
Diffstat (limited to 'darwin/DarwinProcess.c')
-rw-r--r--darwin/DarwinProcess.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c
index d9834af3..70cce725 100644
--- a/darwin/DarwinProcess.c
+++ b/darwin/DarwinProcess.c
@@ -269,13 +269,6 @@ ERROR_A:
Process_updateCmdline(proc, k->kp_proc.p_comm, 0, strlen(k->kp_proc.p_comm));
}
-// Converts ticks in the Mach "timebase" to nanoseconds.
-// See `mach_timebase_info`, as used to define the `Platform_timebaseToNS` constant.
-static uint64_t machTicksToNanoseconds(uint64_t schedulerTicks) {
- double nanoseconds_per_mach_tick = Platform_timebaseToNS;
- return (uint64_t) (nanoseconds_per_mach_tick * (double) schedulerTicks);
-}
-
// Converts nanoseconds to hundreths of a second (centiseconds) as needed by the "time" field of the Process struct.
static long long int nanosecondsToCentiseconds(uint64_t nanoseconds) {
const uint64_t centiseconds_per_second = 100;
@@ -350,8 +343,8 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList*
if (sizeof(pti) == proc_pidinfo(proc->super.pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {
uint64_t total_existing_time_ns = proc->stime + proc->utime;
- uint64_t user_time_ns = machTicksToNanoseconds(pti.pti_total_user);
- uint64_t system_time_ns = machTicksToNanoseconds(pti.pti_total_system);
+ uint64_t user_time_ns = Platform_machTicksToNanoseconds(pti.pti_total_user);
+ uint64_t system_time_ns = Platform_machTicksToNanoseconds(pti.pti_total_system);
uint64_t total_current_time_ns = user_time_ns + system_time_ns;

© 2014-2024 Faster IT GmbH | imprint | privacy policy