Ian Rogers
effe957c6b
libperf cpumap: Replace usage of perf_cpu_map__new(NULL) with perf_cpu_map__new_online_cpus()
...
Passing NULL to perf_cpu_map__new() performs
perf_cpu_map__new_online_cpus(), just directly call
perf_cpu_map__new_online_cpus() to be more intention revealing.
Reviewed-by: James Clark <james.clark@arm.com >
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexandre Ghiti <alexghiti@rivosinc.com >
Cc: Andrew Jones <ajones@ventanamicro.com >
Cc: André Almeida <andrealmeid@igalia.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Atish Patra <atishp@rivosinc.com >
Cc: Changbin Du <changbin.du@huawei.com >
Cc: Darren Hart <dvhart@infradead.org >
Cc: Davidlohr Bueso <dave@stgolabs.net >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.g.garry@oracle.com >
Cc: K Prateek Nayak <kprateek.nayak@amd.com >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Paran Lee <p4ranlee@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Sean Christopherson <seanjc@google.com >
Cc: Steinar H. Gunderson <sesse@google.com >
Cc: Suzuki Poulouse <suzuki.poulose@arm.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: Yang Li <yang.lee@linux.alibaba.com >
Cc: Yanteng Si <siyanteng@loongson.cn >
Cc: bpf@vger.kernel.org
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20231129060211.1890454-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-12-12 14:55:13 -03:00
Ian Rogers
923ca62a7b
libperf cpumap: Rename perf_cpu_map__empty() to perf_cpu_map__has_any_cpu_or_is_empty()
...
The name perf_cpu_map_empty is misleading as true is also returned
when the map contains an "any" CPU (aka dummy) map.
Rename to perf_cpu_map__has_any_cpu_or_is_empty(), later changes will
(re)introduce perf_cpu_map__empty() and perf_cpu_map__has_any_cpu().
Reviewed-by: James Clark <james.clark@arm.com >
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexandre Ghiti <alexghiti@rivosinc.com >
Cc: Andrew Jones <ajones@ventanamicro.com >
Cc: André Almeida <andrealmeid@igalia.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Atish Patra <atishp@rivosinc.com >
Cc: Changbin Du <changbin.du@huawei.com >
Cc: Darren Hart <dvhart@infradead.org >
Cc: Davidlohr Bueso <dave@stgolabs.net >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.g.garry@oracle.com >
Cc: K Prateek Nayak <kprateek.nayak@amd.com >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Paran Lee <p4ranlee@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Sean Christopherson <seanjc@google.com >
Cc: Steinar H. Gunderson <sesse@google.com >
Cc: Suzuki Poulouse <suzuki.poulose@arm.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: Yang Li <yang.lee@linux.alibaba.com >
Cc: Yanteng Si <siyanteng@loongson.cn >
Cc: bpf@vger.kernel.org
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20231129060211.1890454-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-12-12 14:55:13 -03:00
Ian Rogers
48219b089d
libperf cpumap: Rename perf_cpu_map__dummy_new() to perf_cpu_map__new_any_cpu()
...
Rename perf_cpu_map__dummy_new() to perf_cpu_map__new_any_cpu() to
better indicate this is creating a CPU map for the perf_event_open "any"
CPU case.
Reviewed-by: James Clark <james.clark@arm.com >
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexandre Ghiti <alexghiti@rivosinc.com >
Cc: Andrew Jones <ajones@ventanamicro.com >
Cc: André Almeida <andrealmeid@igalia.com >
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com >
Cc: Atish Patra <atishp@rivosinc.com >
Cc: Changbin Du <changbin.du@huawei.com >
Cc: Darren Hart <dvhart@infradead.org >
Cc: Davidlohr Bueso <dave@stgolabs.net >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: John Garry <john.g.garry@oracle.com >
Cc: K Prateek Nayak <kprateek.nayak@amd.com >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Nick Desaulniers <ndesaulniers@google.com >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Paran Lee <p4ranlee@gmail.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Ravi Bangoria <ravi.bangoria@amd.com >
Cc: Sandipan Das <sandipan.das@amd.com >
Cc: Sean Christopherson <seanjc@google.com >
Cc: Steinar H. Gunderson <sesse@google.com >
Cc: Suzuki Poulouse <suzuki.poulose@arm.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Will Deacon <will@kernel.org >
Cc: Yang Jihong <yangjihong1@huawei.com >
Cc: Yang Li <yang.lee@linux.alibaba.com >
Cc: Yanteng Si <siyanteng@loongson.cn >
Cc: bpf@vger.kernel.org
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20231129060211.1890454-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2023-12-12 14:01:47 -03:00
Tzvetomir Stoyanov (VMware)
56dce86819
libperf: Add API for allocating new thread map array
...
The existing API perf_thread_map__new_dummy() allocates new thread map
for one thread. I couldn't find a way to reallocate the map with more
threads, or to allocate a new map for more than one thread.
Having multiple threads in a thread map is essential for some use cases.
That's why a new API is proposed, which allocates a new thread map for
given number of threads: perf_thread_map__new_array()
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Link: https://lore.kernel.org/linux-perf-users/20220221102628.43904-1-tz.stoyanov@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-02-23 14:40:23 -03:00
Tzvetomir Stoyanov (VMware)
41415b8a97
libperf: Rename arguments of perf_thread_map APIs
...
The "int thread" input arguments of some perf_thead_map APIs are index
of the thread in the thread map.
In order to avoid confusion and to make the APIs consistent with
perf_cpu_map APIs, those arguments are renamed to "int idx".
Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org >
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Ian Rogers <irogers@google.com >
Link: https://lore.kernel.org/r/20220221102612.43879-1-tz.stoyanov@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-02-23 14:39:29 -03:00
Ian Rogers
91802e73f7
libperf: Sync evsel documentation
...
cpu was renamed cpu_map_idx, for clarity.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James Clark <james.clark@arm.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mathieu Poirier <mathieu.poirier@linaro.org >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Clarke <pc@us.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Riccardo Mancini <rickyman7@gmail.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Suzuki Poulouse <suzuki.poulose@arm.com >
Cc: Vineet Singh <vineet.singh@intel.com >
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: zhengjun.xing@intel.com
Link: https://lore.kernel.org/r/20220105061351.120843-44-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-01-12 14:28:23 -03:00
Ian Rogers
dfc66beff7
perf cpumap: Move 'has' function to libperf
...
Make the cpu map argument const for consistency with the rest of the
API. Modify cpu_map__idx accordingly.
Reviewed-by: James Clark <james.clark@arm.com >
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Kajol Jain <kjain@linux.ibm.com >
Cc: Kan Liang <kan.liang@linux.intel.com >
Cc: Leo Yan <leo.yan@linaro.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Mathieu Poirier <mathieu.poirier@linaro.org >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Clarke <pc@us.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Riccardo Mancini <rickyman7@gmail.com >
Cc: Stephane Eranian <eranian@google.com >
Cc: Suzuki Poulouse <suzuki.poulose@arm.com >
Cc: Vineet Singh <vineet.singh@intel.com >
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: zhengjun.xing@intel.com
Link: https://lore.kernel.org/r/20220105061351.120843-21-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2022-01-12 14:28:22 -03:00
Rob Herring
6cd70754f2
libperf: Add evsel mmap support
...
In order to support usersapce access, an event must be mmapped. While
there's already mmap support for evlist, the usecase is a bit different
than the self monitoring with userspace access. So let's add new
perf_evsel__mmap()/perf_evsel_munmap() functions to mmap/munmap an
evsel. This allows implementing userspace access as a fastpath for
perf_evsel__read().
The mmapped address is returned by perf_evsel__mmap_base() which
primarily for users/tests to check if userspace access is enabled.
Signed-off-by: Rob Herring <robh@kernel.org >
Acked-by: Jiri Olsa <jolsa@redhat.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Itaru Kitayama <itaru.kitayama@gmail.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Will Deacon <will@kernel.org >
Link: http://lore.kernel.org/lkml/20210414155412.3697605-2-robh@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-04-15 16:38:51 -03:00
Rob Herring
ce746d43a1
libperf: Fix man page typos
...
Fix various typos and inconsistent capitalization of CPU in the libperf
man pages.
Signed-off-by: Rob Herring <robh@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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/20200807193241.3904545-1-robh@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-08-13 09:34:26 -03:00
Michael Petlan
76ce02651d
libperf: Add counting example
...
Current libperf man pages mention file counting.c "coming with libperf package",
however, the file is missing. Add the file then.
Fixes: 81de3bf37a ("libperf: Add man pages")
Signed-off-by: Michael Petlan <mpetlan@redhat.com >
Acked-by: Jiri Olsa <jolsa@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
LPU-Reference: 20200227194424.28210-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-03-04 10:34:10 -03:00
Jiri Olsa
81de3bf37a
libperf: Add man pages
...
Change the man page generation to asciidoc, because it's easier to use
and has been more commonly used in related projects. Remove the current
rst pages.
Add 3 man pages to have a base for more additions:
libperf.3 - overall description
libperf-counting.7 - counting basics explained on simple example
libperf-sampling.7 - sampling basics explained on simple example
The plan is to add more man pages to cover the basic API.
The build generates html and man pages:
$ cd tools/lib/perf/Documentation
$ make
ASCIIDOC libperf.xml
XMLTO libperf.3
ASCIIDOC libperf-counting.xml
XMLTO libperf-counting.7
ASCIIDOC libperf-sampling.xml
XMLTO libperf-sampling.7
ASCIIDOC libperf.html
ASCIIDOC libperf-counting.html
ASCIIDOC libperf-sampling.html
Add the following install targets:
install-man - man pages
install-html - html version of man pages
install-examples - examples mentioned in the man pages
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20191206210612.8676-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-01-06 11:46:09 -03:00
Jiri Olsa
3ce311afb5
libperf: Move to tools/lib/perf
...
Move libperf from its current location under tools/perf to a separate
directory under tools/lib/.
Also change various paths (mainly includes) to reflect the libperf move
to a separate directory and add a new directory under MANIFEST.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20191206210612.8676-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-01-06 11:46:09 -03:00