License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2011-01-12 06:56:53 +08:00
|
|
|
#ifndef __PERF_EVLIST_H
|
|
|
|
#define __PERF_EVLIST_H 1
|
|
|
|
|
2017-06-16 22:39:15 +08:00
|
|
|
#include <linux/compiler.h>
|
2017-04-17 22:39:06 +08:00
|
|
|
#include <linux/kernel.h>
|
2017-02-21 23:35:01 +08:00
|
|
|
#include <linux/refcount.h>
|
2011-01-12 06:56:53 +08:00
|
|
|
#include <linux/list.h>
|
2014-09-04 05:02:59 +08:00
|
|
|
#include <api/fd/array.h>
|
2019-07-21 19:24:23 +08:00
|
|
|
#include <internal/evlist.h>
|
2019-09-03 16:39:52 +08:00
|
|
|
#include <internal/evsel.h>
|
2019-08-30 22:44:32 +08:00
|
|
|
#include "events_stats.h"
|
2012-08-15 03:42:15 +08:00
|
|
|
#include "evsel.h"
|
2019-09-23 23:20:38 +08:00
|
|
|
#include <pthread.h>
|
2017-04-20 02:49:18 +08:00
|
|
|
#include <signal.h>
|
2011-11-09 18:47:15 +08:00
|
|
|
#include <unistd.h>
|
2011-01-12 06:56:53 +08:00
|
|
|
|
2011-01-12 08:30:02 +08:00
|
|
|
struct pollfd;
|
2011-01-30 20:46:46 +08:00
|
|
|
struct thread_map;
|
2019-07-21 19:23:49 +08:00
|
|
|
struct perf_cpu_map;
|
2013-12-20 01:43:45 +08:00
|
|
|
struct record_opts;
|
2011-01-12 08:30:02 +08:00
|
|
|
|
2019-09-23 23:20:38 +08:00
|
|
|
/*
|
|
|
|
* State machine of bkw_mmap_state:
|
|
|
|
*
|
|
|
|
* .________________(forbid)_____________.
|
|
|
|
* | V
|
|
|
|
* NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
|
|
|
|
* ^ ^ | ^ |
|
|
|
|
* | |__(forbid)____/ |___(forbid)___/|
|
|
|
|
* | |
|
|
|
|
* \_________________(3)_______________/
|
|
|
|
*
|
|
|
|
* NOTREADY : Backward ring buffers are not ready
|
|
|
|
* RUNNING : Backward ring buffers are recording
|
|
|
|
* DATA_PENDING : We are required to collect data from backward ring buffers
|
|
|
|
* EMPTY : We have collected data from backward ring buffers.
|
|
|
|
*
|
|
|
|
* (0): Setup backward ring buffer
|
|
|
|
* (1): Pause ring buffers for reading
|
|
|
|
* (2): Read from ring buffers
|
|
|
|
* (3): Resume ring buffers for recording
|
|
|
|
*/
|
|
|
|
enum bkw_mmap_state {
|
|
|
|
BKW_MMAP_NOTREADY,
|
|
|
|
BKW_MMAP_RUNNING,
|
|
|
|
BKW_MMAP_DATA_PENDING,
|
|
|
|
BKW_MMAP_EMPTY,
|
|
|
|
};
|
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
struct evlist {
|
2019-07-21 19:24:23 +08:00
|
|
|
struct perf_evlist core;
|
2013-01-22 17:09:29 +08:00
|
|
|
int nr_groups;
|
2015-06-18 03:40:26 +08:00
|
|
|
bool enabled;
|
2013-08-27 16:23:09 +08:00
|
|
|
int id_pos;
|
|
|
|
int is_pos;
|
|
|
|
u64 combined_sample_type;
|
2016-07-14 16:34:42 +08:00
|
|
|
enum bkw_mmap_state bkw_mmap_state;
|
2011-11-09 18:47:15 +08:00
|
|
|
struct {
|
|
|
|
int cork_fd;
|
|
|
|
pid_t pid;
|
|
|
|
} workload;
|
2019-07-28 02:30:53 +08:00
|
|
|
struct mmap *mmap;
|
|
|
|
struct mmap *overwrite_mmap;
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *selected;
|
2015-02-15 01:50:11 +08:00
|
|
|
struct events_stats stats;
|
2015-08-28 17:48:05 +08:00
|
|
|
struct perf_env *env;
|
2019-07-21 19:23:52 +08:00
|
|
|
void (*trace_event_sample_raw)(struct evlist *evlist,
|
2019-01-17 21:37:17 +08:00
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample);
|
perf header: Add infrastructure to record first and last sample time
perf report/script/... have a --time option to limit the time range of
output. That's very useful to slice large traces, e.g. when processing
the output of perf script for some analysis.
But right now --time only supports absolute time. Also there is no fast
way to get the start/end times of a given trace except for looking at
it. This makes it hard to e.g. only decode the first half of the trace,
which is useful for parallelization of scripts
Another problem is that perf records are variable size and there is no
synchronization mechanism. So the only way to find the last sample
reliably would be to walk all samples. But we want to avoid that in perf
report/... because it is already quite expensive. That is why storing
the first sample time and last sample time in perf record is better.
This patch creates a new header feature type HEADER_SAMPLE_TIME and
related ops. Save the first sample time and the last sample time to the
feature section in perf file header. That will be done when, for
instance, processing build-ids, where we already have to process all
samples to create the build-id table, take advantage of that to further
amortize that processing by storing HEADER_SAMPLE_TIME to make 'perf
report/script' faster when using --time.
Committer testing:
After this patch is applied the header is written with zeroes, we need
the next patch, for "perf record" to actually write the timestamps:
# perf report -D | grep PERF_RECORD_SAMPLE\(
22501155244406 0x44f0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4001): 25016/25016: 0xffffffffa21be8c5 period: 1 addr: 0
<SNIP>
22501155793625 0x4a30 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4001): 25016/25016: 0xffffffffa21ffd50 period: 2828043 addr: 0
# perf report --header | grep "time of "
# time of first sample : 0.000000
# time of last sample : 0.000000
#
Changelog:
v7: 1. Rebase to latest perf/core branch.
2. Add following clarification in patch description according to
Arnaldo's suggestion.
"That will be done when, for instance, processing build-ids,
where we already have to process all samples to create the
build-id table, take advantage of that to further amortize
that processing by storing HEADER_SAMPLE_TIME to make
'perf report/script' faster when using --time."
v4: Use perf script time style for timestamp printing. Also add with
the printing of sample duration.
v3: Remove the definitions of first_sample_time/last_sample_time from
perf_session. Just define them in perf_evlist
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1512738826-2628-2-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-12-08 21:13:41 +08:00
|
|
|
u64 first_sample_time;
|
|
|
|
u64 last_sample_time;
|
2019-03-12 13:30:50 +08:00
|
|
|
struct {
|
|
|
|
pthread_t th;
|
|
|
|
volatile int done;
|
|
|
|
} thread;
|
2011-01-12 06:56:53 +08:00
|
|
|
};
|
|
|
|
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel_str_handler {
|
perf tools: Save some loops using perf_evlist__id2evsel
Since we already ask for PERF_SAMPLE_ID and use it to quickly find the
associated evsel, add handler func + data to struct perf_evsel to avoid
using chains of if(strcmp(event_name)) and also to avoid all the linear
list searches via trace_event_find.
To demonstrate the technique convert 'perf sched' to it:
# perf sched record sleep 5m
And then:
Performance counter stats for '/tmp/oldperf sched lat':
646.929438 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,901 page-faults # 0.032 M/sec
1,290,144,450 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,606,158,439 instructions # 1.24 insns per cycle
339,088,395 branches # 524.151 M/sec
4,550,735 branch-misses # 1.34% of all branches
0.647524759 seconds time elapsed
Versus:
Performance counter stats for 'perf sched lat':
473.564691 task-clock # 0.999 CPUs utilized
9 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
20,903 page-faults # 0.044 M/sec
944,367,984 cycles # 1.994 GHz
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,442,385,571 instructions # 1.53 insns per cycle
308,383,106 branches # 651.195 M/sec
4,481,784 branch-misses # 1.45% of all branches
0.474215751 seconds time elapsed
[root@emilia ~]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-1kbzpl74lwi6lavpqke2u2p3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-11-29 03:57:40 +08:00
|
|
|
const char *name;
|
|
|
|
void *handler;
|
|
|
|
};
|
|
|
|
|
2019-07-21 19:23:55 +08:00
|
|
|
struct evlist *evlist__new(void);
|
2019-07-21 19:23:52 +08:00
|
|
|
struct evlist *perf_evlist__new_default(void);
|
|
|
|
struct evlist *perf_evlist__new_dummy(void);
|
2019-07-21 19:23:54 +08:00
|
|
|
void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus,
|
|
|
|
struct perf_thread_map *threads);
|
2019-09-02 20:34:52 +08:00
|
|
|
void evlist__exit(struct evlist *evlist);
|
2019-07-21 19:23:56 +08:00
|
|
|
void evlist__delete(struct evlist *evlist);
|
2011-01-12 06:56:53 +08:00
|
|
|
|
2019-07-21 19:23:59 +08:00
|
|
|
void evlist__add(struct evlist *evlist, struct evsel *entry);
|
2019-07-21 19:24:00 +08:00
|
|
|
void evlist__remove(struct evlist *evlist, struct evsel *evsel);
|
2017-07-04 00:10:20 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int __perf_evlist__add_default(struct evlist *evlist, bool precise);
|
2017-07-04 00:10:20 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
static inline int perf_evlist__add_default(struct evlist *evlist)
|
2017-07-04 00:10:20 +08:00
|
|
|
{
|
|
|
|
return __perf_evlist__add_default(evlist, true);
|
|
|
|
}
|
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int __perf_evlist__add_default_attrs(struct evlist *evlist,
|
perf stat: Initialize default events wrt exclude_{guest,host}
When no event is specified the tools use perf_evlist__add_default(), that will
call event_attr_init to initialize the KVM exclusion bits.
When the change was made to the tools so that by default guest samples would be
excluded, the changes were made just to the parsing routines and to
perf_evlist__add_default(), not to perf_evlist__add_attrs, that is used so far
just by perf stat to add multiple events, according to the level of detail
specified.
Recently the tools were changed to reconstruct the event name from all the
details in perf_event_attr, not just from .type and .config, but taking into
account all the feature bits (.exclude_{guest,host,user,kernel,etc},
.precise_ip, etc).
That is when we noticed that the default for perf stat wasn't the one for the
rest of the tools, i.e. the .exclude_guest bit wasn't being set.
I.e. the default, that doesn't call event_attr_init was showing the :HG
modifier:
$ perf stat usleep 1
Performance counter stats for 'usleep 1':
0.942119 task-clock # 0.454 CPUs utilized
1 context-switches # 0.001 M/sec
0 CPU-migrations # 0.000 K/sec
126 page-faults # 0.134 M/sec
693,193 cycles:HG # 0.736 GHz [40.11%]
407,461 stalled-cycles-frontend:HG # 58.78% frontend cycles idle [72.29%]
365,403 stalled-cycles-backend:HG # 52.71% backend cycles idle
465,982 instructions:HG # 0.67 insns per cycle
# 0.87 stalled cycles per insn
89,760 branches:HG # 95.275 M/sec
6,178 branch-misses:HG # 6.88% of all branches
0.002077228 seconds time elapsed
While if one explicitely specifies the same events, which will make the parsing code
to be called and thus event_attr_init is called:
$ perf stat -e task-clock,context-switches,migrations,page-faults,cycles,stalled-cycles-frontend,stalled-cycles-backend,instructions,branches,branch-misses usleep 1
Performance counter stats for 'usleep 1':
1.040349 task-clock # 0.500 CPUs utilized
2 context-switches # 0.002 M/sec
0 CPU-migrations # 0.000 K/sec
127 page-faults # 0.122 M/sec
587,966 cycles # 0.565 GHz [13.18%]
459,167 stalled-cycles-frontend # 78.09% frontend cycles idle
390,249 stalled-cycles-backend # 66.37% backend cycles idle
504,006 instructions # 0.86 insns per cycle
# 0.91 stalled cycles per insn
96,455 branches # 92.714 M/sec
6,522 branch-misses # 6.76% of all branches [96.12%]
0.002078681 seconds time elapsed
Fix it by introducing a perf_evlist__add_default_attrs method that will call
evlist_attr_init in all the perf_event_attr entries before adding the events.
Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-4eysr236r0pgiyum9epwxw7s@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-31 00:53:54 +08:00
|
|
|
struct perf_event_attr *attrs, size_t nr_attrs);
|
2012-10-03 22:50:55 +08:00
|
|
|
|
perf stat: Initialize default events wrt exclude_{guest,host}
When no event is specified the tools use perf_evlist__add_default(), that will
call event_attr_init to initialize the KVM exclusion bits.
When the change was made to the tools so that by default guest samples would be
excluded, the changes were made just to the parsing routines and to
perf_evlist__add_default(), not to perf_evlist__add_attrs, that is used so far
just by perf stat to add multiple events, according to the level of detail
specified.
Recently the tools were changed to reconstruct the event name from all the
details in perf_event_attr, not just from .type and .config, but taking into
account all the feature bits (.exclude_{guest,host,user,kernel,etc},
.precise_ip, etc).
That is when we noticed that the default for perf stat wasn't the one for the
rest of the tools, i.e. the .exclude_guest bit wasn't being set.
I.e. the default, that doesn't call event_attr_init was showing the :HG
modifier:
$ perf stat usleep 1
Performance counter stats for 'usleep 1':
0.942119 task-clock # 0.454 CPUs utilized
1 context-switches # 0.001 M/sec
0 CPU-migrations # 0.000 K/sec
126 page-faults # 0.134 M/sec
693,193 cycles:HG # 0.736 GHz [40.11%]
407,461 stalled-cycles-frontend:HG # 58.78% frontend cycles idle [72.29%]
365,403 stalled-cycles-backend:HG # 52.71% backend cycles idle
465,982 instructions:HG # 0.67 insns per cycle
# 0.87 stalled cycles per insn
89,760 branches:HG # 95.275 M/sec
6,178 branch-misses:HG # 6.88% of all branches
0.002077228 seconds time elapsed
While if one explicitely specifies the same events, which will make the parsing code
to be called and thus event_attr_init is called:
$ perf stat -e task-clock,context-switches,migrations,page-faults,cycles,stalled-cycles-frontend,stalled-cycles-backend,instructions,branches,branch-misses usleep 1
Performance counter stats for 'usleep 1':
1.040349 task-clock # 0.500 CPUs utilized
2 context-switches # 0.002 M/sec
0 CPU-migrations # 0.000 K/sec
127 page-faults # 0.122 M/sec
587,966 cycles # 0.565 GHz [13.18%]
459,167 stalled-cycles-frontend # 78.09% frontend cycles idle
390,249 stalled-cycles-backend # 66.37% backend cycles idle
504,006 instructions # 0.86 insns per cycle
# 0.91 stalled cycles per insn
96,455 branches # 92.714 M/sec
6,522 branch-misses # 6.76% of all branches [96.12%]
0.002078681 seconds time elapsed
Fix it by introducing a perf_evlist__add_default_attrs method that will call
evlist_attr_init in all the perf_event_attr entries before adding the events.
Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-4eysr236r0pgiyum9epwxw7s@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-31 00:53:54 +08:00
|
|
|
#define perf_evlist__add_default_attrs(evlist, array) \
|
|
|
|
__perf_evlist__add_default_attrs(evlist, array, ARRAY_SIZE(array))
|
2011-01-12 06:56:53 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__add_dummy(struct evlist *evlist);
|
2016-01-08 00:14:56 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__add_sb_event(struct evlist **evlist,
|
2019-03-12 13:30:50 +08:00
|
|
|
struct perf_event_attr *attr,
|
|
|
|
perf_evsel__sb_cb_t cb,
|
|
|
|
void *data);
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__start_sb_thread(struct evlist *evlist,
|
2019-03-12 13:30:50 +08:00
|
|
|
struct target *target);
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__stop_sb_thread(struct evlist *evlist);
|
2019-03-12 13:30:50 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__add_newtp(struct evlist *evlist,
|
2012-10-03 22:40:22 +08:00
|
|
|
const char *sys, const char *name, void *handler);
|
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void __perf_evlist__set_sample_bit(struct evlist *evlist,
|
2016-04-12 05:37:45 +08:00
|
|
|
enum perf_event_sample_format bit);
|
2019-07-21 19:23:52 +08:00
|
|
|
void __perf_evlist__reset_sample_bit(struct evlist *evlist,
|
2016-04-12 05:37:45 +08:00
|
|
|
enum perf_event_sample_format bit);
|
|
|
|
|
|
|
|
#define perf_evlist__set_sample_bit(evlist, bit) \
|
|
|
|
__perf_evlist__set_sample_bit(evlist, PERF_SAMPLE_##bit)
|
|
|
|
|
|
|
|
#define perf_evlist__reset_sample_bit(evlist, bit) \
|
|
|
|
__perf_evlist__reset_sample_bit(evlist, PERF_SAMPLE_##bit)
|
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__set_tp_filter(struct evlist *evlist, const char *filter);
|
|
|
|
int perf_evlist__set_tp_filter_pid(struct evlist *evlist, pid_t pid);
|
|
|
|
int perf_evlist__set_tp_filter_pids(struct evlist *evlist, size_t npids, pid_t *pids);
|
2012-09-27 02:07:39 +08:00
|
|
|
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *
|
2019-07-21 19:23:52 +08:00
|
|
|
perf_evlist__find_tracepoint_by_id(struct evlist *evlist, int id);
|
2012-06-28 00:08:42 +08:00
|
|
|
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *
|
2019-07-21 19:23:52 +08:00
|
|
|
perf_evlist__find_tracepoint_by_name(struct evlist *evlist,
|
2013-08-29 12:29:51 +08:00
|
|
|
const char *name);
|
|
|
|
|
2019-08-16 22:00:45 +08:00
|
|
|
int evlist__add_pollfd(struct evlist *evlist, int fd);
|
|
|
|
int evlist__filter_pollfd(struct evlist *evlist, short revents_and_mask);
|
2014-08-13 10:04:11 +08:00
|
|
|
|
2019-09-01 04:48:33 +08:00
|
|
|
int evlist__poll(struct evlist *evlist, int timeout);
|
2014-08-19 04:25:59 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
struct evsel *perf_evlist__id2evsel(struct evlist *evlist, u64 id);
|
|
|
|
struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
|
2015-09-25 21:15:52 +08:00
|
|
|
u64 id);
|
2011-01-13 08:39:13 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
struct perf_sample_id *perf_evlist__id2sid(struct evlist *evlist, u64 id);
|
2012-10-11 20:10:35 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__toggle_bkw_mmap(struct evlist *evlist, enum bkw_mmap_state state);
|
2016-07-14 16:34:42 +08:00
|
|
|
|
2019-07-28 18:45:35 +08:00
|
|
|
void evlist__mmap_consume(struct evlist *evlist, int idx);
|
2013-10-24 15:43:33 +08:00
|
|
|
|
2019-07-21 19:24:06 +08:00
|
|
|
int evlist__open(struct evlist *evlist);
|
2019-07-21 19:24:07 +08:00
|
|
|
void evlist__close(struct evlist *evlist);
|
2011-10-25 20:42:19 +08:00
|
|
|
|
2016-04-12 05:15:29 +08:00
|
|
|
struct callchain_param;
|
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__set_id_pos(struct evlist *evlist);
|
2013-08-27 16:23:09 +08:00
|
|
|
bool perf_can_sample_identifier(void);
|
2015-07-21 17:44:04 +08:00
|
|
|
bool perf_can_record_switch_events(void);
|
2015-08-13 17:40:56 +08:00
|
|
|
bool perf_can_record_cpu_wide(void);
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__config(struct evlist *evlist, struct record_opts *opts,
|
2016-04-12 05:15:29 +08:00
|
|
|
struct callchain_param *callchain);
|
2013-12-20 01:43:45 +08:00
|
|
|
int record_opts__config(struct record_opts *opts);
|
2011-11-09 00:41:57 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__prepare_workload(struct evlist *evlist,
|
2013-11-13 03:46:16 +08:00
|
|
|
struct target *target,
|
2013-03-11 15:43:17 +08:00
|
|
|
const char *argv[], bool pipe_output,
|
2014-01-04 01:56:49 +08:00
|
|
|
void (*exec_error)(int signo, siginfo_t *info,
|
|
|
|
void *ucontext));
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__start_workload(struct evlist *evlist);
|
2011-11-09 18:47:15 +08:00
|
|
|
|
2014-10-17 23:16:00 +08:00
|
|
|
struct option;
|
|
|
|
|
2015-04-09 23:53:46 +08:00
|
|
|
int __perf_evlist__parse_mmap_pages(unsigned int *mmap_pages, const char *str);
|
2013-09-01 18:36:12 +08:00
|
|
|
int perf_evlist__parse_mmap_pages(const struct option *opt,
|
|
|
|
const char *str,
|
|
|
|
int unset);
|
|
|
|
|
2016-04-16 04:46:31 +08:00
|
|
|
unsigned long perf_event_mlock_kb_in_pages(void);
|
|
|
|
|
2019-07-28 18:45:35 +08:00
|
|
|
int evlist__mmap_ex(struct evlist *evlist, unsigned int pages,
|
2017-12-03 10:00:38 +08:00
|
|
|
unsigned int auxtrace_pages,
|
perf record: Implement --mmap-flush=<number> option
Implement a --mmap-flush option that specifies minimal number of bytes
that is extracted from mmaped kernel buffer to store into a trace. The
default option value is 1 byte what means every time trace writing
thread finds some new data in the mmaped buffer the data is extracted,
possibly compressed and written to a trace.
$ tools/perf/perf record --mmap-flush 1024 -e cycles -- matrix.gcc
$ tools/perf/perf record --aio --mmap-flush 1K -e cycles -- matrix.gcc
The option is independent from -z setting, doesn't vary with compression
level and can serve two purposes.
The first purpose is to increase the compression ratio of a trace data.
Larger data chunks are compressed more effectively so the implemented
option allows specifying data chunk size to compress. Also at some cases
executing more write syscalls with smaller data size can take longer
than executing less write syscalls with bigger data size due to syscall
overhead so extracting bigger data chunks specified by the option value
could additionally decrease runtime overhead.
The second purpose is to avoid self monitoring live-lock issue in system
wide (-a) profiling mode. Profiling in system wide mode with compression
(-a -z) can additionally induce data into the kernel buffers along with
the data from monitored processes. If performance data rate and volume
from the monitored processes is high then trace streaming and
compression activity in the tool is also high. High tool process
activity can lead to subtle live-lock effect when compression of single
new byte from some of mmaped kernel buffer leads to generation of the
next single byte at some mmaped buffer. So perf tool process ends up in
endless self monitoring.
Implemented synch parameter is the mean to force data move independently
from the specified flush threshold value. Despite the provided flush
value the tool needs capability to unconditionally drain memory buffers,
at least in the end of the collection.
Committer testing:
Running with the default value, i.e. as soon as there is something to
read go on consuming, we first write the synthesized events, small
chunks of about 128 bytes:
# perf trace -m 2048 --call-graph dwarf -e write -- perf record
<SNIP>
101.142 ( 0.004 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x210db60, count: 120) = 120
__libc_write (/usr/lib64/libpthread-2.28.so)
ion (/home/acme/bin/perf)
record__write (inlined)
process_synthesized_event (/home/acme/bin/perf)
perf_tool__process_synth_event (inlined)
perf_event__synthesize_mmap_events (/home/acme/bin/perf)
Then we move to reading the mmap buffers consuming the events put there
by the kernel perf infrastructure:
107.561 ( 0.005 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befc02000, count: 336) = 336
__libc_write (/usr/lib64/libpthread-2.28.so)
ion (/home/acme/bin/perf)
record__write (inlined)
record__pushfn (/home/acme/bin/perf)
perf_mmap__push (/home/acme/bin/perf)
record__mmap_read_evlist (inlined)
record__mmap_read_all (inlined)
__cmd_record (inlined)
cmd_record (/home/acme/bin/perf)
12919.953 ( 0.136 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befc83150, count: 184984) = 184984
<SNIP same backtrace as in the 107.561 timestamp>
12920.094 ( 0.155 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befc02150, count: 261816) = 261816
<SNIP same backtrace as in the 107.561 timestamp>
12920.253 ( 0.093 ms): perf/25821 write(fd: 3</root/perf.data>, buf: 0x7f1befb81120, count: 170832) = 170832
<SNIP same backtrace as in the 107.561 timestamp>
If we limit it to write only when more than 16MB are available for
reading, it throttles that to a quarter of the --mmap-pages set for
'perf record', which by default get to 528384 bytes, found out using
'record -v':
mmap flush: 132096
mmap size 528384B
With that in place all the writes coming from
record__mmap_read_evlist(), i.e. from the mmap buffers setup by the
kernel perf infrastructure were at least 132096 bytes long.
Trying with a bigger mmap size:
perf trace -e write perf record -v -m 2048 --mmap-flush 16M
74982.928 ( 2.471 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff94a6cc000, count: 3580888) = 3580888
74985.406 ( 2.353 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff949ecb000, count: 3453256) = 3453256
74987.764 ( 2.629 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff9496ca000, count: 3859232) = 3859232
74990.399 ( 2.341 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff948ec9000, count: 3769032) = 3769032
74992.744 ( 2.064 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff9486c8000, count: 3310520) = 3310520
74994.814 ( 2.619 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff947ec7000, count: 4194688) = 4194688
74997.439 ( 2.787 ms): perf/26500 write(fd: 3</root/perf.data>, buf: 0x7ff9476c6000, count: 4029760) = 4029760
Was again limited to a quarter of the mmap size:
mmap flush: 2098176
mmap size 8392704B
A warning about that would be good to have but can be added later,
something like:
"max flush is a quarter of the mmap size, if wanting to bump the mmap
flush further, bump the mmap size as well using -m/--mmap-pages"
Also rename the 'sync' parameters to 'synch' to keep tools/perf building
with older glibcs:
cc1: warnings being treated as errors
builtin-record.c: In function 'record__mmap_read_evlist':
builtin-record.c:775: warning: declaration of 'sync' shadows a global declaration
/usr/include/unistd.h:933: warning: shadowed declaration is here
builtin-record.c: In function 'record__mmap_read_all':
builtin-record.c:856: warning: declaration of 'sync' shadows a global declaration
/usr/include/unistd.h:933: warning: shadowed declaration is here
Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/f6600d72-ecfa-2eb7-7e51-f6954547d500@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-03-19 01:40:26 +08:00
|
|
|
bool auxtrace_overwrite, int nr_cblocks,
|
2019-03-19 01:42:19 +08:00
|
|
|
int affinity, int flush, int comp_level);
|
2019-07-28 18:45:35 +08:00
|
|
|
int evlist__mmap(struct evlist *evlist, unsigned int pages);
|
2019-08-16 22:19:55 +08:00
|
|
|
void evlist__munmap(struct evlist *evlist);
|
2011-01-30 21:59:43 +08:00
|
|
|
|
2019-07-28 18:45:35 +08:00
|
|
|
size_t evlist__mmap_size(unsigned long pages);
|
2017-01-09 17:51:59 +08:00
|
|
|
|
2019-07-21 19:24:09 +08:00
|
|
|
void evlist__disable(struct evlist *evlist);
|
2019-07-21 19:24:08 +08:00
|
|
|
void evlist__enable(struct evlist *evlist);
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__toggle_enable(struct evlist *evlist);
|
2011-07-25 22:06:19 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__enable_event_idx(struct evlist *evlist,
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *evsel, int idx);
|
2013-09-01 02:50:53 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__set_selected(struct evlist *evlist,
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *evsel);
|
2011-10-06 06:11:32 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__create_maps(struct evlist *evlist, struct target *target);
|
|
|
|
int perf_evlist__apply_filters(struct evlist *evlist, struct evsel **err_evsel);
|
2011-01-30 20:46:46 +08:00
|
|
|
|
2012-08-15 03:35:48 +08:00
|
|
|
void __perf_evlist__set_leader(struct list_head *list);
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__set_leader(struct evlist *evlist);
|
2012-08-15 03:35:48 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
u64 __perf_evlist__combined_sample_type(struct evlist *evlist);
|
|
|
|
u64 perf_evlist__combined_sample_type(struct evlist *evlist);
|
|
|
|
u64 perf_evlist__combined_branch_type(struct evlist *evlist);
|
|
|
|
bool perf_evlist__sample_id_all(struct evlist *evlist);
|
|
|
|
u16 perf_evlist__id_hdr_size(struct evlist *evlist);
|
2011-05-21 23:49:00 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__parse_sample(struct evlist *evlist, union perf_event *event,
|
2012-09-26 23:48:18 +08:00
|
|
|
struct perf_sample *sample);
|
2012-08-02 22:42:57 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__parse_sample_timestamp(struct evlist *evlist,
|
2017-08-03 19:10:28 +08:00
|
|
|
union perf_event *event,
|
|
|
|
u64 *timestamp);
|
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
bool perf_evlist__valid_sample_type(struct evlist *evlist);
|
|
|
|
bool perf_evlist__valid_sample_id_all(struct evlist *evlist);
|
|
|
|
bool perf_evlist__valid_read_format(struct evlist *evlist);
|
2012-01-27 22:34:20 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__splice_list_tail(struct evlist *evlist,
|
2015-09-08 15:58:53 +08:00
|
|
|
struct list_head *list);
|
2012-08-15 03:42:15 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
static inline bool perf_evlist__empty(struct evlist *evlist)
|
2017-07-21 13:11:57 +08:00
|
|
|
{
|
2019-07-21 19:24:23 +08:00
|
|
|
return list_empty(&evlist->core.entries);
|
2017-07-21 13:11:57 +08:00
|
|
|
}
|
|
|
|
|
2019-09-03 16:39:52 +08:00
|
|
|
static inline struct evsel *evlist__first(struct evlist *evlist)
|
2012-08-15 03:42:15 +08:00
|
|
|
{
|
2019-09-03 16:39:52 +08:00
|
|
|
struct perf_evsel *evsel = perf_evlist__first(&evlist->core);
|
|
|
|
|
|
|
|
return container_of(evsel, struct evsel, core);
|
2012-08-15 03:42:15 +08:00
|
|
|
}
|
|
|
|
|
2019-09-03 16:39:52 +08:00
|
|
|
static inline struct evsel *evlist__last(struct evlist *evlist)
|
2012-08-15 03:42:15 +08:00
|
|
|
{
|
2019-09-03 16:39:52 +08:00
|
|
|
struct perf_evsel *evsel = perf_evlist__last(&evlist->core);
|
|
|
|
|
|
|
|
return container_of(evsel, struct evsel, core);
|
2012-08-15 03:42:15 +08:00
|
|
|
}
|
2012-09-07 01:54:11 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
int perf_evlist__strerror_open(struct evlist *evlist, int err, char *buf, size_t size);
|
|
|
|
int perf_evlist__strerror_mmap(struct evlist *evlist, int err, char *buf, size_t size);
|
2013-10-17 23:07:58 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
bool perf_evlist__can_select_event(struct evlist *evlist, const char *str);
|
|
|
|
void perf_evlist__to_front(struct evlist *evlist,
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *move_evsel);
|
2013-12-11 20:36:35 +08:00
|
|
|
|
2014-01-10 21:37:27 +08:00
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* __evlist__for_each_entry - iterate thru all the evsels
|
2014-01-10 21:37:27 +08:00
|
|
|
* @list: list_head instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define __evlist__for_each_entry(list, evsel) \
|
2019-07-21 19:24:22 +08:00
|
|
|
list_for_each_entry(evsel, list, core.node)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* evlist__for_each_entry - iterate thru all the evsels
|
2014-01-10 21:37:27 +08:00
|
|
|
* @evlist: evlist instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define evlist__for_each_entry(evlist, evsel) \
|
2019-07-21 19:24:23 +08:00
|
|
|
__evlist__for_each_entry(&(evlist)->core.entries, evsel)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* __evlist__for_each_entry_continue - continue iteration thru all the evsels
|
2014-01-10 21:37:27 +08:00
|
|
|
* @list: list_head instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define __evlist__for_each_entry_continue(list, evsel) \
|
2019-07-21 19:24:22 +08:00
|
|
|
list_for_each_entry_continue(evsel, list, core.node)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* evlist__for_each_entry_continue - continue iteration thru all the evsels
|
2014-01-10 21:37:27 +08:00
|
|
|
* @evlist: evlist instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define evlist__for_each_entry_continue(evlist, evsel) \
|
2019-07-21 19:24:23 +08:00
|
|
|
__evlist__for_each_entry_continue(&(evlist)->core.entries, evsel)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* __evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
|
2014-01-10 21:37:27 +08:00
|
|
|
* @list: list_head instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define __evlist__for_each_entry_reverse(list, evsel) \
|
2019-07-21 19:24:22 +08:00
|
|
|
list_for_each_entry_reverse(evsel, list, core.node)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order
|
2014-01-10 21:37:27 +08:00
|
|
|
* @evlist: evlist instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define evlist__for_each_entry_reverse(evlist, evsel) \
|
2019-07-21 19:24:23 +08:00
|
|
|
__evlist__for_each_entry_reverse(&(evlist)->core.entries, evsel)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* __evlist__for_each_entry_safe - safely iterate thru all the evsels
|
2014-01-10 21:37:27 +08:00
|
|
|
* @list: list_head instance to iterate
|
|
|
|
* @tmp: struct evsel temp iterator
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define __evlist__for_each_entry_safe(list, tmp, evsel) \
|
2019-07-21 19:24:22 +08:00
|
|
|
list_for_each_entry_safe(evsel, tmp, list, core.node)
|
2014-01-10 21:37:27 +08:00
|
|
|
|
|
|
|
/**
|
2016-06-23 22:26:15 +08:00
|
|
|
* evlist__for_each_entry_safe - safely iterate thru all the evsels
|
2014-01-10 21:37:27 +08:00
|
|
|
* @evlist: evlist instance to iterate
|
|
|
|
* @evsel: struct evsel iterator
|
|
|
|
* @tmp: struct evsel temp iterator
|
|
|
|
*/
|
2016-06-23 22:26:15 +08:00
|
|
|
#define evlist__for_each_entry_safe(evlist, tmp, evsel) \
|
2019-07-21 19:24:23 +08:00
|
|
|
__evlist__for_each_entry_safe(&(evlist)->core.entries, tmp, evsel)
|
2013-12-11 20:36:29 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__set_tracking_event(struct evlist *evlist,
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *tracking_evsel);
|
2015-10-06 02:06:04 +08:00
|
|
|
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *
|
2019-07-21 19:23:52 +08:00
|
|
|
perf_evlist__find_evsel_by_str(struct evlist *evlist, const char *str);
|
2016-07-10 19:07:53 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
struct evsel *perf_evlist__event2evsel(struct evlist *evlist,
|
2016-07-10 19:07:53 +08:00
|
|
|
union perf_event *event);
|
2017-11-14 22:01:06 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
bool perf_evlist__exclude_kernel(struct evlist *evlist);
|
2018-05-21 22:57:44 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
void perf_evlist__force_leader(struct evlist *evlist);
|
2018-05-21 22:57:44 +08:00
|
|
|
|
2019-07-21 19:23:52 +08:00
|
|
|
struct evsel *perf_evlist__reset_weak_group(struct evlist *evlist,
|
2019-07-21 19:23:51 +08:00
|
|
|
struct evsel *evsel);
|
2011-01-12 06:56:53 +08:00
|
|
|
#endif /* __PERF_EVLIST_H */
|