struct perf_sample *sample __maybe_unused,
struct event_key *key __maybe_unused)
{
- return !strcmp(evsel->name, kvm_entry_trace);
+ return evsel__name_is(evsel, kvm_entry_trace);
}
static bool event_end(struct evsel *evsel,
struct perf_sample *sample,
struct event_key *key)
{
- if (!strcmp(evsel->name, kvm_exit_trace)) {
+ if (evsel__name_is(evsel, kvm_exit_trace)) {
event_get_key(evsel, sample, key);
return true;
}
struct perf_sample *sample __maybe_unused,
struct event_key *key __maybe_unused)
{
- return (!strcmp(evsel->name, kvm_events_tp[3]));
+ return (evsel__name_is(evsel, kvm_events_tp[3]));
}
static bool hcall_event_begin(struct evsel *evsel,
struct perf_sample *sample, struct event_key *key)
{
- if (!strcmp(evsel->name, kvm_events_tp[2])) {
+ if (evsel__name_is(evsel, kvm_events_tp[2])) {
hcall_event_get_key(evsel, sample, key);
return true;
}
return true;
/* MMIO write begin event in kernel. */
- if (!strcmp(evsel->name, "kvm:kvm_mmio") &&
+ if (evsel__name_is(evsel, "kvm:kvm_mmio") &&
evsel__intval(evsel, sample, "type") == KVM_TRACE_MMIO_WRITE) {
mmio_event_get_key(evsel, sample, key);
return true;
return true;
/* MMIO read end event in kernel.*/
- if (!strcmp(evsel->name, "kvm:kvm_mmio") &&
+ if (evsel__name_is(evsel, "kvm:kvm_mmio") &&
evsel__intval(evsel, sample, "type") == KVM_TRACE_MMIO_READ) {
mmio_event_get_key(evsel, sample, key);
return true;
struct perf_sample *sample,
struct event_key *key)
{
- if (!strcmp(evsel->name, "kvm:kvm_pio")) {
+ if (evsel__name_is(evsel, "kvm:kvm_pio")) {
ioport_event_get_key(evsel, sample, key);
return true;
}
struct perf_sample *sample,
struct event_key *key)
{
- if (!strcmp(evsel->name, "kvm:kvm_msr")) {
+ if (evsel__name_is(evsel, "kvm:kvm_msr")) {
msr_event_get_key(evsel, sample, key);
return true;
}
bool kvm_exit_event(struct evsel *evsel)
{
- return !strcmp(evsel->name, kvm_exit_trace);
+ return evsel__name_is(evsel, kvm_exit_trace);
}
bool exit_event_begin(struct evsel *evsel,
bool kvm_entry_event(struct evsel *evsel)
{
- return !strcmp(evsel->name, kvm_entry_trace);
+ return evsel__name_is(evsel, kvm_entry_trace);
}
bool exit_event_end(struct evsel *evsel,
return false;
for (; child_ops->name; child_ops++) {
- if (!strcmp(evsel->name, child_ops->name)) {
+ if (evsel__name_is(evsel, child_ops->name)) {
child_ops->get_key(evsel, sample, key);
return true;
}
evlist__for_each_entry(evsel_list, counter) {
if (!counter->core.requires_cpu &&
- strcmp(counter->name, "duration_time")) {
+ !evsel__name_is(counter, "duration_time")) {
return;
}
}
i = 0;
evlist__for_each_entry(evlist, evsel) {
- if (strcmp(evsel->name, ev_name[i % nr_events])) {
+ if (!evsel__name_is(evsel, ev_name[i % nr_events])) {
pr_debug("event name doesn't match:\n");
pr_debug(" evsel[%d]: %s\n expected: %s\n",
i, evsel->name, ev_name[i % nr_events]);
{
struct evsel *evsel = evlist__first(evlist);
- TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0);
+ TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "insn"));
return TEST_OK;
}
{
struct evsel *evsel = evlist__first(evlist);
- TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0);
+ TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "rawpmu"));
return TEST_OK;
}
{
struct evsel *evsel = evlist__first(evlist);
- TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0);
+ TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "numpmu"));
return TEST_OK;
}
{
struct evsel *evsel = evlist__first(evlist);
- TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0);
+ TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "cachepmu"));
return TEST_OK;
}
{
struct evsel *evsel = evlist__first(evlist);
- TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0);
+ TEST_ASSERT_VAL("wrong name setting", evsel__name_is(evsel, "intel_pt//u"));
return TEST_OK;
}
{
struct evsel *evsel = evlist__first(evlist);
- TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0);
+ TEST_ASSERT_VAL("wrong complex name parsing", evsel__name_is(evsel, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks"));
return TEST_OK;
}
evlist__for_each_entry(evlist, evsel) {
count = find_value(evsel->name, vals);
evsel->stats->aggr->counts.val = count;
- if (!strcmp(evsel->name, "duration_time"))
+ if (evsel__name_is(evsel, "duration_time"))
update_stats(&walltime_nsecs_stats, count);
}
}
evlist__alloc_aggr_stats(evlist, 1);
evlist__for_each_entry(evlist, evsel) {
evsel->stats->aggr->counts.val = k;
- if (!strcmp(evsel->name, "duration_time"))
+ if (evsel__name_is(evsel, "duration_time"))
update_stats(&walltime_nsecs_stats, k);
k++;
}
return 0;
if (evsel__is_dummy_event(pos))
return 1;
- return strcmp(pos->name, evsel_name);
+ return !evsel__name_is(pos, evsel_name);
}
static int evlist__is_enabled(struct evlist *evlist)
evlist__for_each_entry(evlist, evsel) {
if (!evsel->name)
continue;
- if (strcmp(str, evsel->name) == 0)
+ if (evsel__name_is(evsel, str))
return evsel;
}
return "unknown";
}
+bool evsel__name_is(struct evsel *evsel, const char *name)
+{
+ return !strcmp(evsel__name(evsel), name);
+}
+
const char *evsel__group_pmu_name(const struct evsel *evsel)
{
const struct evsel *leader;
static bool evsel__is_offcpu_event(struct evsel *evsel)
{
- return evsel__is_bpf_output(evsel) && !strcmp(evsel->name, OFFCPU_EVENT);
+ return evsel__is_bpf_output(evsel) && evsel__name_is(evsel, OFFCPU_EVENT);
}
/*
int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf, size_t size);
const char *evsel__name(struct evsel *evsel);
+bool evsel__name_is(struct evsel *evsel, const char *name);
const char *evsel__group_pmu_name(const struct evsel *evsel);
const char *evsel__metric_id(const struct evsel *evsel);
full_name = !!strchr(event_name, ':');
evlist__for_each_entry(evlist, pos) {
/* case 2 */
- if (full_name && !strcmp(pos->name, event_name))
+ if (full_name && evsel__name_is(pos, event_name))
return pos;
/* case 3 */
if (!full_name && strstr(pos->name, event_name)) {