mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
[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>
This commit is contained in:
parent
70888bd5b7
commit
ece8a684c7
4 changed files with 65 additions and 10 deletions
|
@ -6,10 +6,15 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/cache.h>
|
||||
|
||||
#include <asm/errno.h>
|
||||
|
||||
extern int prof_on __read_mostly;
|
||||
|
||||
#define CPU_PROFILING 1
|
||||
#define SCHED_PROFILING 2
|
||||
#define SLEEP_PROFILING 3
|
||||
|
||||
struct proc_dir_entry;
|
||||
struct pt_regs;
|
||||
|
@ -18,7 +23,24 @@ struct notifier_block;
|
|||
/* init basic kernel profiler */
|
||||
void __init profile_init(void);
|
||||
void profile_tick(int);
|
||||
void profile_hit(int, void *);
|
||||
|
||||
/*
|
||||
* Add multiple profiler hits to a given address:
|
||||
*/
|
||||
void profile_hits(int, void *ip, unsigned int nr_hits);
|
||||
|
||||
/*
|
||||
* Single profiler hit:
|
||||
*/
|
||||
static inline void profile_hit(int type, void *ip)
|
||||
{
|
||||
/*
|
||||
* Speedup for the common (no profiling enabled) case:
|
||||
*/
|
||||
if (unlikely(prof_on == type))
|
||||
profile_hits(type, ip, 1);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
void create_prof_cpu_mask(struct proc_dir_entry *);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue