1 #include <linux/compiler.h>
7 static bool has_term(struct stat_config_event *config,
12 for (i = 0; i < config->nr; i++) {
13 if ((config->data[i].tag == tag) &&
14 (config->data[i].val == val))
21 static int process_event(struct perf_tool *tool __maybe_unused,
22 union perf_event *event,
23 struct perf_sample *sample __maybe_unused,
24 struct machine *machine __maybe_unused)
26 struct stat_config_event *config = &event->stat_config;
28 #define HAS(term, val) \
29 has_term(config, PERF_STAT_CONFIG_TERM__##term, val)
31 TEST_ASSERT_VAL("wrong nr", config->nr == PERF_STAT_CONFIG_TERM__MAX);
32 TEST_ASSERT_VAL("wrong aggr_mode", HAS(AGGR_MODE, AGGR_CORE));
33 TEST_ASSERT_VAL("wrong scale", HAS(SCALE, 1));
34 TEST_ASSERT_VAL("wrong interval", HAS(INTERVAL, 1));
41 int test__synthesize_stat_config(int subtest __maybe_unused)
43 struct perf_stat_config stat_config = {
44 .aggr_mode = AGGR_CORE,
49 TEST_ASSERT_VAL("failed to synthesize stat_config",
50 !perf_event__synthesize_stat_config(NULL, &stat_config, process_event, NULL));