diff options
author | Ingo Molnar <mingo@kernel.org> | 2018-12-18 14:39:00 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-12-18 14:39:00 +0100 |
commit | ca46afdb2754dbb4a5d5772332fa16957d9bc618 (patch) | |
tree | 7c57056770c8a1621555b58d2e52625955376cfa /tools/perf/util/ordered-events.c | |
parent | 8162b3d1a728cf63abf54be4167dd9beec5d9d37 (diff) | |
parent | 028713aa8389d960cb1935a9954327bdaa163cf8 (diff) |
Merge tag 'perf-core-for-mingo-4.21-20181217' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
- Introduce 'perf record --aio' to use asynchronous IO trace writing, disabled
by default (Alexey Budankov)
- Add fallback routines to be used in places where we don't have the CPU mode
(kernel/userspace/hypervisor) and thus must first fallback lookups looking
at all map trees when trying to resolve symbols (Adrian Hunter)
- Fix error with config term "pt=0", where we should just force "pt=1" and
warn the user about the former being nonsensical (Adrian Hunter)
- Fix 'perf test' entry where we expect 'sleep' to come in a PERF_RECORD_COMM
but instead we get 'coreutils' when sleep is provided by some versions of
the 'coreutils' package (Adrian Hunter)
- Introduce 'perf top --kallsyms file' to match 'perf report --kallsyms', useful
when dealing with BPF, where symbol resolution happens via kallsyms, not via
the default vmlinux ELF symtabs (Arnaldo Carvalho de Melo)
- Support 'srccode' output field in 'perf script' (Andi Kleen)
- Introduce basic 'perf annotation' support for the ARC architecture (Eugeniy Paltsev)
- Compute and display average IPC and IPC coverage per symbol in 'perf annotate' and
'perf report' (Jin Yao)
- Make 'perf top' use ordered_events and process histograms in a separate thread (Jiri Olsa)
- Make 'perf trace' use ordered_events (Jiri Olsa)
- Add support for ETMv3 and PTMv1.1 decoding in cs-etm (Mathieu Poirier)
- Support for ARM A32/T32 instruction sets in CoreSight trace (cs-etm) (Robert Walker)
- Fix 'perf stat' shadow stats for clock events. (Ravi Bangoria)
- Remove needless rb_tree extra indirection from map__find() (Eric Saint-Etienne)
- Fix CSV mode column output for non-cgroup events in 'perf stat' (Stephane Eranian)
- Add sanity check to libtraceevent's is_timestamp_in_us() (Tzvetomir Stoyanov)
- Use ERR_CAST instead of ERR_PTR(PTR_ERR()) (Wen Yang)
- Fix Load_Miss_Real_Latency on SKL/SKX intel vendor event files (Andi Kleen)
- strncpy() fixes triggered by new warnings on gcc 8.2.0 (Arnaldo Carvalho de Melo)
- Handle tracefs syscall tracepoint older 'nr' field in 'perf trace', that got
renamed to '__syscall_nr' to work in older kernels (Arnaldo Carvalho de Melo)
- Give better hint about devel package for libssl (Arnaldo Carvalho de Melo)
- Fix the 'perf trace' build in architectures lacking explicit mmap.h file (Arnaldo Carvalho de Melo)
- Remove extra rb_tree traversal indirection from map__find() (Eric Saint-Etienne)
- Disable breakpoint tests for 32-bit ARM (Florian Fainelli)
- Fix typos all over the place, mostly in comments, but also in some debug
messages and JSON files (Ingo Molnar)
- Allow specifying proc-map-timeout in config file (Mark Drayton)
- Fix mmap_flags table generation script (Sihyeon Jang)
- Fix 'size' parameter to snprintf in the 'perf config' code (Sihyeon Jang)
- More libtraceevent renames to make it a proper library (Tzvetomir Stoyanov)
- Implement new API tep_get_ref() in libtraceevent (Tzvetomir Stoyanov)
- Added support for pkg-config in libtraceevent (Tzvetomir Stoyanov)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/ordered-events.c')
-rw-r--r-- | tools/perf/util/ordered-events.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c index 1904e7f6ec84..897589507d97 100644 --- a/tools/perf/util/ordered-events.c +++ b/tools/perf/util/ordered-events.c @@ -219,13 +219,12 @@ int ordered_events__queue(struct ordered_events *oe, union perf_event *event, return 0; } -static int __ordered_events__flush(struct ordered_events *oe) +static int do_flush(struct ordered_events *oe, bool show_progress) { struct list_head *head = &oe->events; struct ordered_event *tmp, *iter; u64 limit = oe->next_flush; u64 last_ts = oe->last ? oe->last->timestamp : 0ULL; - bool show_progress = limit == ULLONG_MAX; struct ui_progress prog; int ret; @@ -263,7 +262,8 @@ static int __ordered_events__flush(struct ordered_events *oe) return 0; } -int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) +static int __ordered_events__flush(struct ordered_events *oe, enum oe_flush how, + u64 timestamp) { static const char * const str[] = { "NONE", @@ -272,12 +272,16 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) "HALF ", }; int err; + bool show_progress = false; if (oe->nr_events == 0) return 0; switch (how) { case OE_FLUSH__FINAL: + show_progress = true; + __fallthrough; + case OE_FLUSH__TOP: oe->next_flush = ULLONG_MAX; break; @@ -298,6 +302,11 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) break; } + case OE_FLUSH__TIME: + oe->next_flush = timestamp; + show_progress = false; + break; + case OE_FLUSH__ROUND: case OE_FLUSH__NONE: default: @@ -308,7 +317,7 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) str[how], oe->nr_events); pr_oe_time(oe->max_timestamp, "max_timestamp\n"); - err = __ordered_events__flush(oe); + err = do_flush(oe, show_progress); if (!err) { if (how == OE_FLUSH__ROUND) @@ -324,7 +333,29 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) return err; } -void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver) +int ordered_events__flush(struct ordered_events *oe, enum oe_flush how) +{ + return __ordered_events__flush(oe, how, 0); +} + +int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp) +{ + return __ordered_events__flush(oe, OE_FLUSH__TIME, timestamp); +} + +u64 ordered_events__first_time(struct ordered_events *oe) +{ + struct ordered_event *event; + + if (list_empty(&oe->events)) + return 0; + + event = list_first_entry(&oe->events, struct ordered_event, list); + return event->timestamp; +} + +void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver, + void *data) { INIT_LIST_HEAD(&oe->events); INIT_LIST_HEAD(&oe->cache); @@ -332,6 +363,7 @@ void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t d oe->max_alloc_size = (u64) -1; oe->cur_alloc_size = 0; oe->deliver = deliver; + oe->data = data; } static void @@ -375,5 +407,5 @@ void ordered_events__reinit(struct ordered_events *oe) ordered_events__free(oe); memset(oe, '\0', sizeof(*oe)); - ordered_events__init(oe, old_deliver); + ordered_events__init(oe, old_deliver, oe->data); } |