-
-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running time of macOS process #1619
Labels
Milestone
Comments
aestriplex
added a commit
to aestriplex/htop
that referenced
this issue
Feb 23, 2025
aestriplex
added a commit
to aestriplex/htop
that referenced
this issue
Feb 23, 2025
…unning time has changed (htop-dev#1619)
Please avoid function-like macros and prefer Shouldn't BTW: Please do a PR for this branch. It makes commenting the changes easier. If still working on things, marking the PR as draft is fine. |
@BenBE I move this on a pr |
Merged
Merged
BenBE
pushed a commit
to aestriplex/htop
that referenced
this issue
Feb 25, 2025
BenBE
pushed a commit
to aestriplex/htop
that referenced
this issue
Feb 25, 2025
BenBE
pushed a commit
to aestriplex/htop
that referenced
this issue
Feb 25, 2025
…unning time has changed Fixes: htop-dev#1619
aestriplex
added a commit
to aestriplex/htop
that referenced
this issue
Feb 25, 2025
aestriplex
added a commit
to aestriplex/htop
that referenced
this issue
Feb 25, 2025
…unning time has changed Fixes: htop-dev#1619
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
At the moment, the running time of processes on macOS is not updated correctly. I made two commit to try to fix this problem. The branch is rebased on the PR #1617.
Summary:
Platform_machTicksToNanoseconds
. Theproc_taskinfo
structure contains the running time (both system and user) of the process. We should just take those value in nanoseconds and convert them in the proper unit. How the kernel handles this calculation (starting from low level cpu-dependent details) should not concern us.nanosecondsToCentiseconds
because for some reason we lose precision (± 1ms) with that calculation. If we divide directly by 1e7, we get a more precise measure. Probably it's a good idea to have an inline function or (maybe better) a macro, just to give a name to that operation and avoid the magic number;DarwinProcess_setFromLibprocPidinfo
function. We should update the CPU usage value if the total CPU running time of the process is greater than the CPU running time of the process in the previous iteration. To do that, we do not need to use thetimeIntervalNS
.TODO:
static double Platform_nanosecondsPerMachTick
var inDarwin/Platform.c
as well. It's only used in the (removed)Platform_machTicksToNanoseconds
.Platform_calculateNanosecondsPerMachTick
function inDarwin/PlatformHelpers.c
. It's only used to set thestatic double Platform_nanosecondsPerMachTick
var once.I attach here 3 sshot. The first one is the current version (3.3.0), the second one is the
darwin-running-time
brach, and the last one is top.darwin-running-time
:The text was updated successfully, but these errors were encountered: