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>
This commit is contained in:
parent
25e41933b5
commit
20c457b858
3 changed files with 118 additions and 18 deletions
|
@ -912,6 +912,47 @@ static void print_tracepoint_events(void)
|
|||
closedir(sys_dir);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether event is in <debugfs_mount_point>/tracing/events
|
||||
*/
|
||||
|
||||
int is_valid_tracepoint(const char *event_string)
|
||||
{
|
||||
DIR *sys_dir, *evt_dir;
|
||||
struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
|
||||
char evt_path[MAXPATHLEN];
|
||||
char dir_path[MAXPATHLEN];
|
||||
|
||||
if (debugfs_valid_mountpoint(debugfs_path))
|
||||
return 0;
|
||||
|
||||
sys_dir = opendir(debugfs_path);
|
||||
if (!sys_dir)
|
||||
return 0;
|
||||
|
||||
for_each_subsystem(sys_dir, sys_dirent, sys_next) {
|
||||
|
||||
snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,
|
||||
sys_dirent.d_name);
|
||||
evt_dir = opendir(dir_path);
|
||||
if (!evt_dir)
|
||||
continue;
|
||||
|
||||
for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
|
||||
snprintf(evt_path, MAXPATHLEN, "%s:%s",
|
||||
sys_dirent.d_name, evt_dirent.d_name);
|
||||
if (!strcmp(evt_path, event_string)) {
|
||||
closedir(evt_dir);
|
||||
closedir(sys_dir);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
closedir(evt_dir);
|
||||
}
|
||||
closedir(sys_dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the help text for the event symbols:
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue