diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-12-06 23:37:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:36 -0500 |
commit | ece8a684c75df215320b4155944979e3f78c5c93 (patch) | |
tree | 2a65e786dd70ab368c12836a39c36070c0e4974f /include/linux/profile.h | |
parent | 70888bd5b70579e278d5ef1b7e1ec6a420d38b9e (diff) |
[PATCH] sleep profiling
Implement prof=sleep profiling. TASK_UNINTERRUPTIBLE sleeps will be taken
as a profile hit, and every millisecond spent sleeping causes a profile-hit
for the call site that initiated the sleep.
Sample readprofile output on i386:
306 ps2_sendbyte 1.3973
432 call_usermodehelper_keys 1.9548
484 ps2_command 0.6453
790 __driver_attach 4.7879
1593 msleep 44.2500
3976 sync_buffer 64.1290
4076 do_lookup 12.4648
8587 sync_page 122.6714
20820 total 0.0067
(NOTE: architectures need to check whether get_wchan() can be called from
deep within the wakeup path.)
akpm: we need to mark more functions __sched. lock_sock(), msleep(), others..
akpm: the contention in do_lookup() is a surprise. Presumably doing disk
reads for directory contents while holding i_mutex.
[akpm@osdl.org: various fixes]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/profile.h')
-rw-r--r-- | include/linux/profile.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/profile.h b/include/linux/profile.h index acce53fd38b6..5670b340c4ef 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -6,10 +6,15 @@ | |||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
9 | #include <linux/cache.h> | ||
10 | |||
9 | #include <asm/errno.h> | 11 | #include <asm/errno.h> |
10 | 12 | ||
13 | extern int prof_on __read_mostly; | ||
14 | |||
11 | #define CPU_PROFILING 1 | 15 | #define CPU_PROFILING 1 |
12 | #define SCHED_PROFILING 2 | 16 | #define SCHED_PROFILING 2 |
17 | #define SLEEP_PROFILING 3 | ||
13 | 18 | ||
14 | struct proc_dir_entry; | 19 | struct proc_dir_entry; |
15 | struct pt_regs; | 20 | struct pt_regs; |
@@ -18,7 +23,24 @@ struct notifier_block; | |||
18 | /* init basic kernel profiler */ | 23 | /* init basic kernel profiler */ |
19 | void __init profile_init(void); | 24 | void __init profile_init(void); |
20 | void profile_tick(int); | 25 | void profile_tick(int); |
21 | void profile_hit(int, void *); | 26 | |
27 | /* | ||
28 | * Add multiple profiler hits to a given address: | ||
29 | */ | ||
30 | void profile_hits(int, void *ip, unsigned int nr_hits); | ||
31 | |||
32 | /* | ||
33 | * Single profiler hit: | ||
34 | */ | ||
35 | static inline void profile_hit(int type, void *ip) | ||
36 | { | ||
37 | /* | ||
38 | * Speedup for the common (no profiling enabled) case: | ||
39 | */ | ||
40 | if (unlikely(prof_on == type)) | ||
41 | profile_hits(type, ip, 1); | ||
42 | } | ||
43 | |||
22 | #ifdef CONFIG_PROC_FS | 44 | #ifdef CONFIG_PROC_FS |
23 | void create_prof_cpu_mask(struct proc_dir_entry *); | 45 | void create_prof_cpu_mask(struct proc_dir_entry *); |
24 | #else | 46 | #else |