All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: a.p.zijlstra@chello.nl, dsahern@gmail.com, hpa@zytor.com,
	jolsa@kernel.org, linux-kernel@vger.kernel.org,
	namhyung@kernel.org, acme@redhat.com, tglx@linutronix.de,
	mingo@kernel.org
Subject: [tip:perf/core] perf stat: Clear sample_(type|period) for counting
Date: Thu, 26 Nov 2015 23:46:40 -0800	[thread overview]
Message-ID: <tip-6acd8e9271cdeaec458fd4eec4a6765d16e0e61c@git.kernel.org> (raw)
In-Reply-To: <1448465815-27404-1-git-send-email-jolsa@kernel.org>

Commit-ID:  6acd8e9271cdeaec458fd4eec4a6765d16e0e61c
Gitweb:     http://git.kernel.org/tip/6acd8e9271cdeaec458fd4eec4a6765d16e0e61c
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Wed, 25 Nov 2015 16:36:54 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Nov 2015 16:52:28 -0300

perf stat: Clear sample_(type|period) for counting

Clear sample_(type|period) for counting, as it only confuses debug
output with unwanted sampling details:

Before:

  $ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             112
    config                           0x11
    { sample_period, sample_freq }   1
    sample_type                      TIME|CPU|PERIOD|RAW
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
    exclude_guest                    1
  ...

After:
  $ sudo perf stat -e 'raw_syscalls:sys_enter' -vv ls
  ------------------------------------------------------------
  perf_event_attr:
    type                             2
    size                             112
    config                           0x11
    read_format                      TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
    disabled                         1
    inherit                          1
    enable_on_exec                   1
    exclude_guest                    1
  ...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1448465815-27404-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e77880b..df2fbf0 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -161,6 +161,13 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
 
 	attr->inherit = !no_inherit;
 
+	/*
+	 * Some events get initialized with sample_(period/type) set,
+	 * like tracepoints. Clear it up for counting.
+	 */
+	attr->sample_period = 0;
+	attr->sample_type   = 0;
+
 	if (target__has_cpu(&target))
 		return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));
 

      parent reply	other threads:[~2015-11-27  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 15:36 [PATCH 1/2] perf stat: Clear sample_(type|period) for counting Jiri Olsa
2015-11-25 15:36 ` [PATCH 2/2] perf evlist: Display WEIGHT sample type bit Jiri Olsa
2015-11-26 19:54   ` Arnaldo Carvalho de Melo
2015-11-27  7:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-11-27  7:46 ` tip-bot for Jiri Olsa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-6acd8e9271cdeaec458fd4eec4a6765d16e0e61c@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.