Skip to content

Commit

Permalink
perf evsel: Rename CPU around get_group_fd
Browse files Browse the repository at this point in the history
CPU is really a cpu map index, change names to make code more intention
revealing.

Signed-off-by: Ian Rogers <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: John Garry <[email protected]>
Cc: Kajol Jain <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Mathieu Poirier <[email protected]>
Cc: Mike Leach <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Clarke <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Riccardo Mancini <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Suzuki Poulouse <[email protected]>
Cc: Vineet Singh <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
captain5050 authored and acmel committed Jan 12, 2022
1 parent da8c94c commit 2daa08c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,27 +1591,27 @@ int __evsel__read_on_cpu(struct evsel *evsel, int cpu_map_idx, int thread, bool
}

static int evsel__match_other_cpu(struct evsel *evsel, struct evsel *other,
int cpu)
int cpu_map_idx)
{
int cpuid;
int cpu;

cpuid = perf_cpu_map__cpu(evsel->core.cpus, cpu);
return perf_cpu_map__idx(other->core.cpus, cpuid);
cpu = perf_cpu_map__cpu(evsel->core.cpus, cpu_map_idx);
return perf_cpu_map__idx(other->core.cpus, cpu);
}

static int evsel__hybrid_group_cpu(struct evsel *evsel, int cpu)
static int evsel__hybrid_group_cpu_map_idx(struct evsel *evsel, int cpu_map_idx)
{
struct evsel *leader = evsel__leader(evsel);

if ((evsel__is_hybrid(evsel) && !evsel__is_hybrid(leader)) ||
(!evsel__is_hybrid(evsel) && evsel__is_hybrid(leader))) {
return evsel__match_other_cpu(evsel, leader, cpu);
return evsel__match_other_cpu(evsel, leader, cpu_map_idx);
}

return cpu;
return cpu_map_idx;
}

static int get_group_fd(struct evsel *evsel, int cpu, int thread)
static int get_group_fd(struct evsel *evsel, int cpu_map_idx, int thread)
{
struct evsel *leader = evsel__leader(evsel);
int fd;
Expand All @@ -1625,11 +1625,11 @@ static int get_group_fd(struct evsel *evsel, int cpu, int thread)
*/
BUG_ON(!leader->core.fd);

cpu = evsel__hybrid_group_cpu(evsel, cpu);
if (cpu == -1)
cpu_map_idx = evsel__hybrid_group_cpu_map_idx(evsel, cpu_map_idx);
if (cpu_map_idx == -1)
return -1;

fd = FD(leader, cpu, thread);
fd = FD(leader, cpu_map_idx, thread);
BUG_ON(fd == -1);

return fd;
Expand Down

0 comments on commit 2daa08c

Please sign in to comment.