diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/oprofile/buffer_sync.c | 3 | ||||
-rw-r--r-- | drivers/oprofile/event_buffer.h | 20 | ||||
-rw-r--r-- | drivers/oprofile/oprof.c | 28 |
3 files changed, 31 insertions, 20 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index edd6de995726..8134c7e198a5 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -26,8 +26,9 @@ | |||
26 | #include <linux/profile.h> | 26 | #include <linux/profile.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
29 | #include <linux/oprofile.h> | ||
29 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
30 | 31 | ||
31 | #include "oprofile_stats.h" | 32 | #include "oprofile_stats.h" |
32 | #include "event_buffer.h" | 33 | #include "event_buffer.h" |
33 | #include "cpu_buffer.h" | 34 | #include "cpu_buffer.h" |
diff --git a/drivers/oprofile/event_buffer.h b/drivers/oprofile/event_buffer.h index 9b6a4ebd03e3..5076ed1ebd8f 100644 --- a/drivers/oprofile/event_buffer.h +++ b/drivers/oprofile/event_buffer.h | |||
@@ -19,28 +19,10 @@ void free_event_buffer(void); | |||
19 | 19 | ||
20 | /* wake up the process sleeping on the event file */ | 20 | /* wake up the process sleeping on the event file */ |
21 | void wake_up_buffer_waiter(void); | 21 | void wake_up_buffer_waiter(void); |
22 | 22 | ||
23 | /* Each escaped entry is prefixed by ESCAPE_CODE | ||
24 | * then one of the following codes, then the | ||
25 | * relevant data. | ||
26 | */ | ||
27 | #define ESCAPE_CODE ~0UL | ||
28 | #define CTX_SWITCH_CODE 1 | ||
29 | #define CPU_SWITCH_CODE 2 | ||
30 | #define COOKIE_SWITCH_CODE 3 | ||
31 | #define KERNEL_ENTER_SWITCH_CODE 4 | ||
32 | #define KERNEL_EXIT_SWITCH_CODE 5 | ||
33 | #define MODULE_LOADED_CODE 6 | ||
34 | #define CTX_TGID_CODE 7 | ||
35 | #define TRACE_BEGIN_CODE 8 | ||
36 | #define TRACE_END_CODE 9 | ||
37 | |||
38 | #define INVALID_COOKIE ~0UL | 23 | #define INVALID_COOKIE ~0UL |
39 | #define NO_COOKIE 0UL | 24 | #define NO_COOKIE 0UL |
40 | 25 | ||
41 | /* add data to the event buffer */ | ||
42 | void add_event_entry(unsigned long data); | ||
43 | |||
44 | extern const struct file_operations event_buffer_fops; | 26 | extern const struct file_operations event_buffer_fops; |
45 | 27 | ||
46 | /* mutex between sync_cpu_buffers() and the | 28 | /* mutex between sync_cpu_buffers() and the |
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index e5162a64018b..2c645170f06e 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c | |||
@@ -53,9 +53,24 @@ int oprofile_setup(void) | |||
53 | * us missing task deaths and eventually oopsing | 53 | * us missing task deaths and eventually oopsing |
54 | * when trying to process the event buffer. | 54 | * when trying to process the event buffer. |
55 | */ | 55 | */ |
56 | if (oprofile_ops.sync_start) { | ||
57 | int sync_ret = oprofile_ops.sync_start(); | ||
58 | switch (sync_ret) { | ||
59 | case 0: | ||
60 | goto post_sync; | ||
61 | case 1: | ||
62 | goto do_generic; | ||
63 | case -1: | ||
64 | goto out3; | ||
65 | default: | ||
66 | goto out3; | ||
67 | } | ||
68 | } | ||
69 | do_generic: | ||
56 | if ((err = sync_start())) | 70 | if ((err = sync_start())) |
57 | goto out3; | 71 | goto out3; |
58 | 72 | ||
73 | post_sync: | ||
59 | is_setup = 1; | 74 | is_setup = 1; |
60 | mutex_unlock(&start_mutex); | 75 | mutex_unlock(&start_mutex); |
61 | return 0; | 76 | return 0; |
@@ -118,7 +133,20 @@ out: | |||
118 | void oprofile_shutdown(void) | 133 | void oprofile_shutdown(void) |
119 | { | 134 | { |
120 | mutex_lock(&start_mutex); | 135 | mutex_lock(&start_mutex); |
136 | if (oprofile_ops.sync_stop) { | ||
137 | int sync_ret = oprofile_ops.sync_stop(); | ||
138 | switch (sync_ret) { | ||
139 | case 0: | ||
140 | goto post_sync; | ||
141 | case 1: | ||
142 | goto do_generic; | ||
143 | default: | ||
144 | goto post_sync; | ||
145 | } | ||
146 | } | ||
147 | do_generic: | ||
121 | sync_stop(); | 148 | sync_stop(); |
149 | post_sync: | ||
122 | if (oprofile_ops.shutdown) | 150 | if (oprofile_ops.shutdown) |
123 | oprofile_ops.shutdown(); | 151 | oprofile_ops.shutdown(); |
124 | is_setup = 0; | 152 | is_setup = 0; |