aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/Changes2
-rw-r--r--Documentation/basic_profiling.txt10
-rw-r--r--drivers/oprofile/buffer_sync.c29
-rw-r--r--drivers/oprofile/event_buffer.h3
4 files changed, 29 insertions, 15 deletions
diff --git a/Documentation/Changes b/Documentation/Changes
index 57542bc25edd..b37600754762 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -63,7 +63,7 @@ o PPP 2.4.0 # pppd --version
63o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version 63o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version
64o nfs-utils 1.0.5 # showmount --version 64o nfs-utils 1.0.5 # showmount --version
65o procps 3.2.0 # ps --version 65o procps 3.2.0 # ps --version
66o oprofile 0.5.3 # oprofiled --version 66o oprofile 0.9 # oprofiled --version
67 67
68Kernel compilation 68Kernel compilation
69================== 69==================
diff --git a/Documentation/basic_profiling.txt b/Documentation/basic_profiling.txt
index 65e3dc2d4437..8764e9f70821 100644
--- a/Documentation/basic_profiling.txt
+++ b/Documentation/basic_profiling.txt
@@ -27,9 +27,13 @@ dump output readprofile -m /boot/System.map > captured_profile
27 27
28Oprofile 28Oprofile
29-------- 29--------
30Get the source (I use 0.8) from http://oprofile.sourceforge.net/ 30
31and add "idle=poll" to the kernel command line 31Get the source (see Changes for required version) from
32http://oprofile.sourceforge.net/ and add "idle=poll" to the kernel command
33line.
34
32Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel 35Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel
36
33./configure --with-kernel-support 37./configure --with-kernel-support
34make install 38make install
35 39
@@ -46,7 +50,7 @@ start opcontrol --start
46stop opcontrol --stop 50stop opcontrol --stop
47dump output opreport > output_file 51dump output opreport > output_file
48 52
49To only report on the kernel, run opreport /boot/vmlinux > output_file 53To only report on the kernel, run opreport -l /boot/vmlinux > output_file
50 54
51A reset is needed to clear old statistics, which survive a reboot. 55A reset is needed to clear old statistics, which survive a reboot.
52 56
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 745a14183634..531b07313141 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -206,7 +206,7 @@ static inline unsigned long fast_get_dcookie(struct dentry * dentry,
206 */ 206 */
207static unsigned long get_exec_dcookie(struct mm_struct * mm) 207static unsigned long get_exec_dcookie(struct mm_struct * mm)
208{ 208{
209 unsigned long cookie = 0; 209 unsigned long cookie = NO_COOKIE;
210 struct vm_area_struct * vma; 210 struct vm_area_struct * vma;
211 211
212 if (!mm) 212 if (!mm)
@@ -234,35 +234,42 @@ out:
234 */ 234 */
235static unsigned long lookup_dcookie(struct mm_struct * mm, unsigned long addr, off_t * offset) 235static unsigned long lookup_dcookie(struct mm_struct * mm, unsigned long addr, off_t * offset)
236{ 236{
237 unsigned long cookie = 0; 237 unsigned long cookie = NO_COOKIE;
238 struct vm_area_struct * vma; 238 struct vm_area_struct * vma;
239 239
240 for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) { 240 for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) {
241 241
242 if (!vma->vm_file)
243 continue;
244
245 if (addr < vma->vm_start || addr >= vma->vm_end) 242 if (addr < vma->vm_start || addr >= vma->vm_end)
246 continue; 243 continue;
247 244
248 cookie = fast_get_dcookie(vma->vm_file->f_dentry, 245 if (vma->vm_file) {
249 vma->vm_file->f_vfsmnt); 246 cookie = fast_get_dcookie(vma->vm_file->f_dentry,
250 *offset = (vma->vm_pgoff << PAGE_SHIFT) + addr - vma->vm_start; 247 vma->vm_file->f_vfsmnt);
248 *offset = (vma->vm_pgoff << PAGE_SHIFT) + addr -
249 vma->vm_start;
250 } else {
251 /* must be an anonymous map */
252 *offset = addr;
253 }
254
251 break; 255 break;
252 } 256 }
253 257
258 if (!vma)
259 cookie = INVALID_COOKIE;
260
254 return cookie; 261 return cookie;
255} 262}
256 263
257 264
258static unsigned long last_cookie = ~0UL; 265static unsigned long last_cookie = INVALID_COOKIE;
259 266
260static void add_cpu_switch(int i) 267static void add_cpu_switch(int i)
261{ 268{
262 add_event_entry(ESCAPE_CODE); 269 add_event_entry(ESCAPE_CODE);
263 add_event_entry(CPU_SWITCH_CODE); 270 add_event_entry(CPU_SWITCH_CODE);
264 add_event_entry(i); 271 add_event_entry(i);
265 last_cookie = ~0UL; 272 last_cookie = INVALID_COOKIE;
266} 273}
267 274
268static void add_kernel_ctx_switch(unsigned int in_kernel) 275static void add_kernel_ctx_switch(unsigned int in_kernel)
@@ -317,7 +324,7 @@ static int add_us_sample(struct mm_struct * mm, struct op_sample * s)
317 324
318 cookie = lookup_dcookie(mm, s->eip, &offset); 325 cookie = lookup_dcookie(mm, s->eip, &offset);
319 326
320 if (!cookie) { 327 if (cookie == INVALID_COOKIE) {
321 atomic_inc(&oprofile_stats.sample_lost_no_mapping); 328 atomic_inc(&oprofile_stats.sample_lost_no_mapping);
322 return 0; 329 return 0;
323 } 330 }
diff --git a/drivers/oprofile/event_buffer.h b/drivers/oprofile/event_buffer.h
index 442aaad391e0..018023630599 100644
--- a/drivers/oprofile/event_buffer.h
+++ b/drivers/oprofile/event_buffer.h
@@ -35,6 +35,9 @@ void wake_up_buffer_waiter(void);
35#define TRACE_BEGIN_CODE 8 35#define TRACE_BEGIN_CODE 8
36#define TRACE_END_CODE 9 36#define TRACE_END_CODE 9
37 37
38#define INVALID_COOKIE ~0UL
39#define NO_COOKIE 0UL
40
38/* add data to the event buffer */ 41/* add data to the event buffer */
39void add_event_entry(unsigned long data); 42void add_event_entry(unsigned long data);
40 43