linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] perf cpumap: Refactor perf_cpu_map__merge()
@ 2024-11-07 12:53 Leo Yan
  2024-11-07 12:53 ` [PATCH v2 1/3] libperf " Leo Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Leo Yan @ 2024-11-07 12:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Adrian Hunter, Ian Rogers, Namhyung Kim,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Liang, Kan,
	James Clark, linux-perf-users, linux-kernel
  Cc: Leo Yan

perf_cpu_map__merge() has two arguments, 'orig' and 'other'.  The
function definition might cause confusion as it could give
the impression that the CPU maps in the two arguments are copied into a
new allocated structure, which is then returned as the result.

This patch series refactors perf_cpu_map__merge(), makes that the first
argument 'orig' as a pointer to pointer, the merged result will be
updated into 'orig' rather than returning a pointer.  This can be clear
for the semantics that it merges 'other' into 'orig'.

The perf test has been updated for covering more cases for CPU map
merging.  Tested result is:

  # ./perf test 41
   41: CPU map                            :
   41.1: Synthesize cpu map               : Ok
   41.2: Print cpu map                    : Ok
   41.3: Merge cpu map                    : Ok
   41.4: Intersect cpu map                : Ok
   41.5: Equal cpu map                    : Ok


Leo Yan (3):
  libperf cpumap: Refactor perf_cpu_map__merge()
  perf cpumap: Add more tests for CPU map merging
  perf cpumap: Add checking for reference counter

 tools/lib/perf/cpumap.c              | 49 +++++++++++++------------
 tools/lib/perf/evlist.c              |  2 +-
 tools/lib/perf/include/perf/cpumap.h |  4 +--
 tools/perf/tests/cpumap.c            | 54 ++++++++++++++++++++++------
 tools/perf/util/mem-events.c         |  5 ++-
 5 files changed, 77 insertions(+), 37 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-09 15:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 12:53 [PATCH v2 0/3] perf cpumap: Refactor perf_cpu_map__merge() Leo Yan
2024-11-07 12:53 ` [PATCH v2 1/3] libperf " Leo Yan
2024-11-15  8:38   ` Adrian Hunter
2024-11-07 12:53 ` [PATCH v2 2/3] perf cpumap: Add more tests for CPU map merging Leo Yan
2024-11-15  8:44   ` Adrian Hunter
2024-11-07 12:53 ` [PATCH v2 3/3] perf cpumap: Add checking for reference counter Leo Yan
2024-11-15  8:49   ` Adrian Hunter
2024-12-09 15:02     ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).