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@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1363850332-25297-10-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
452958fdd0
commit
ebf3c675d7
1 changed files with 4 additions and 9 deletions
|
@ -43,7 +43,7 @@ int file_bigendian;
|
||||||
int host_bigendian;
|
int host_bigendian;
|
||||||
static int long_size;
|
static int long_size;
|
||||||
|
|
||||||
static ssize_t calc_data_size;
|
static ssize_t trace_data_size;
|
||||||
static bool repipe;
|
static bool repipe;
|
||||||
|
|
||||||
static int __do_read(int fd, void *buf, int size)
|
static int __do_read(int fd, void *buf, int size)
|
||||||
|
@ -83,8 +83,7 @@ static int do_read(void *data, int size)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calc_data_size)
|
trace_data_size += r;
|
||||||
calc_data_size += r;
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -155,8 +154,7 @@ static char *read_string(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calc_data_size)
|
trace_data_size += size;
|
||||||
calc_data_size += size;
|
|
||||||
|
|
||||||
str = malloc(size);
|
str = malloc(size);
|
||||||
if (str)
|
if (str)
|
||||||
|
@ -356,9 +354,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
|
||||||
|
|
||||||
*ppevent = NULL;
|
*ppevent = NULL;
|
||||||
|
|
||||||
calc_data_size = 1;
|
|
||||||
repipe = __repipe;
|
repipe = __repipe;
|
||||||
|
|
||||||
input_fd = fd;
|
input_fd = fd;
|
||||||
|
|
||||||
if (do_read(buf, 3) < 0)
|
if (do_read(buf, 3) < 0)
|
||||||
|
@ -417,8 +413,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
size = calc_data_size - 1;
|
size = trace_data_size;
|
||||||
calc_data_size = 0;
|
|
||||||
repipe = false;
|
repipe = false;
|
||||||
|
|
||||||
if (show_funcs) {
|
if (show_funcs) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue