diff options
author | Thomas Renninger <trenn@suse.de> | 2011-01-03 11:50:45 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-01-04 02:16:54 -0500 |
commit | 20c457b8587bee4644d998331d9e13be82e05b4c (patch) | |
tree | e1864952316ad24af3bea22d09753e043eb6ee75 /tools/perf/util/parse-events.c | |
parent | 25e41933b58777f2d020c3b0186b430ea004ec28 (diff) |
perf timechart: Adjust perf timechart to the new power events
builtin-timechart must only pass -e power:xy events if they are supported by
the running kernel, otherwise try to fetch the old power:power{start,end}
events.
For this I added the tiny helper function:
int is_valid_tracepoint(const char *event_string)
to parse-events.[hc], which could be more generic as an interface and support
hardware/software/... events, not only tracepoints, but someone else could
extend that if needed...
Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Jean Pihet <j-pihet@ti.com>
LKML-Reference: <1294073445-14812-4-git-send-email-trenn@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 3a142e90d609..649083f27e08 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -913,6 +913,47 @@ static void print_tracepoint_events(void) | |||
913 | } | 913 | } |
914 | 914 | ||
915 | /* | 915 | /* |
916 | * Check whether event is in <debugfs_mount_point>/tracing/events | ||
917 | */ | ||
918 | |||
919 | int is_valid_tracepoint(const char *event_string) | ||
920 | { | ||
921 | DIR *sys_dir, *evt_dir; | ||
922 | struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent; | ||
923 | char evt_path[MAXPATHLEN]; | ||
924 | char dir_path[MAXPATHLEN]; | ||
925 | |||
926 | if (debugfs_valid_mountpoint(debugfs_path)) | ||
927 | return 0; | ||
928 | |||
929 | sys_dir = opendir(debugfs_path); | ||
930 | if (!sys_dir) | ||
931 | return 0; | ||
932 | |||
933 | for_each_subsystem(sys_dir, sys_dirent, sys_next) { | ||
934 | |||
935 | snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path, | ||
936 | sys_dirent.d_name); | ||
937 | evt_dir = opendir(dir_path); | ||
938 | if (!evt_dir) | ||
939 | continue; | ||
940 | |||
941 | for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) { | ||
942 | snprintf(evt_path, MAXPATHLEN, "%s:%s", | ||
943 | sys_dirent.d_name, evt_dirent.d_name); | ||
944 | if (!strcmp(evt_path, event_string)) { | ||
945 | closedir(evt_dir); | ||
946 | closedir(sys_dir); | ||
947 | return 1; | ||
948 | } | ||
949 | } | ||
950 | closedir(evt_dir); | ||
951 | } | ||
952 | closedir(sys_dir); | ||
953 | return 0; | ||
954 | } | ||
955 | |||
956 | /* | ||
916 | * Print the help text for the event symbols: | 957 | * Print the help text for the event symbols: |
917 | */ | 958 | */ |
918 | void print_events(void) | 959 | void print_events(void) |