From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
linux-kernel@vger.kernel.org, yrl.pp-manager.tt@hitachi.com
Subject: [PATCH V3 2/3] trace-cmd: Add recording to trace_clock
Date: Thu, 25 Apr 2013 08:13:02 +0900 [thread overview]
Message-ID: <20130424231302.14877.24340.stgit@yunodevel> (raw)
In-Reply-To: <20130424231257.14877.77172.stgit@yunodevel>
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 a flag
TRACECMD_OPTION_TRACECLOCK for using the option feature. For supporting
multiple buffers, this patch doesn't store data of trace_clock when trace-cmd
adds 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 cc71adf..bdb478d 100644
--- a/trace-output.c
+++ b/trace-output.c
@@ -1067,6 +1067,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;
next prev parent reply other threads:[~2013-04-24 23:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 23:12 [PATCH V3 0/3] trace-cmd: Support a raw format for outputting timestamp Yoshihiro YUNOMAE
2013-04-24 23:13 ` [PATCH V3 1/3] trace-cmd: Define general functions for outputting/inputting saved_cmdlines Yoshihiro YUNOMAE
2013-04-24 23:13 ` Yoshihiro YUNOMAE [this message]
2013-04-24 23:13 ` [PATCH V3 3/3] trace-cmd: Add support for extracting trace_clock in report Yoshihiro YUNOMAE
2013-11-04 20:22 ` [tip:perf/core] tools lib traceevent: " tip-bot for Yoshihiro YUNOMAE
2013-05-07 2:03 ` [PATCH V3 0/3] trace-cmd: Support a raw format for outputting timestamp Yoshihiro YUNOMAE
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=20130424231302.14877.24340.stgit@yunodevel \
--to=yoshihiro.yunomae.ez@hitachi.com \
--cc=hidehiro.kawai.ez@hitachi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=rostedt@goodmis.org \
--cc=yrl.pp-manager.tt@hitachi.com \
/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