Messages in this thread | | | From | Jiri Olsa <> | Date | Sun, 31 Jul 2022 14:39:36 +0200 | Subject | Re: [PATCH v2 6/6] perf cpumap: Add range data encoding |
| |
On Tue, Jun 14, 2022 at 07:33:53AM -0700, Ian Rogers wrote:
SNIP
> + event = cpu_map_data__alloc(&syn_data, sizeof(struct perf_event_header)); > if (!event) > return NULL; > > + syn_data.data = &event->data; > event->header.type = PERF_RECORD_CPU_MAP; > - event->header.size = size; > - event->data.type = type; > - > - cpu_map_data__synthesize(&event->data, map, type, max); > + event->header.size = syn_data.size; > + cpu_map_data__synthesize(&syn_data); > return event; > } > > + > int perf_event__synthesize_cpu_map(struct perf_tool *tool, > const struct perf_cpu_map *map, > perf_event__handler_t process, > @@ -1891,24 +1894,20 @@ int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evse > int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, > perf_event__handler_t process) > { > - size_t size = sizeof(struct perf_event_header) + sizeof(u64) + sizeof(u64); > + struct synthesize_cpu_map_data syn_data = { .map = evsel->core.own_cpus }; > struct perf_record_event_update *ev; > - int max, err; > - u16 type; > - > - if (!evsel->core.own_cpus) > - return 0;
all seems fine, just looks like we no longer do this check, might not be needed anymore, as that changed in past
thanks, jirka
> + int err; > > - ev = cpu_map_data__alloc(evsel->core.own_cpus, &size, &type, &max); > + ev = cpu_map_data__alloc(&syn_data, sizeof(struct perf_event_header) + 2 * sizeof(u64)); > if (!ev) > return -ENOMEM; > > + syn_data.data = &ev->cpus.cpus; > ev->header.type = PERF_RECORD_EVENT_UPDATE; > - ev->header.size = (u16)size; > + ev->header.size = (u16)syn_data.size; > ev->type = PERF_EVENT_UPDATE__CPUS; > ev->id = evsel->core.id[0]; > - > - cpu_map_data__synthesize(&ev->cpus.cpus, evsel->core.own_cpus, type, max); > + cpu_map_data__synthesize(&syn_data); > > err = process(tool, (union perf_event *)ev, NULL, NULL); > free(ev); > -- > 2.36.1.476.g0c4daa206d-goog >
| |