[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-edac
Subject: [PATCH 07/10] rasd: map the events buffers on all CPUs
From: Jean Pihet <jean.pihet () linaro ! org>
Date: 2014-09-25 9:55:58
Message-ID: 1411638961-8112-7-git-send-email-jean.pihet () linaro ! org
[Download RAW message or body]
Allows multiple events to be read from all CPUs buffers
Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
---
src/rasd.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/rasd.c b/src/rasd.c
index 537cb65..221945e 100644
--- a/src/rasd.c
+++ b/src/rasd.c
@@ -47,15 +47,16 @@ static int add_tp_event(char *event_str)
struct perf_evsel *tp;
struct rasd_event *r_ev;
char **str = &event_str;
+ static int idx;
int ret;
if (extract_sys_name(str, &rasd.sys, &rasd.name))
err("invalid event specified, syntax is sys:name");
/* Initialize tracepoint evsel */
- tp = perf_evsel__newtp_idx(rasd.sys, rasd.name, 0);
+ tp = perf_evsel__newtp_idx(rasd.sys, rasd.name, idx);
if (!tp)
- err("init tracepoint evsel");
+ err("init tracepoint %d evsel", idx);
/*
* Find the requested event from available events and fill the attr
@@ -70,20 +71,22 @@ static int add_tp_event(char *event_str)
case 0:
/* Add the event to the lists of events */
list_add_tail(&r_ev->node, &rasd.event_entries);
- list_add_tail(&tp->node, &evlist->entries);
+ perf_evlist__add(evlist, tp);
break;
case -ENOMEM:
err("cannot allocate event path");
break;
case -ENODEV:
- err("cannot open trace event id file");
+ err("cannot open tracepoint %d id file", idx);
break;
case -EINVAL:
default:
- err("requested events not found, check the list of supported events");
+ err("requested tracepoint %d not found, check the list of supported events", idx);
break;
}
+ idx++;
+
if (ret) {
free(rasd.name);
free(rasd.sys);
@@ -144,23 +147,29 @@ int main()
evlist = perf_evlist__new();
if (!evlist)
err("allocating evlist");
+ evlist->cpus = cpu_map__new(NULL);
/* Read config file */
if (read_config_file())
err("error reading config file");
+ /* Open events */
evlist__for_each(evlist, c) {
/*
* On all online cpus by default.
*/
- if (perf_evsel__open(c, cpu_map__new(NULL), NULL) < 0)
+ if (perf_evsel__open(c, evlist->cpus, NULL) < 0)
err("opening tracepoint, are you root?");
}
+ /* mmap buffers */
if (perf_evlist__mmap(evlist, 4 /* opts->mmap_pages */, false) < 0)
err("Failed to mmap with %d (%s)\n", errno, strerror(errno));
- /* mmap it and all that, consume it */
+ /* Enable at kernel level */
+ perf_evlist__enable(evlist);
+
+ /* Poll, read, consume etc. */
perf_evlist__delete(evlist);
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic