aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2007-10-15 11:00:08 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:08 -0400
commitef83a5714d9a817b2e9b97f04a6d070fbd6ecf80 (patch)
treee69d0e25d735db8137538d2eb78104d3fe9a2844 /kernel
parent1a75b94f7bda591f4c53af86baa50e1eaee35927 (diff)
sched: enhance debug output
enhance debug output by changing 12345678 nsecs to 12.345678 output, this is more human-readable. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched_debug.c108
1 files changed, 68 insertions, 40 deletions
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 22cf74c1dc03..e2c1e0dfdf50 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -28,6 +28,31 @@
28 printk(x); \ 28 printk(x); \
29 } while (0) 29 } while (0)
30 30
31/*
32 * Ease the printing of nsec fields:
33 */
34static long long nsec_high(long long nsec)
35{
36 if (nsec < 0) {
37 nsec = -nsec;
38 do_div(nsec, 1000000);
39 return -nsec;
40 }
41 do_div(nsec, 1000000);
42
43 return nsec;
44}
45
46static unsigned long nsec_low(long long nsec)
47{
48 if (nsec < 0)
49 nsec = -nsec;
50
51 return do_div(nsec, 1000000);
52}
53
54#define SPLIT_NS(x) nsec_high(x), nsec_low(x)
55
31static void 56static void
32print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) 57print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
33{ 58{
@@ -36,19 +61,19 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
36 else 61 else
37 SEQ_printf(m, " "); 62 SEQ_printf(m, " ");
38 63
39 SEQ_printf(m, "%15s %5d %15Ld %13Ld %5d ", 64 SEQ_printf(m, "%15s %5d %9Ld.%06ld %9Ld %5d ",
40 p->comm, p->pid, 65 p->comm, p->pid,
41 (long long)p->se.vruntime, 66 SPLIT_NS(p->se.vruntime),
42 (long long)(p->nvcsw + p->nivcsw), 67 (long long)(p->nvcsw + p->nivcsw),
43 p->prio); 68 p->prio);
44#ifdef CONFIG_SCHEDSTATS 69#ifdef CONFIG_SCHEDSTATS
45 SEQ_printf(m, "%15Ld %15Ld %15Ld\n", 70 SEQ_printf(m, "%15Ld.%06ld %15Ld.%06ld %15Ld.%06ld\n",
46 (long long)p->se.vruntime, 71 SPLIT_NS(p->se.vruntime),
47 (long long)p->se.sum_exec_runtime, 72 SPLIT_NS(p->se.sum_exec_runtime),
48 (long long)p->se.sum_sleep_runtime); 73 SPLIT_NS(p->se.sum_sleep_runtime));
49#else 74#else
50 SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n", 75 SEQ_printf(m, "%15Ld %15Ld %15Ld.%06ld %15Ld.%06ld %15Ld.%06ld\n",
51 0LL, 0LL, 0LL, 0LL, 0LL); 76 0LL, 0LL, 0LL, 0L, 0LL, 0L, 0LL, 0L);
52#endif 77#endif
53} 78}
54 79
@@ -85,10 +110,8 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
85 110
86 SEQ_printf(m, "\ncfs_rq\n"); 111 SEQ_printf(m, "\ncfs_rq\n");
87 112
88#define P(x) \ 113 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock",
89 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(cfs_rq->x)) 114 SPLIT_NS(cfs_rq->exec_clock));
90
91 P(exec_clock);
92 115
93 spin_lock_irqsave(&rq->lock, flags); 116 spin_lock_irqsave(&rq->lock, flags);
94 if (cfs_rq->rb_leftmost) 117 if (cfs_rq->rb_leftmost)
@@ -99,19 +122,18 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
99 min_vruntime = rq->cfs.min_vruntime; 122 min_vruntime = rq->cfs.min_vruntime;
100 rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime; 123 rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime;
101 spin_unlock_irqrestore(&rq->lock, flags); 124 spin_unlock_irqrestore(&rq->lock, flags);
102 SEQ_printf(m, " .%-30s: %Ld\n", "MIN_vruntime", 125 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "MIN_vruntime",
103 (long long)MIN_vruntime); 126 SPLIT_NS(MIN_vruntime));
104 SEQ_printf(m, " .%-30s: %Ld\n", "min_vruntime", 127 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "min_vruntime",
105 (long long)min_vruntime); 128 SPLIT_NS(min_vruntime));
106 SEQ_printf(m, " .%-30s: %Ld\n", "max_vruntime", 129 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "max_vruntime",
107 (long long)max_vruntime); 130 SPLIT_NS(max_vruntime));
108 spread = max_vruntime - MIN_vruntime; 131 spread = max_vruntime - MIN_vruntime;
109 SEQ_printf(m, " .%-30s: %Ld\n", "spread", 132 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread",
110 (long long)spread); 133 SPLIT_NS(spread));
111 spread0 = min_vruntime - rq0_min_vruntime; 134 spread0 = min_vruntime - rq0_min_vruntime;
112 SEQ_printf(m, " .%-30s: %Ld\n", "spread0", 135 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread0",
113 (long long)spread0); 136 SPLIT_NS(spread0));
114#undef P
115} 137}
116 138
117static void print_cpu(struct seq_file *m, int cpu) 139static void print_cpu(struct seq_file *m, int cpu)
@@ -131,6 +153,8 @@ static void print_cpu(struct seq_file *m, int cpu)
131 153
132#define P(x) \ 154#define P(x) \
133 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rq->x)) 155 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rq->x))
156#define PN(x) \
157 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", #x, SPLIT_NS(rq->x))
134 158
135 P(nr_running); 159 P(nr_running);
136 SEQ_printf(m, " .%-30s: %lu\n", "load", 160 SEQ_printf(m, " .%-30s: %lu\n", "load",
@@ -139,21 +163,22 @@ static void print_cpu(struct seq_file *m, int cpu)
139 P(nr_load_updates); 163 P(nr_load_updates);
140 P(nr_uninterruptible); 164 P(nr_uninterruptible);
141 SEQ_printf(m, " .%-30s: %lu\n", "jiffies", jiffies); 165 SEQ_printf(m, " .%-30s: %lu\n", "jiffies", jiffies);
142 P(next_balance); 166 PN(next_balance);
143 P(curr->pid); 167 P(curr->pid);
144 P(clock); 168 PN(clock);
145 P(idle_clock); 169 PN(idle_clock);
146 P(prev_clock_raw); 170 PN(prev_clock_raw);
147 P(clock_warps); 171 P(clock_warps);
148 P(clock_overflows); 172 P(clock_overflows);
149 P(clock_deep_idle_events); 173 P(clock_deep_idle_events);
150 P(clock_max_delta); 174 PN(clock_max_delta);
151 P(cpu_load[0]); 175 P(cpu_load[0]);
152 P(cpu_load[1]); 176 P(cpu_load[1]);
153 P(cpu_load[2]); 177 P(cpu_load[2]);
154 P(cpu_load[3]); 178 P(cpu_load[3]);
155 P(cpu_load[4]); 179 P(cpu_load[4]);
156#undef P 180#undef P
181#undef PN
157 182
158 print_cfs_stats(m, cpu); 183 print_cfs_stats(m, cpu);
159 184
@@ -170,7 +195,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
170 (int)strcspn(init_utsname()->version, " "), 195 (int)strcspn(init_utsname()->version, " "),
171 init_utsname()->version); 196 init_utsname()->version);
172 197
173 SEQ_printf(m, "now at %Lu nsecs\n", (unsigned long long)now); 198 SEQ_printf(m, "now at %Lu.%06ld msecs\n", SPLIT_NS(now));
174 199
175 for_each_online_cpu(cpu) 200 for_each_online_cpu(cpu)
176 print_cpu(m, cpu); 201 print_cpu(m, cpu);
@@ -228,20 +253,22 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
228 SEQ_printf(m, "----------------------------------------------\n"); 253 SEQ_printf(m, "----------------------------------------------\n");
229#define P(F) \ 254#define P(F) \
230 SEQ_printf(m, "%-25s:%20Ld\n", #F, (long long)p->F) 255 SEQ_printf(m, "%-25s:%20Ld\n", #F, (long long)p->F)
256#define PN(F) \
257 SEQ_printf(m, "%-25s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F))
231 258
232 P(se.exec_start); 259 PN(se.exec_start);
233 P(se.vruntime); 260 PN(se.vruntime);
234 P(se.sum_exec_runtime); 261 PN(se.sum_exec_runtime);
235 262
236#ifdef CONFIG_SCHEDSTATS 263#ifdef CONFIG_SCHEDSTATS
237 P(se.wait_start); 264 PN(se.wait_start);
238 P(se.sleep_start); 265 PN(se.sleep_start);
239 P(se.block_start); 266 PN(se.block_start);
240 P(se.sleep_max); 267 PN(se.sleep_max);
241 P(se.block_max); 268 PN(se.block_max);
242 P(se.exec_max); 269 PN(se.exec_max);
243 P(se.slice_max); 270 PN(se.slice_max);
244 P(se.wait_max); 271 PN(se.wait_max);
245#endif 272#endif
246 SEQ_printf(m, "%-25s:%20Ld\n", 273 SEQ_printf(m, "%-25s:%20Ld\n",
247 "nr_switches", (long long)(p->nvcsw + p->nivcsw)); 274 "nr_switches", (long long)(p->nvcsw + p->nivcsw));
@@ -249,6 +276,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
249 P(policy); 276 P(policy);
250 P(prio); 277 P(prio);
251#undef P 278#undef P
279#undef PN
252 280
253 { 281 {
254 u64 t0, t1; 282 u64 t0, t1;