public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Tom Zanussi <tom.zanussi@linux.intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
	mingo@kernel.org, tglx@linutronix.de,
	tom.zanussi@linux.intel.com
Subject: [tip:perf/core] perf tools: Reinstate 'signed' field flag for tracepoints
Date: Fri, 25 Jan 2013 04:08:15 -0800	[thread overview]
Message-ID: <tip-10ee9fa3b92dece36209a3786d7bd558d459635f@git.kernel.org> (raw)
In-Reply-To: <1471b5968821a455cf5168bb4567964e74ecf530.1358527965.git.tom.zanussi@linux.intel.com>

Commit-ID:  10ee9fa3b92dece36209a3786d7bd558d459635f
Gitweb:     http://git.kernel.org/tip/10ee9fa3b92dece36209a3786d7bd558d459635f
Author:     Tom Zanussi <tom.zanussi@linux.intel.com>
AuthorDate: Fri, 18 Jan 2013 13:51:25 -0600
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 24 Jan 2013 16:40:52 -0300

perf tools: Reinstate 'signed' field flag for tracepoints

For some reason the libtraceevent tracepoint-parsing code is missing
the FIELD_IS_SIGNED flag-setting code, which causes problems for the
Perl trace event binding at least, since it ends up unable to
recognize negative numbers.

Things like checking for negative return values therefore fail, causing
scripts like rwtop to instead interpret the negative return value as a
large positive value, which in turn get added to e.g. read totals with
insanely invalid results.

So set the FIELD_IS_SIGNED flag for tracepoint events that specify
"signed:1".

Before:

  # perf script record rw-by-pid
  # perf script report rw-by-pid

  read counts by pid:

     pid                  comm     # reads  bytes_requested  bytes_read
  ------  --------------------  -----------  ----------  ----------
     753  Xorg                          88      512000  7.74763251095801e+20
    1619  firefox                       42         462  2.58254417031934e+20
    1232  gnome-shell                   11         176  1.10680464442257e+20
    1471  gnome-terminal                 3       16366  18446744073709551615
    1408  libsocialweb-co                2          32  18446744073709551613

After:

  # perf script report rw-by-pid

  read counts by pid:

     pid                  comm     # reads  bytes_requested  bytes_read
  ------  --------------------  -----------  ----------  ----------
     753  Xorg                          88      512000        2764
    1619  firefox                       42         462         126
    1232  gnome-shell                   11         176          40
    1471  gnome-terminal                 3       16366          10
    1408  libsocialweb-co                2          32           8

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lkml.kernel.org/r/1471b5968821a455cf5168bb4567964e74ecf530.1358527965.git.tom.zanussi@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index f504619..bb8b3db 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1462,7 +1462,8 @@ static int event_read_fields(struct event_format *event, struct format_field **f
 			if (read_expect_type(EVENT_ITEM, &token))
 				goto fail;
 
-			/* add signed type */
+			if (strtoul(token, NULL, 0))
+				field->flags |= FIELD_IS_SIGNED;
 
 			free_token(token);
 			if (read_expected(EVENT_OP, ";") < 0)

  reply	other threads:[~2013-01-25 12:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 19:51 [PATCH 0/4] perf tools: some 'perf script' fixes Tom Zanussi
2013-01-18 19:51 ` [PATCH 1/4] perf/tools: reinstate 'signed' field flag for tracepoints Tom Zanussi
2013-01-25 12:08   ` tip-bot for Tom Zanussi [this message]
2013-01-18 19:51 ` [PATCH 2/4] perf script: don't display trace info when invoking scripts Tom Zanussi
2013-01-25 12:09   ` [tip:perf/core] perf script: Don' t " tip-bot for Tom Zanussi
2013-01-18 19:51 ` [PATCH 3/4] perf tools: hook up perf_scripting_context->pevent Tom Zanussi
2013-01-25 12:10   ` [tip:perf/core] perf script: hook up perf_scripting_context-> pevent tip-bot for Tom Zanussi
2013-01-18 19:51 ` [PATCH 4/4] perf script: remove workqueue-stats script Tom Zanussi
2013-01-25 12:11   ` [tip:perf/core] perf script: Remove " tip-bot for Tom Zanussi
2013-01-24 18:27 ` [PATCH 0/4] perf tools: some 'perf script' fixes Arnaldo Carvalho de Melo
2013-01-24 18:44   ` David Ahern
2013-01-24 20:33   ` Tom Zanussi
2013-01-24 20:58     ` Arnaldo Carvalho de Melo

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-10ee9fa3b92dece36209a3786d7bd558d459635f@git.kernel.org \
    --to=tom.zanussi@linux.intel.com \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox