Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349926
b: refs/heads/master
c: 82ce75d
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Jan 24, 2013
1 parent fe7d171 commit 7ddccf3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f35488f97b4b49cb76d87bb7e8da9e93fc70b4e9
refs/heads/master: 82ce75d93335f7079afc17fb7f2a4e549d2fbecb
62 changes: 62 additions & 0 deletions trunk/tools/perf/tests/parse-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "evsel.h"
#include "evlist.h"
#include "sysfs.h"
#include "debugfs.h"
#include "tests.h"
#include <linux/hw_breakpoint.h>

Expand Down Expand Up @@ -782,6 +783,63 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
return 0;
}

static int count_tracepoints(void)
{
char events_path[PATH_MAX];
struct dirent *events_ent;
DIR *events_dir;
int cnt = 0;

scnprintf(events_path, PATH_MAX, "%s/tracing/events",
debugfs_find_mountpoint());

events_dir = opendir(events_path);

TEST_ASSERT_VAL("Can't open events dir", events_dir);

while ((events_ent = readdir(events_dir))) {
char sys_path[PATH_MAX];
struct dirent *sys_ent;
DIR *sys_dir;

if (!strcmp(events_ent->d_name, ".")
|| !strcmp(events_ent->d_name, "..")
|| !strcmp(events_ent->d_name, "enable")
|| !strcmp(events_ent->d_name, "header_event")
|| !strcmp(events_ent->d_name, "header_page"))
continue;

scnprintf(sys_path, PATH_MAX, "%s/%s",
events_path, events_ent->d_name);

sys_dir = opendir(sys_path);
TEST_ASSERT_VAL("Can't open sys dir", sys_dir);

while ((sys_ent = readdir(sys_dir))) {
if (!strcmp(sys_ent->d_name, ".")
|| !strcmp(sys_ent->d_name, "..")
|| !strcmp(sys_ent->d_name, "enable")
|| !strcmp(sys_ent->d_name, "filter"))
continue;

cnt++;
}

closedir(sys_dir);
}

closedir(events_dir);
return cnt;
}

static int test__all_tracepoints(struct perf_evlist *evlist)
{
TEST_ASSERT_VAL("wrong events count",
count_tracepoints() == evlist->nr_entries);

return test__checkevent_tracepoint_multi(evlist);
}

struct test__event_st {
const char *name;
__u32 type;
Expand Down Expand Up @@ -921,6 +979,10 @@ static struct test__event_st test__events[] = {
.name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles",
.check = test__group5,
},
[33] = {
.name = "*:*",
.check = test__all_tracepoints,
},
};

static struct test__event_st test__events_pmu[] = {
Expand Down

0 comments on commit 7ddccf3

Please sign in to comment.