diff options
| author | Arjan van de Ven <arjan@linux.intel.com> | 2008-01-25 21:08:34 +0100 | 
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-01-25 21:08:34 +0100 | 
| commit | 9745512ce79de686df354dc70a8d1a74d801892d (patch) | |
| tree | 9b64e2b2e6d2ae534beef136922082f21701c7b9 /fs/proc/base.c | |
| parent | 326587b840785c60f5dc18557235a23bafefd620 (diff) | |
| download | olio-linux-3.10-9745512ce79de686df354dc70a8d1a74d801892d.tar.xz olio-linux-3.10-9745512ce79de686df354dc70a8d1a74d801892d.zip  | |
sched: latencytop support
LatencyTOP kernel infrastructure; it measures latencies in the
scheduler and tracks it system wide and per process.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/proc/base.c')
| -rw-r--r-- | fs/proc/base.c | 78 | 
1 files changed, 78 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 7411bfb0b7c..91fa8e6ce8a 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -310,6 +310,77 @@ static int proc_pid_schedstat(struct task_struct *task, char *buffer)  }  #endif +#ifdef CONFIG_LATENCYTOP +static int lstats_show_proc(struct seq_file *m, void *v) +{ +	int i; +	struct task_struct *task = m->private; +	seq_puts(m, "Latency Top version : v0.1\n"); + +	for (i = 0; i < 32; i++) { +		if (task->latency_record[i].backtrace[0]) { +			int q; +			seq_printf(m, "%i %li %li ", +				task->latency_record[i].count, +				task->latency_record[i].time, +				task->latency_record[i].max); +			for (q = 0; q < LT_BACKTRACEDEPTH; q++) { +				char sym[KSYM_NAME_LEN]; +				char *c; +				if (!task->latency_record[i].backtrace[q]) +					break; +				if (task->latency_record[i].backtrace[q] == ULONG_MAX) +					break; +				sprint_symbol(sym, task->latency_record[i].backtrace[q]); +				c = strchr(sym, '+'); +				if (c) +					*c = 0; +				seq_printf(m, "%s ", sym); +			} +			seq_printf(m, "\n"); +		} + +	} +	return 0; +} + +static int lstats_open(struct inode *inode, struct file *file) +{ +	int ret; +	struct seq_file *m; +	struct task_struct *task = get_proc_task(inode); + +	ret = single_open(file, lstats_show_proc, NULL); +	if (!ret) { +		m = file->private_data; +		m->private = task; +	} +	return ret; +} + +static ssize_t lstats_write(struct file *file, const char __user *buf, +			    size_t count, loff_t *offs) +{ +	struct seq_file *m; +	struct task_struct *task; + +	m = file->private_data; +	task = m->private; +	clear_all_latency_tracing(task); + +	return count; +} + +static const struct file_operations proc_lstats_operations = { +	.open		= lstats_open, +	.read		= seq_read, +	.write		= lstats_write, +	.llseek		= seq_lseek, +	.release	= single_release, +}; + +#endif +  /* The badness from the OOM killer */  unsigned long badness(struct task_struct *p, unsigned long uptime);  static int proc_oom_score(struct task_struct *task, char *buffer) @@ -1020,6 +1091,7 @@ static const struct file_operations proc_fault_inject_operations = {  };  #endif +  #ifdef CONFIG_SCHED_DEBUG  /*   * Print out various scheduling related per-task fields: @@ -2230,6 +2302,9 @@ static const struct pid_entry tgid_base_stuff[] = {  #ifdef CONFIG_SCHEDSTATS  	INF("schedstat",  S_IRUGO, pid_schedstat),  #endif +#ifdef CONFIG_LATENCYTOP +	REG("latency",  S_IRUGO, lstats), +#endif  #ifdef CONFIG_PROC_PID_CPUSET  	REG("cpuset",     S_IRUGO, cpuset),  #endif @@ -2555,6 +2630,9 @@ static const struct pid_entry tid_base_stuff[] = {  #ifdef CONFIG_SCHEDSTATS  	INF("schedstat", S_IRUGO, pid_schedstat),  #endif +#ifdef CONFIG_LATENCYTOP +	REG("latency",  S_IRUGO, lstats), +#endif  #ifdef CONFIG_PROC_PID_CPUSET  	REG("cpuset",    S_IRUGO, cpuset),  #endif  |