From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753571AbbFVWgr (ORCPT ); Mon, 22 Jun 2015 18:36:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60575 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753473AbbFVWgi (ORCPT ); Mon, 22 Jun 2015 18:36:38 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Adrian Hunter , Andi Kleen , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra , Stephane Eranian Subject: [PATCHv4 00/27] perf stat: Introduce --per-thread option Date: Tue, 23 Jun 2015 00:36:01 +0200 Message-Id: <1435012588-9007-1-git-send-email-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hi, adding the possibility to display stat data per thread. Allowing following commands and output: $ perf stat -e cycles,instructions --per-thread -p 30190,30242 ^C Performance counter stats for process id '30190,30242': cat-30190 0 cycles yes-30242 3,842,525,421 cycles cat-30190 0 instructions yes-30242 10,370,817,010 instructions 1.143155657 seconds time elapsed Also works under interval mode: $ perf stat -e cycles,instructions --per-thread -p 30190,30242 -I 1000 # time comm-pid counts unit events 1.000073435 cat-30190 89,058 cycles 1.000073435 yes-30242 3,360,786,902 cycles (100.00%) 1.000073435 cat-30190 14,066 instructions 1.000073435 yes-30242 9,069,937,462 instructions 2.000204830 cat-30190 0 cycles 2.000204830 yes-30242 3,351,667,626 cycles 2.000204830 cat-30190 0 instructions 2.000204830 yes-30242 9,045,796,885 instructions ^C 2.771286639 cat-30190 0 cycles 2.771286639 yes-30242 2,593,884,166 cycles 2.771286639 cat-30190 0 instructions 2.771286639 yes-30242 7,001,171,191 instructions Available in here: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git perf/per_thread v4 changes: - add thread_map__set_(pid|comm) interface - several fixes for task comm string reading - added perf_evlist__reset_stats function v3 changes: - some patches already pulled in, rebased on latest acme's perf/core - fixed cpu_map__get/thread_map__get to accept NULL map - renamed propagate_maps to perf_evlist__propagate_maps - renamed --per-task option to --per-thread - changed 'task-pid' header output to 'comm-pid' v2 changes: - renamed xyarray__zero to xyarray__reset - using atomic_t for cpu_map/thread_map refcnt - moving all stat functions into stat object - using init_stats to initialize 'struct stats*' - change TASK-$pid output into $comm-$pid - updated doc with --per-task option thanks, jirka --- Jiri Olsa (27): perf tools: Change thread_map::map into struct perf tools: Add comm string into struct thread_map perf tools: Add reference counting for cpu_map object perf tools: Add reference counting for thread_map object perf tools: Propagate cpu maps through the evlist perf tools: Propagate thread maps through the evlist perf tools: Make perf_evsel__(nr_)cpus generic perf tests: Add thread_map object tests perf stat: Introduce perf_counts function perf stat: Use xyarray for cpu evsel counts perf stat: Make stats work over the thread dimension perf stat: Rename struct perf_counts::cpu member to values perf stat: Introduce perf_evlist__reset_stats perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object perf stat: Move perf_evsel__(alloc|free)_prev_raw_counts into stat object perf stat: Move perf_evlist__(alloc|free|reset)_stats into stat object perf stat: Introduce perf_evsel__alloc_stats function perf stat: Introduce perf_evsel__read function perf stat: Introduce read_counters function perf stat: Separate counters reading and processing perf stat: Move zero_per_pkg into counter process code perf stat: Move perf_stat initialization counter process code perf stat: Remove perf_evsel__read_cb function perf stat: Rename print_interval to process_interval perf stat: Using init_stats instead of memset perf stat: Introduce print_counters function perf stat: Introduce --per-thread option tools/perf/Documentation/perf-stat.txt | 4 + tools/perf/builtin-stat.c | 404 ++++++++++++++-------------- tools/perf/builtin-trace.c | 4 +- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 + tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 2 +- tools/perf/tests/openat-syscall-all-cpus.c | 8 +- tools/perf/tests/openat-syscall-tp-fields.c | 2 +- tools/perf/tests/openat-syscall.c | 6 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/tests.h | 1 + tools/perf/tests/thread-map.c | 28 ++ tools/perf/util/auxtrace.c | 4 +- tools/perf/util/cpumap.c | 26 +- tools/perf/util/cpumap.h | 6 +- tools/perf/util/event.c | 6 +- tools/perf/util/evlist.c | 39 ++- tools/perf/util/evlist.h | 1 - tools/perf/util/evsel.c | 28 +- tools/perf/util/evsel.h | 40 ++- tools/perf/util/parse-events.c | 5 +- tools/perf/util/python-ext-sources | 1 + tools/perf/util/python.c | 4 +- tools/perf/util/record.c | 4 +- tools/perf/util/session.c | 2 +- tools/perf/util/stat.c | 132 ++++++++- tools/perf/util/stat.h | 47 +++- tools/perf/util/svghelper.c | 2 +- tools/perf/util/thread_map.c | 118 ++++++-- tools/perf/util/thread_map.h | 35 ++- 33 files changed, 661 insertions(+), 319 deletions(-) create mode 100644 tools/perf/tests/thread-map.c -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/