Commit 832eb7cf authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Allow for profile_buf size = kernel text size

Patch from Ravikiran G Thirumalai <kiran@in.ibm.com>

Allows the kernel profiler to use a shift value of zero for
high-resolution profiling.

So instead of overloading a shift of zero to mean "not profiling", use
a separate flag for that.

This means that anyone who is currently using "profile=0" to disable
profiling has accidentally turned profiling on, so I added a printk.
parent 3b99bbbf
...@@ -602,7 +602,7 @@ void __init proc_misc_init(void) ...@@ -602,7 +602,7 @@ void __init proc_misc_init(void)
proc_root_kcore->size = proc_root_kcore->size =
(size_t)high_memory - PAGE_OFFSET + PAGE_SIZE; (size_t)high_memory - PAGE_OFFSET + PAGE_SIZE;
} }
if (prof_shift) { if (prof_on) {
entry = create_proc_entry("profile", S_IWUSR | S_IRUGO, NULL); entry = create_proc_entry("profile", S_IWUSR | S_IRUGO, NULL);
if (entry) { if (entry) {
entry->proc_fops = &proc_profile_operations; entry->proc_fops = &proc_profile_operations;
......
...@@ -17,6 +17,7 @@ void __init profile_init(void); ...@@ -17,6 +17,7 @@ void __init profile_init(void);
extern unsigned int * prof_buffer; extern unsigned int * prof_buffer;
extern unsigned long prof_len; extern unsigned long prof_len;
extern unsigned long prof_shift; extern unsigned long prof_shift;
extern int prof_on;
enum profile_type { enum profile_type {
......
...@@ -14,12 +14,16 @@ extern char _stext, _etext; ...@@ -14,12 +14,16 @@ extern char _stext, _etext;
unsigned int * prof_buffer; unsigned int * prof_buffer;
unsigned long prof_len; unsigned long prof_len;
unsigned long prof_shift; unsigned long prof_shift;
int prof_on;
int __init profile_setup(char * str) int __init profile_setup(char * str)
{ {
int par; int par;
if (get_option(&str,&par)) if (get_option(&str,&par)) {
prof_shift = par; prof_shift = par;
prof_on = 1;
printk(KERN_INFO "kernel profiling enabled\n");
}
return 1; return 1;
} }
...@@ -28,7 +32,7 @@ void __init profile_init(void) ...@@ -28,7 +32,7 @@ void __init profile_init(void)
{ {
unsigned int size; unsigned int size;
if (!prof_shift) if (!prof_on)
return; return;
/* only text is profiled */ /* only text is profiled */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment