]> git.baikalelectronics.ru Git - kernel.git/commit
libperf cpumap: Take into advantage it is sorted to optimize perf_cpu_map__max()
authorRiccardo Mancini <rickyman7@gmail.com>
Sat, 21 Aug 2021 09:19:08 +0000 (11:19 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 31 Aug 2021 19:17:02 +0000 (16:17 -0300)
commit975ea838fb7e86d7bfe32736149917ad6f347fda
tree565f03db84f57548fb163e5cb0c3c70596299973
parenta36ea4f6c57c0de862db35ee6aa88b1ebb802b93
libperf cpumap: Take into advantage it is sorted to optimize perf_cpu_map__max()

From commit de29df4cbc06a397 ("perf cpumap: Maintain cpumaps ordered and
without dups"), perf_cpu_map elements are sorted in ascending order.

This patch improves the perf_cpu_map__max function by returning the last
element.

Committer notes:

Do it as a ternary to keep it in just one return line, add a comment
explaining it is sorted and what functions does it.

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/fb79f02e7b86ea8044d563adb1e9890c906f982f.1629490974.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/perf/cpumap.c