Skip to content
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

Windows / cpu_times(): return also dpc and interrupt time #789

Closed
giampaolo opened this issue Mar 4, 2016 · 1 comment
Closed

Windows / cpu_times(): return also dpc and interrupt time #789

giampaolo opened this issue Mar 4, 2016 · 1 comment

Comments

@giampaolo
Copy link
Owner

SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION structure provides DPC time and interrupt time:

typedef struct {
    LARGE_INTEGER IdleTime;
    LARGE_INTEGER KernelTime;
    LARGE_INTEGER UserTime;
    LARGE_INTEGER DpcTime;
    LARGE_INTEGER InterruptTime;
    ULONG InterruptCount;
} _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;

This is retrievable via NtQuerySystemInformation which is currently used for per_cpu_times() but not for cpu_times() which uses GetSystemTimes which does not provide these two metrics. cpu_times() may change in order to use NtQuerySystemInformation and extend the namedutple with the new values.

@giampaolo
Copy link
Owner Author

@wj32 in your opinion should interrupt and dpc times be excluded when calculating system-wide cpu percent? With this new feature the "busy time" is now calculated like this:

times_all = user + system + idle + interrupt + dpc
times_busy = times_all - idle

I wonder if this is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant