Commit 35ae6f09 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf cpumap: Synthetic events and const/static

Make the cpumap arguments const to make it clearer they are in rather
than out arguments. Make two functions static and remove external
declarations.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Colin Ian King <colin.king@intel.com>
Cc: Dave Marchevsky <davemarchevsky@fb.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220614143353.1559597-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e989bc3d
...@@ -463,10 +463,6 @@ size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FIL ...@@ -463,10 +463,6 @@ size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FIL
int kallsyms__get_function_start(const char *kallsyms_filename, int kallsyms__get_function_start(const char *kallsyms_filename,
const char *symbol_name, u64 *addr); const char *symbol_name, u64 *addr);
void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max);
void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf_cpu_map *map,
u16 type, int max);
void event_attr_init(struct perf_event_attr *attr); void event_attr_init(struct perf_event_attr *attr);
int perf_event_paranoid(void); int perf_event_paranoid(void);
......
...@@ -1185,7 +1185,7 @@ int perf_event__synthesize_thread_map2(struct perf_tool *tool, ...@@ -1185,7 +1185,7 @@ int perf_event__synthesize_thread_map2(struct perf_tool *tool,
} }
static void synthesize_cpus(struct cpu_map_entries *cpus, static void synthesize_cpus(struct cpu_map_entries *cpus,
struct perf_cpu_map *map) const struct perf_cpu_map *map)
{ {
int i, map_nr = perf_cpu_map__nr(map); int i, map_nr = perf_cpu_map__nr(map);
...@@ -1196,7 +1196,7 @@ static void synthesize_cpus(struct cpu_map_entries *cpus, ...@@ -1196,7 +1196,7 @@ static void synthesize_cpus(struct cpu_map_entries *cpus,
} }
static void synthesize_mask(struct perf_record_record_cpu_map *mask, static void synthesize_mask(struct perf_record_record_cpu_map *mask,
struct perf_cpu_map *map, int max) const struct perf_cpu_map *map, int max)
{ {
int i; int i;
...@@ -1207,12 +1207,12 @@ static void synthesize_mask(struct perf_record_record_cpu_map *mask, ...@@ -1207,12 +1207,12 @@ static void synthesize_mask(struct perf_record_record_cpu_map *mask,
set_bit(perf_cpu_map__cpu(map, i).cpu, mask->mask); set_bit(perf_cpu_map__cpu(map, i).cpu, mask->mask);
} }
static size_t cpus_size(struct perf_cpu_map *map) static size_t cpus_size(const struct perf_cpu_map *map)
{ {
return sizeof(struct cpu_map_entries) + perf_cpu_map__nr(map) * sizeof(u16); return sizeof(struct cpu_map_entries) + perf_cpu_map__nr(map) * sizeof(u16);
} }
static size_t mask_size(struct perf_cpu_map *map, int *max) static size_t mask_size(const struct perf_cpu_map *map, int *max)
{ {
int i; int i;
...@@ -1229,7 +1229,8 @@ static size_t mask_size(struct perf_cpu_map *map, int *max) ...@@ -1229,7 +1229,8 @@ static size_t mask_size(struct perf_cpu_map *map, int *max)
return sizeof(struct perf_record_record_cpu_map) + BITS_TO_LONGS(*max) * sizeof(long); return sizeof(struct perf_record_record_cpu_map) + BITS_TO_LONGS(*max) * sizeof(long);
} }
void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max) static void *cpu_map_data__alloc(const struct perf_cpu_map *map, size_t *size,
u16 *type, int *max)
{ {
size_t size_cpus, size_mask; size_t size_cpus, size_mask;
bool is_dummy = perf_cpu_map__empty(map); bool is_dummy = perf_cpu_map__empty(map);
...@@ -1263,7 +1264,8 @@ void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int ...@@ -1263,7 +1264,8 @@ void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int
return zalloc(*size); return zalloc(*size);
} }
void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf_cpu_map *map, static void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data,
const struct perf_cpu_map *map,
u16 type, int max) u16 type, int max)
{ {
data->type = type; data->type = type;
...@@ -1279,7 +1281,7 @@ void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf ...@@ -1279,7 +1281,7 @@ void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf
} }
} }
static struct perf_record_cpu_map *cpu_map_event__new(struct perf_cpu_map *map) static struct perf_record_cpu_map *cpu_map_event__new(const struct perf_cpu_map *map)
{ {
size_t size = sizeof(struct perf_record_cpu_map); size_t size = sizeof(struct perf_record_cpu_map);
struct perf_record_cpu_map *event; struct perf_record_cpu_map *event;
...@@ -1299,7 +1301,7 @@ static struct perf_record_cpu_map *cpu_map_event__new(struct perf_cpu_map *map) ...@@ -1299,7 +1301,7 @@ static struct perf_record_cpu_map *cpu_map_event__new(struct perf_cpu_map *map)
} }
int perf_event__synthesize_cpu_map(struct perf_tool *tool, int perf_event__synthesize_cpu_map(struct perf_tool *tool,
struct perf_cpu_map *map, const struct perf_cpu_map *map,
perf_event__handler_t process, perf_event__handler_t process,
struct machine *machine) struct machine *machine)
{ {
......
...@@ -46,7 +46,7 @@ typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *e ...@@ -46,7 +46,7 @@ typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *e
int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process); int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process);
int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process); int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process);
int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine); int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine);
int perf_event__synthesize_cpu_map(struct perf_tool *tool, struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine); int perf_event__synthesize_cpu_map(struct perf_tool *tool, const struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine);
int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment