diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-14 20:13:19 +0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-14 20:13:19 +0400 |
| commit | f2e5d078f7f02d4289db31f5f63e23e39914075e (patch) | |
| tree | c739a3e70846284ae2ce3d98cecc2be1ffebe2e2 /tools/perf/tests/util.c | |
| parent | c66a566afbe6e2c94b1ae70f70cc1e3d4c73639b (diff) | |
| parent | 836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff) | |
| download | linux-f2e5d078f7f02d4289db31f5f63e23e39914075e.tar.xz | |
Merge tag 'v3.8-rc7' into regulator-core
Linux 3.8-rc7
Diffstat (limited to 'tools/perf/tests/util.c')
| -rw-r--r-- | tools/perf/tests/util.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/perf/tests/util.c b/tools/perf/tests/util.c new file mode 100644 index 000000000000..748f2e8f6961 --- /dev/null +++ b/tools/perf/tests/util.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include "tests.h" +#include "debugfs.h" + +int trace_event__id(const char *evname) +{ + char *filename; + int err = -1, fd; + + if (asprintf(&filename, + "%s/syscalls/%s/id", + tracing_events_path, evname) < 0) + return -1; + + fd = open(filename, O_RDONLY); + if (fd >= 0) { + char id[16]; + if (read(fd, id, sizeof(id)) > 0) + err = atoi(id); + close(fd); + } + + free(filename); + return err; +} |
