blob: 568286411b43ab5b48378eea1bbb0441bb8a520f [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Ingo Molnar03441a32017-02-08 18:51:35 +01002#ifndef _LINUX_SCHED_STAT_H
3#define _LINUX_SCHED_STAT_H
4
Ingo Molnardc199532017-02-08 18:51:57 +01005#include <linux/percpu.h>
Ingo Molnar03441a32017-02-08 18:51:35 +01006
Ingo Molnar3605df492017-02-03 11:03:12 +01007/*
8 * Various counters maintained by the scheduler and fork(),
9 * exposed via /proc, sys.c or used by drivers via these APIs.
10 *
Ingo Molnardfcb2452018-12-03 10:05:56 +010011 * ( Note that all these values are acquired without locking,
Ingo Molnar3605df492017-02-03 11:03:12 +010012 * so they can only be relied on in narrow circumstances. )
13 */
14
15extern unsigned long total_forks;
16extern int nr_threads;
17DECLARE_PER_CPU(unsigned long, process_counts);
18extern int nr_processes(void);
19extern unsigned long nr_running(void);
20extern bool single_task_running(void);
21extern unsigned long nr_iowait(void);
22extern unsigned long nr_iowait_cpu(int cpu);
Ingo Molnar3605df492017-02-03 11:03:12 +010023
Ingo Molnara2d7a742017-02-05 12:07:04 +010024static inline int sched_info_on(void)
25{
26#ifdef CONFIG_SCHEDSTATS
27 return 1;
28#elif defined(CONFIG_TASK_DELAY_ACCT)
29 extern int delayacct_on;
30 return delayacct_on;
31#else
32 return 0;
33#endif
34}
35
36#ifdef CONFIG_SCHEDSTATS
37void force_schedstat_enabled(void);
38#endif
39
Ingo Molnar03441a32017-02-08 18:51:35 +010040#endif /* _LINUX_SCHED_STAT_H */