mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
taskstats: add context-switch counters
Make available to the user the following task and process performance statistics: * Involuntary Context Switches (task_struct->nivcsw) * Voluntary Context Switches (task_struct->nvcsw) Statistics information is available from: 1. taskstats interface (Documentation/accounting/) 2. /proc/PID/status (task only). This data is useful for detecting hyperactivity patterns between processes. [akpm@linux-foundation.org: cleanup] Signed-off-by: Maxim Uvarov <muvarov@ru.mvista.com> Cc: Shailabh Nagar <nagar@watson.ibm.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Jay Lan <jlan@engr.sgi.com> Cc: Jonathan Lim <jlim@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a6c15c2b0f
commit
b663a79c19
5 changed files with 41 additions and 3 deletions
|
@ -289,6 +289,15 @@ static inline char *task_cap(struct task_struct *p, char *buffer)
|
|||
cap_t(p->cap_effective));
|
||||
}
|
||||
|
||||
static inline char *task_context_switch_counts(struct task_struct *p,
|
||||
char *buffer)
|
||||
{
|
||||
return buffer + sprintf(buffer, "voluntary_ctxt_switches:\t%lu\n"
|
||||
"nonvoluntary_ctxt_switches:\t%lu\n",
|
||||
p->nvcsw,
|
||||
p->nivcsw);
|
||||
}
|
||||
|
||||
int proc_pid_status(struct task_struct *task, char * buffer)
|
||||
{
|
||||
char * orig = buffer;
|
||||
|
@ -307,6 +316,7 @@ int proc_pid_status(struct task_struct *task, char * buffer)
|
|||
#if defined(CONFIG_S390)
|
||||
buffer = task_show_regs(task, buffer);
|
||||
#endif
|
||||
buffer = task_context_switch_counts(task, buffer);
|
||||
return buffer - orig;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue