lkml.org 
[lkml]   [2013]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH V2 2/3] trace-cmd: Add recording to trace_clock
From
Date
In this patch, trace-cmd reads trace_clock on debugfs in the record mode and
outputs the data to trace.dat file. This patch defines the flag
TRACECMD_OPTION_TRACECLOCK for using the option feature. For supporting
multiple buffers, this patch doesn't store data of trace_clock when add
the flag to trace.dat. This is because the flag is globally used, but
trace_clock can be changed for each buffer. So, this patch stores data of
trace_clock after adding data information of each CPU. The binary format
of trace.data is changed as follows:

<Current binary format>
...
"flyrecord" -----+
[total cpu numer] |
[file offset and size of cpu0] |
... +--- info. of normal buffer
[file offset and size of cpuX] |
--skip-- |
[data of CPU0] |
... -----+
--skip--
"flyrecord" -----+
[total cpu numer] |
[file offset and size of cpu0] |
... +--- info. of sub-buffer
[file offset and size of cpuX] |
--skip-- |
[data of CPU0] |
... -----+

<Changed binary format>
...
"flyrecord" -----+
[total cpu numer] |
[file offset and size of cpu0] |
... +--- info. of normal buffer
[file offset and size of cpuX] |
[size of trace_clock] <== add |
[trace_clock contents] <== add |
--skip-- |
[data of CPU0] |
... -----+
--skip--
"flyrecord" -----+
[total cpu numer] |
[file offset and size of cpu0] |
... +--- info. of sub-buffer
[file offset and size of cpuX] |
[size of trace_clock] <== add |
[trace_clock contents] <== add |
--skip-- |
[data of CPU0] |
... -----+

Changes in v2:
- Define TRACECMD_OPTION_TRACECLOCK for extracting trace_clock

Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
---
trace-cmd.h | 1 +
trace-output.c | 3 +++
trace-record.c | 3 +++
3 files changed, 7 insertions(+)

diff --git a/trace-cmd.h b/trace-cmd.h
index 116c2f6..0745dad 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -81,6 +81,7 @@ enum {
TRACECMD_OPTION_DATE,
TRACECMD_OPTION_CPUSTAT,
TRACECMD_OPTION_BUFFER,
+ TRACECMD_OPTION_TRACECLOCK,
};

enum {
diff --git a/trace-output.c b/trace-output.c
index 8697976..b771f08 100644
--- a/trace-output.c
+++ b/trace-output.c
@@ -1061,6 +1061,9 @@ static int __tracecmd_append_cpu_data(struct tracecmd_output *handle,
goto out_free;
}

+ if (save_tracing_file_data(handle, "trace_clock") < 0)
+ goto out_free;
+
for (i = 0; i < cpus; i++) {
fprintf(stderr, "CPU%d data recorded at offset=0x%llx\n",
i, (unsigned long long) offsets[i]);
diff --git a/trace-record.c b/trace-record.c
index 0025cf3..407576f 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -1804,6 +1804,9 @@ static void record_data(char *date2ts, struct trace_seq *s)
tracecmd_add_option(handle, TRACECMD_OPTION_CPUSTAT,
s[i].len+1, s[i].buffer);

+ tracecmd_add_option(handle, TRACECMD_OPTION_TRACECLOCK,
+ 0, NULL);
+
if (buffers) {
buffer_options = malloc_or_die(sizeof(*buffer_options) * buffers);
i = 0;


\
 
 \ /
  Last update: 2013-04-22 12:21    [W:0.074 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site