return false;
}
+static int evswitch__fprintf_enoent(FILE *fp, const char *evtype, const char *evname)
+{
+ return fprintf(fp, "ERROR: switch-%s event not found (%s)\n", evtype, evname);
+}
+
int evswitch__init(struct evswitch *evswitch, struct evlist *evlist, FILE *fp)
{
if (evswitch->on_name) {
evswitch->on = perf_evlist__find_evsel_by_str(evlist, evswitch->on_name);
if (evswitch->on == NULL) {
- fprintf(fp, "switch-on event not found (%s)\n", evswitch->on_name);
+ evswitch__fprintf_enoent(fp, "on", evswitch->on_name);
return -ENOENT;
}
evswitch->discarding = true;
if (evswitch->off_name) {
evswitch->off = perf_evlist__find_evsel_by_str(evlist, evswitch->off_name);
if (evswitch->off == NULL) {
- fprintf(fp, "switch-off event not found (%s)\n", evswitch->off_name);
+ evswitch__fprintf_enoent(fp, "off", evswitch->off_name);
return -ENOENT;
}
}