linux/kernel/sched_debug.c
<<
>>
Prefs
   1/*
   2 * kernel/time/sched_debug.c
   3 *
   4 * Print the CFS rbtree
   5 *
   6 * Copyright(C) 2007, Red Hat, Inc., Ingo Molnar
   7 *
   8 * This program is free software; you can redistribute it and/or modify
   9 * it under the terms of the GNU General Public License version 2 as
  10 * published by the Free Software Foundation.
  11 */
  12
  13#include <linux/proc_fs.h>
  14#include <linux/sched.h>
  15#include <linux/seq_file.h>
  16#include <linux/kallsyms.h>
  17#include <linux/utsname.h>
  18
  19/*
  20 * This allows printing both to /proc/sched_debug and
  21 * to the console
  22 */
  23#define SEQ_printf(m, x...)                     \
  24 do {                                           \
  25        if (m)                                  \
  26                seq_printf(m, x);               \
  27        else                                    \
  28                printk(x);                      \
  29 } while (0)
  30
  31/*
  32 * Ease the printing of nsec fields:
  33 */
  34static long long nsec_high(unsigned long long nsec)
  35{
  36        if ((long long)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(unsigned long long nsec)
  47{
  48        if ((long long)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
  56#ifdef CONFIG_FAIR_GROUP_SCHED
  57static void print_cfs_group_stats(struct seq_file *m, int cpu,
  58                struct task_group *tg)
  59{
  60        struct sched_entity *se = tg->se[cpu];
  61        if (!se)
  62                return;
  63
  64#define P(F) \
  65        SEQ_printf(m, "  .%-30s: %lld\n", #F, (long long)F)
  66#define PN(F) \
  67        SEQ_printf(m, "  .%-30s: %lld.%06ld\n", #F, SPLIT_NS((long long)F))
  68
  69        PN(se->exec_start);
  70        PN(se->vruntime);
  71        PN(se->sum_exec_runtime);
  72#ifdef CONFIG_SCHEDSTATS
  73        PN(se->wait_start);
  74        PN(se->sleep_start);
  75        PN(se->block_start);
  76        PN(se->sleep_max);
  77        PN(se->block_max);
  78        PN(se->exec_max);
  79        PN(