Status: New
Owner: ----
CC:
psu...@googlegroups.com
Labels: Type-Enhancement Priority-Medium Milestone-1.0.0
New issue 302 by g.rodola: Process number of context switches
http://code.google.com/p/psutil/issues/detail?id=302
Proposal
Add the possibility to determine the number of context switches executed by
a given process:
http://www.linfo.org/context_switch.html
http://en.wikipedia.org/wiki/Context_switch
What a user might typically want to do with them is to monitor a process
and figure out the increase rate of ctx switches every second.
On what platforms would this be available?
All
Proposed API
>>> p = psutil.Process(pid)
>>> p.get_num_ctx_switches()
ctxs(voluntary=9123, involuntary=1238)
The voluntary/involuntary distinction should exist in the UNIX world only.
On Windows we can fill 'voluntary' and leave 'involuntary' to 0.
Are there existent implementations we can use as an example?
On Windows this can be determined by using SYSTEM_PROCESS_INFORMATION
struct:
http://alax.info/blog/1182
On Linux we read /prof as always.
Still haven't looked into BSD/OSX but it's very likely they are exposed.
--
You received this message because you were CC'd on the issue.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply to this email to add a comment.