.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
---|
2 | 2 | #include <linux/compiler.h> |
---|
| 3 | +#include <perf/cpumap.h> |
---|
| 4 | +#include <string.h> |
---|
| 5 | +#include "cpumap.h" |
---|
3 | 6 | #include "evlist.h" |
---|
4 | 7 | #include "evsel.h" |
---|
| 8 | +#include "header.h" |
---|
5 | 9 | #include "machine.h" |
---|
| 10 | +#include "util/synthetic-events.h" |
---|
| 11 | +#include "tool.h" |
---|
6 | 12 | #include "tests.h" |
---|
7 | 13 | #include "debug.h" |
---|
8 | 14 | |
---|
.. | .. |
---|
11 | 17 | struct perf_sample *sample __maybe_unused, |
---|
12 | 18 | struct machine *machine __maybe_unused) |
---|
13 | 19 | { |
---|
14 | | - struct event_update_event *ev = (struct event_update_event *) event; |
---|
| 20 | + struct perf_record_event_update *ev = (struct perf_record_event_update *)event; |
---|
15 | 21 | |
---|
16 | 22 | TEST_ASSERT_VAL("wrong id", ev->id == 123); |
---|
17 | 23 | TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__UNIT); |
---|
.. | .. |
---|
24 | 30 | struct perf_sample *sample __maybe_unused, |
---|
25 | 31 | struct machine *machine __maybe_unused) |
---|
26 | 32 | { |
---|
27 | | - struct event_update_event *ev = (struct event_update_event *) event; |
---|
28 | | - struct event_update_event_scale *ev_data; |
---|
| 33 | + struct perf_record_event_update *ev = (struct perf_record_event_update *)event; |
---|
| 34 | + struct perf_record_event_update_scale *ev_data; |
---|
29 | 35 | |
---|
30 | | - ev_data = (struct event_update_event_scale *) ev->data; |
---|
| 36 | + ev_data = (struct perf_record_event_update_scale *)ev->data; |
---|
31 | 37 | |
---|
32 | 38 | TEST_ASSERT_VAL("wrong id", ev->id == 123); |
---|
33 | 39 | TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__SCALE); |
---|
.. | .. |
---|
46 | 52 | struct machine *machine __maybe_unused) |
---|
47 | 53 | { |
---|
48 | 54 | struct event_name *tmp = container_of(tool, struct event_name, tool); |
---|
49 | | - struct event_update_event *ev = (struct event_update_event*) event; |
---|
| 55 | + struct perf_record_event_update *ev = (struct perf_record_event_update *)event; |
---|
50 | 56 | |
---|
51 | 57 | TEST_ASSERT_VAL("wrong id", ev->id == 123); |
---|
52 | 58 | TEST_ASSERT_VAL("wrong id", ev->type == PERF_EVENT_UPDATE__NAME); |
---|
.. | .. |
---|
59 | 65 | struct perf_sample *sample __maybe_unused, |
---|
60 | 66 | struct machine *machine __maybe_unused) |
---|
61 | 67 | { |
---|
62 | | - struct event_update_event *ev = (struct event_update_event*) event; |
---|
63 | | - struct event_update_event_cpus *ev_data; |
---|
64 | | - struct cpu_map *map; |
---|
| 68 | + struct perf_record_event_update *ev = (struct perf_record_event_update *)event; |
---|
| 69 | + struct perf_record_event_update_cpus *ev_data; |
---|
| 70 | + struct perf_cpu_map *map; |
---|
65 | 71 | |
---|
66 | | - ev_data = (struct event_update_event_cpus*) ev->data; |
---|
| 72 | + ev_data = (struct perf_record_event_update_cpus *) ev->data; |
---|
67 | 73 | |
---|
68 | 74 | map = cpu_map__new_data(&ev_data->cpus); |
---|
69 | 75 | |
---|
.. | .. |
---|
73 | 79 | TEST_ASSERT_VAL("wrong cpus", map->map[0] == 1); |
---|
74 | 80 | TEST_ASSERT_VAL("wrong cpus", map->map[1] == 2); |
---|
75 | 81 | TEST_ASSERT_VAL("wrong cpus", map->map[2] == 3); |
---|
76 | | - cpu_map__put(map); |
---|
| 82 | + perf_cpu_map__put(map); |
---|
77 | 83 | return 0; |
---|
78 | 84 | } |
---|
79 | 85 | |
---|
80 | 86 | int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused) |
---|
81 | 87 | { |
---|
82 | | - struct perf_evlist *evlist; |
---|
83 | | - struct perf_evsel *evsel; |
---|
| 88 | + struct evlist *evlist; |
---|
| 89 | + struct evsel *evsel; |
---|
84 | 90 | struct event_name tmp; |
---|
85 | 91 | |
---|
86 | 92 | evlist = perf_evlist__new_default(); |
---|
87 | 93 | TEST_ASSERT_VAL("failed to get evlist", evlist); |
---|
88 | 94 | |
---|
89 | | - evsel = perf_evlist__first(evlist); |
---|
| 95 | + evsel = evlist__first(evlist); |
---|
90 | 96 | |
---|
91 | | - TEST_ASSERT_VAL("failed to allos ids", |
---|
92 | | - !perf_evsel__alloc_id(evsel, 1, 1)); |
---|
| 97 | + TEST_ASSERT_VAL("failed to allocate ids", |
---|
| 98 | + !perf_evsel__alloc_id(&evsel->core, 1, 1)); |
---|
93 | 99 | |
---|
94 | | - perf_evlist__id_add(evlist, evsel, 0, 0, 123); |
---|
| 100 | + perf_evlist__id_add(&evlist->core, &evsel->core, 0, 0, 123); |
---|
95 | 101 | |
---|
96 | 102 | evsel->unit = strdup("KRAVA"); |
---|
97 | 103 | |
---|
.. | .. |
---|
103 | 109 | TEST_ASSERT_VAL("failed to synthesize attr update scale", |
---|
104 | 110 | !perf_event__synthesize_event_update_scale(NULL, evsel, process_event_scale)); |
---|
105 | 111 | |
---|
106 | | - tmp.name = perf_evsel__name(evsel); |
---|
| 112 | + tmp.name = evsel__name(evsel); |
---|
107 | 113 | |
---|
108 | 114 | TEST_ASSERT_VAL("failed to synthesize attr update name", |
---|
109 | 115 | !perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name)); |
---|
110 | 116 | |
---|
111 | | - evsel->own_cpus = cpu_map__new("1,2,3"); |
---|
| 117 | + evsel->core.own_cpus = perf_cpu_map__new("1,2,3"); |
---|
112 | 118 | |
---|
113 | 119 | TEST_ASSERT_VAL("failed to synthesize attr update cpus", |
---|
114 | 120 | !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); |
---|
115 | 121 | |
---|
116 | | - cpu_map__put(evsel->own_cpus); |
---|
| 122 | + evlist__delete(evlist); |
---|
117 | 123 | return 0; |
---|
118 | 124 | } |
---|