aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-01-25 15:08:34 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-25 15:08:34 -0500
commit9745512ce79de686df354dc70a8d1a74d801892d (patch)
tree9b64e2b2e6d2ae534beef136922082f21701c7b9 /fs/proc/base.c
parent326587b840785c60f5dc18557235a23bafefd620 (diff)
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.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7411bfb0b7cc..91fa8e6ce8ad 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)
310} 310}
311#endif 311#endif
312 312
313#ifdef CONFIG_LATENCYTOP
314static int lstats_show_proc(struct seq_file *m, void *v)
315{
316 int i;
317 struct task_struct *task = m->private;
318 seq_puts(m, "Latency Top version : v0.1\n");
319
320 for (i = 0; i < 32; i++) {
321 if (task->latency_record[i].backtrace[0]) {
322 int q;
323 seq_printf(m, "%i %li %li ",
324 task->latency_record[i].count,
325 task->latency_record[i].time,
326 task->latency_record[i].max);
327 for (q = 0; q < LT_BACKTRACEDEPTH; q++) {
328 char sym[KSYM_NAME_LEN];
329 char *c;
330 if (!task->latency_record[i].backtrace[q])
331 break;
332 if (task->latency_record[i].backtrace[q] == ULONG_MAX)
333 break;
334 sprint_symbol(sym, task->latency_record[i].backtrace[q]);
335 c = strchr(sym, '+');
336 if (c)
337 *c = 0;
338 seq_printf(m, "%s ", sym);
339 }
340 seq_printf(m, "\n");
341 }
342
343 }
344 return 0;
345}
346
347static int lstats_open(struct inode *inode, struct file *file)
348{
349 int ret;
350 struct seq_file *m;
351 struct task_struct *task = get_proc_task(inode);
352
353 ret = single_open(file, lstats_show_proc, NULL);
354 if (!ret) {
355 m = file->private_data;
356 m->private = task;
357 }
358 return ret;
359}
360
361static ssize_t lstats_write(struct file *file, const char __user *buf,
362 size_t count, loff_t *offs)
363{
364 struct seq_file *m;
365 struct task_struct *task;
366
367 m = file->private_data;
368 task = m->private;
369 clear_all_latency_tracing(task);
370
371 return count;
372}
373
374static const struct file_operations proc_lstats_operations = {
375 .open = lstats_open,
376 .read = seq_read,
377 .write = lstats_write,
378 .llseek = seq_lseek,
379 .release = single_release,
380};
381
382#endif
383
313/* The badness from the OOM killer */ 384/* The badness from the OOM killer */
314unsigned long badness(struct task_struct *p, unsigned long uptime); 385unsigned long badness(struct task_struct *p, unsigned long uptime);
315static int proc_oom_score(struct task_struct *task, char *buffer) 386static int proc_oom_score(struct task_struct *task, char *buffer)
@@ -1020,6 +1091,7 @@ static const struct file_operations proc_fault_inject_operations = {
1020}; 1091};
1021#endif 1092#endif
1022 1093
1094
1023#ifdef CONFIG_SCHED_DEBUG 1095#ifdef CONFIG_SCHED_DEBUG
1024/* 1096/*
1025 * Print out various scheduling related per-task fields: 1097 * Print out various scheduling related per-task fields:
@@ -2230,6 +2302,9 @@ static const struct pid_entry tgid_base_stuff[] = {
2230#ifdef CONFIG_SCHEDSTATS 2302#ifdef CONFIG_SCHEDSTATS
2231 INF("schedstat", S_IRUGO, pid_schedstat), 2303 INF("schedstat", S_IRUGO, pid_schedstat),
2232#endif 2304#endif
2305#ifdef CONFIG_LATENCYTOP
2306 REG("latency", S_IRUGO, lstats),
2307#endif
2233#ifdef CONFIG_PROC_PID_CPUSET 2308#ifdef CONFIG_PROC_PID_CPUSET
2234 REG("cpuset", S_IRUGO, cpuset), 2309 REG("cpuset", S_IRUGO, cpuset),
2235#endif 2310#endif
@@ -2555,6 +2630,9 @@ static const struct pid_entry tid_base_stuff[] = {
2555#ifdef CONFIG_SCHEDSTATS 2630#ifdef CONFIG_SCHEDSTATS
2556 INF("schedstat", S_IRUGO, pid_schedstat), 2631 INF("schedstat", S_IRUGO, pid_schedstat),
2557#endif 2632#endif
2633#ifdef CONFIG_LATENCYTOP
2634 REG("latency", S_IRUGO, lstats),
2635#endif
2558#ifdef CONFIG_PROC_PID_CPUSET 2636#ifdef CONFIG_PROC_PID_CPUSET
2559 REG("cpuset", S_IRUGO, cpuset), 2637 REG("cpuset", S_IRUGO, cpuset),
2560#endif 2638#endif