Skip to content

Commit

Permalink
darwin: nanoseconds to centi-seconds minor improvement
Browse files Browse the repository at this point in the history
Avoid the use of floating point division when integer division can do
it.
A follow-up of commit 9944d55.
  • Loading branch information
Explorer09 committed Feb 26, 2025
1 parent 77132de commit 5c7d418
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion darwin/DarwinProcess.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessTable
Process_updateCPUFieldWidths(proc->super.percent_cpu);

proc->super.state = pti.pti_numrunning > 0 ? RUNNING : SLEEPING;
proc->super.time = total_current_time_ns / 1e7;
// Convert from nanoseconds to hundredths of seconds
proc->super.time = total_current_time_ns / 10000000ULL;
proc->super.nlwp = pti.pti_threadnum;
proc->super.m_virt = pti.pti_virtual_size / ONE_K;
proc->super.m_resident = pti.pti_resident_size / ONE_K;
Expand Down

0 comments on commit 5c7d418

Please sign in to comment.