[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-ebf3c675d7e4ba97568dd6daaa43b1af10046b29@git.kernel.org>
Date: Tue, 2 Apr 2013 02:32:23 -0700
From: tip-bot for Namhyung Kim <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, paulus@...ba.org,
hpa@...or.com, mingo@...nel.org, a.p.zijlstra@...llo.nl,
namhyung.kim@....com, namhyung@...nel.org, fweisbec@...il.com,
rostedt@...dmis.org, tglx@...utronix.de
Subject: [tip:perf/core] perf tools: Cleanup calc_data_size logic
Commit-ID: ebf3c675d7e4ba97568dd6daaa43b1af10046b29
Gitweb: http://git.kernel.org/tip/ebf3c675d7e4ba97568dd6daaa43b1af10046b29
Author: Namhyung Kim <namhyung.kim@....com>
AuthorDate: Thu, 21 Mar 2013 16:18:52 +0900
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 21 Mar 2013 13:37:37 -0300
perf tools: Cleanup calc_data_size logic
It's for calculating whole trace data size during reading. However
relation functions are called only in this file, no need to
conditionalize it with tricky +1 offset and rename the variable to
more meaningful name like trace_data_size.
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Steven Rostedt <rostedt@...dmis.org>
Link: http://lkml.kernel.org/r/1363850332-25297-10-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/trace-event-read.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index 644ad3b..af215c0 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -43,7 +43,7 @@ int file_bigendian;
int host_bigendian;
static int long_size;
-static ssize_t calc_data_size;
+static ssize_t trace_data_size;
static bool repipe;
static int __do_read(int fd, void *buf, int size)
@@ -83,8 +83,7 @@ static int do_read(void *data, int size)
return -1;
}
- if (calc_data_size)
- calc_data_size += r;
+ trace_data_size += r;
return r;
}
@@ -155,8 +154,7 @@ static char *read_string(void)
break;
}
- if (calc_data_size)
- calc_data_size += size;
+ trace_data_size += size;
str = malloc(size);
if (str)
@@ -356,9 +354,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
*ppevent = NULL;
- calc_data_size = 1;
repipe = __repipe;
-
input_fd = fd;
if (do_read(buf, 3) < 0)
@@ -417,8 +413,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
if (err)
goto out;
- size = calc_data_size - 1;
- calc_data_size = 0;
+ size = trace_data_size;
repipe = false;
if (show_funcs) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists