diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-19 12:48:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-19 12:48:42 -0500 |
commit | eca9dfcd0029c8a84b1094bb84a2fb53e4addf6c (patch) | |
tree | 2e5982fef1e737ce5f8936981c7dc7fb50fc655c /tools/perf/util | |
parent | 3981e152864fcc1dbbb564e1f4c0ae11a09639d2 (diff) | |
parent | b5b60fda1e462a849bc37dfbace2888191be82cc (diff) |
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
perf session: Make events_stats u64 to avoid overflow on 32-bit arches
hw-breakpoints: Fix hardware breakpoints -> perf events dependency
perf events: Dont report side-band events on each cpu for per-task-per-cpu events
perf events, x86/stacktrace: Fix performance/softlockup by providing a special frame pointer-only stack walker
perf events, x86/stacktrace: Make stack walking optional
perf events: Remove unused perf_counter.h header file
perf probe: Check new event name
kprobe-tracer: Check new event/group name
perf probe: Check whether debugfs path is correct
perf probe: Fix libdwarf include path for Debian
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/event.h | 4 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 15 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.h | 59 |
3 files changed, 49 insertions, 29 deletions
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 8027309b0422..690a96d0467c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -95,8 +95,8 @@ typedef union event_union { | |||
95 | } event_t; | 95 | } event_t; |
96 | 96 | ||
97 | struct events_stats { | 97 | struct events_stats { |
98 | unsigned long total; | 98 | u64 total; |
99 | unsigned long lost; | 99 | u64 lost; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | void event__print_totals(void); | 102 | void event__print_totals(void); |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 2ca62154f79b..29465d440043 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -62,6 +62,18 @@ static int e_snprintf(char *str, size_t size, const char *format, ...) | |||
62 | return ret; | 62 | return ret; |
63 | } | 63 | } |
64 | 64 | ||
65 | /* Check the name is good for event/group */ | ||
66 | static bool check_event_name(const char *name) | ||
67 | { | ||
68 | if (!isalpha(*name) && *name != '_') | ||
69 | return false; | ||
70 | while (*++name != '\0') { | ||
71 | if (!isalpha(*name) && !isdigit(*name) && *name != '_') | ||
72 | return false; | ||
73 | } | ||
74 | return true; | ||
75 | } | ||
76 | |||
65 | /* Parse probepoint definition. */ | 77 | /* Parse probepoint definition. */ |
66 | static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) | 78 | static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) |
67 | { | 79 | { |
@@ -82,6 +94,9 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp) | |||
82 | ptr = strchr(arg, ':'); | 94 | ptr = strchr(arg, ':'); |
83 | if (ptr) /* Group name is not supported yet. */ | 95 | if (ptr) /* Group name is not supported yet. */ |
84 | semantic_error("Group name is not supported yet."); | 96 | semantic_error("Group name is not supported yet."); |
97 | if (!check_event_name(arg)) | ||
98 | semantic_error("%s is bad for event name -it must " | ||
99 | "follow C symbol-naming rule.", arg); | ||
85 | pp->event = strdup(arg); | 100 | pp->event = strdup(arg); |
86 | arg = tmp; | 101 | arg = tmp; |
87 | } | 102 | } |
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 5e4050ce2963..a4086aaddb73 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef _PROBE_FINDER_H | 1 | #ifndef _PROBE_FINDER_H |
2 | #define _PROBE_FINDER_H | 2 | #define _PROBE_FINDER_H |
3 | 3 | ||
4 | #define MAX_PATH_LEN 256 | 4 | #define MAX_PATH_LEN 256 |
5 | #define MAX_PROBE_BUFFER 1024 | 5 | #define MAX_PROBE_BUFFER 1024 |
6 | #define MAX_PROBES 128 | 6 | #define MAX_PROBES 128 |
7 | 7 | ||
8 | static inline int is_c_varname(const char *name) | 8 | static inline int is_c_varname(const char *name) |
9 | { | 9 | { |
@@ -12,48 +12,53 @@ static inline int is_c_varname(const char *name) | |||
12 | } | 12 | } |
13 | 13 | ||
14 | struct probe_point { | 14 | struct probe_point { |
15 | char *event; /* Event name */ | 15 | char *event; /* Event name */ |
16 | char *group; /* Event group */ | 16 | char *group; /* Event group */ |
17 | 17 | ||
18 | /* Inputs */ | 18 | /* Inputs */ |
19 | char *file; /* File name */ | 19 | char *file; /* File name */ |
20 | int line; /* Line number */ | 20 | int line; /* Line number */ |
21 | 21 | ||
22 | char *function; /* Function name */ | 22 | char *function; /* Function name */ |
23 | int offset; /* Offset bytes */ | 23 | int offset; /* Offset bytes */ |
24 | 24 | ||
25 | int nr_args; /* Number of arguments */ | 25 | int nr_args; /* Number of arguments */ |
26 | char **args; /* Arguments */ | 26 | char **args; /* Arguments */ |
27 | 27 | ||
28 | int retprobe; /* Return probe */ | 28 | int retprobe; /* Return probe */ |
29 | 29 | ||
30 | /* Output */ | 30 | /* Output */ |
31 | int found; /* Number of found probe points */ | 31 | int found; /* Number of found probe points */ |
32 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ | 32 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | #ifndef NO_LIBDWARF | 35 | #ifndef NO_LIBDWARF |
36 | extern int find_probepoint(int fd, struct probe_point *pp); | 36 | extern int find_probepoint(int fd, struct probe_point *pp); |
37 | 37 | ||
38 | #include <libdwarf/dwarf.h> | 38 | /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */ |
39 | #include <libdwarf/libdwarf.h> | 39 | #ifndef _MIPS_SZLONG |
40 | # define _MIPS_SZLONG 0 | ||
41 | #endif | ||
42 | |||
43 | #include <dwarf.h> | ||
44 | #include <libdwarf.h> | ||
40 | 45 | ||
41 | struct probe_finder { | 46 | struct probe_finder { |
42 | struct probe_point *pp; /* Target probe point */ | 47 | struct probe_point *pp; /* Target probe point */ |
43 | 48 | ||
44 | /* For function searching */ | 49 | /* For function searching */ |
45 | Dwarf_Addr addr; /* Address */ | 50 | Dwarf_Addr addr; /* Address */ |
46 | Dwarf_Unsigned fno; /* File number */ | 51 | Dwarf_Unsigned fno; /* File number */ |
47 | Dwarf_Unsigned lno; /* Line number */ | 52 | Dwarf_Unsigned lno; /* Line number */ |
48 | Dwarf_Off inl_offs; /* Inline offset */ | 53 | Dwarf_Off inl_offs; /* Inline offset */ |
49 | Dwarf_Die cu_die; /* Current CU */ | 54 | Dwarf_Die cu_die; /* Current CU */ |
50 | 55 | ||
51 | /* For variable searching */ | 56 | /* For variable searching */ |
52 | Dwarf_Addr cu_base; /* Current CU base address */ | 57 | Dwarf_Addr cu_base; /* Current CU base address */ |
53 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ | 58 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ |
54 | const char *var; /* Current variable name */ | 59 | const char *var; /* Current variable name */ |
55 | char *buf; /* Current output buffer */ | 60 | char *buf; /* Current output buffer */ |
56 | int len; /* Length of output buffer */ | 61 | int len; /* Length of output buffer */ |
57 | }; | 62 | }; |
58 | #endif /* NO_LIBDWARF */ | 63 | #endif /* NO_LIBDWARF */ |
59 | 64 | ||