]> err.no Git - linux-2.6/commitdiff
sched: debug: show a weight tree
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Sat, 19 Apr 2008 17:45:00 +0000 (19:45 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 19 Apr 2008 17:45:00 +0000 (19:45 +0200)
Print a tree of weights.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched_fair.c

index d72e8b41b3e4ff612c0e9746b7c38c8096f67abf..89fa32b4edf27d500c3d6c644596ffc4afb881f5 100644 (file)
@@ -1611,6 +1611,30 @@ static const struct sched_class fair_sched_class = {
 };
 
 #ifdef CONFIG_SCHED_DEBUG
+static void
+print_cfs_rq_tasks(struct seq_file *m, struct cfs_rq *cfs_rq, int depth)
+{
+       struct sched_entity *se;
+
+       if (!cfs_rq)
+               return;
+
+       list_for_each_entry_rcu(se, &cfs_rq->tasks, group_node) {
+               int i;
+
+               for (i = depth; i; i--)
+                       seq_puts(m, "  ");
+
+               seq_printf(m, "%lu %s %lu\n",
+                               se->load.weight,
+                               entity_is_task(se) ? "T" : "G",
+                               calc_delta_weight(SCHED_LOAD_SCALE, se)
+                               );
+               if (!entity_is_task(se))
+                       print_cfs_rq_tasks(m, group_cfs_rq(se), depth + 1);
+       }
+}
+
 static void print_cfs_stats(struct seq_file *m, int cpu)
 {
        struct cfs_rq *cfs_rq;
@@ -1618,6 +1642,9 @@ static void print_cfs_stats(struct seq_file *m, int cpu)
        rcu_read_lock();
        for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq)
                print_cfs_rq(m, cpu, cfs_rq);
+
+       seq_printf(m, "\nWeight tree:\n");
+       print_cfs_rq_tasks(m, &cpu_rq(cpu)->cfs, 1);
        rcu_read_unlock();
 }
 #endif