Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1429630 > unrolled thread
| Started by | Wang Nan <wangnan0@huawei.com> |
|---|---|
| First post | 2016-06-23 11:20 +0200 |
| Last post | 2016-06-23 11:30 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/6] perf ctf: Convert comm, fork and exit events to CTF Wang Nan <wangnan0@huawei.com> - 2016-06-23 11:20 +0200
[PATCH 3/6] perf ctf: Add non_sample option Wang Nan <wangnan0@huawei.com> - 2016-06-23 11:20 +0200
[PATCH 6/6] perf ctf: Generate fork and exit events to CTF output Wang Nan <wangnan0@huawei.com> - 2016-06-23 11:30 +0200
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2016-06-23 11:20 +0200 |
| Subject | [PATCH 0/6] perf ctf: Convert comm, fork and exit events to CTF |
| Message-ID | <rN8XL-7PN-5@gated-at.bofh.it> |
After converting perf.data to CTF, we lost pid-tid-comm mapping. Which
makes inconvience. For example, in perf script output we know which
process issue an event like this:
compiz 19361 [001] 3275709.313929: raw_syscalls:sys_exit: NR 7 = 0
After converting to CTF, we only get this:
[3275709.313929985] (+0.110646118) raw_syscalls:sys_exit: { cpu_id = 1 }, { perf_ip = 0xFFFFFFFF8107B2E8, perf_tid = 19361, perf_pid = 19361, perf_id = 18920, perf_period = 1, common_type = 16, common_flags = 0, common_preempt_count = 1, common_pid = 19361, id = 7, ret = 0 }
Currently, if we want to find the name and parent of a process, we
have to collect 'sched:sched_switch' event.
This patch set add a '--all' option to 'perf convert', converts comm,
fork and exit events to CTF output. CTF user now can track the mapping
by their own.
Wang Nan (6):
perf ctf: Add value_set_string() helper
perf ctf: Pass convert options through structure
perf ctf: Add non_sample option
perf ctf: Generate comm event to CTF output
perf ctf: Add '--all' option for 'perf data convert'
perf ctf: Generate fork and exit events to CTF output
tools/perf/Documentation/perf-data.txt | 5 +-
tools/perf/builtin-data.c | 11 +-
tools/perf/util/data-convert-bt.c | 185 ++++++++++++++++++++++++++++++++-
tools/perf/util/data-convert-bt.h | 4 +-
tools/perf/util/data-convert.h | 9 ++
5 files changed, 207 insertions(+), 7 deletions(-)
create mode 100644 tools/perf/util/data-convert.h
--
1.8.3.4
[toc] | [next] | [standalone]
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2016-06-23 11:20 +0200 |
| Subject | [PATCH 3/6] perf ctf: Add non_sample option |
| Message-ID | <rN8XM-7PN-39@gated-at.bofh.it> |
| In reply to | #1429630 |
If non_sample option is selected, 'perf data convert' should convert
not only samples, but non-sample events such as comm and fork. Add this
option in perf_data_convert_opts. Following commits will add cmdline
option to select it.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/builtin-data.c | 1 +
tools/perf/util/data-convert.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
index 38111a9..a011a56 100644
--- a/tools/perf/builtin-data.c
+++ b/tools/perf/builtin-data.c
@@ -56,6 +56,7 @@ static int cmd_data_convert(int argc, const char **argv,
const char *to_ctf = NULL;
struct perf_data_convert_opts opts = {
.force = false,
+ .non_sample = false,
};
const struct option options[] = {
OPT_INCR('v', "verbose", &verbose, "be more verbose"),
diff --git a/tools/perf/util/data-convert.h b/tools/perf/util/data-convert.h
index 97cfd36..66f2b2a 100644
--- a/tools/perf/util/data-convert.h
+++ b/tools/perf/util/data-convert.h
@@ -3,6 +3,7 @@
struct perf_data_convert_opts {
bool force;
+ bool non_sample;
};
#endif /* __DATA_CONVERT_H */
--
1.8.3.4
[toc] | [prev] | [next] | [standalone]
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Date | 2016-06-23 11:30 +0200 |
| Subject | [PATCH 6/6] perf ctf: Generate fork and exit events to CTF output |
| Message-ID | <rN97r-7UZ-15@gated-at.bofh.it> |
| In reply to | #1429630 |
If non_sample is selected, convert fork and exit events to output CTF stream.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/data-convert-bt.c | 44 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index bc6d42b..2c972fd 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -69,6 +69,8 @@ struct ctf_writer {
struct bt_ctf_field_type *array[6];
} data;
struct bt_ctf_event_class *comm_class;
+ struct bt_ctf_event_class *exit_class;
+ struct bt_ctf_event_class *fork_class;
};
struct convert {
@@ -808,6 +810,21 @@ __FUNC_PROCESS_NON_SAMPLE(comm,
__NON_SAMPLE_SET_FIELD(comm, u32, tid);
__NON_SAMPLE_SET_FIELD(comm, string, comm);
)
+__FUNC_PROCESS_NON_SAMPLE(fork,
+ __NON_SAMPLE_SET_FIELD(fork, u32, pid);
+ __NON_SAMPLE_SET_FIELD(fork, u32, ppid);
+ __NON_SAMPLE_SET_FIELD(fork, u32, tid);
+ __NON_SAMPLE_SET_FIELD(fork, u32, ptid);
+ __NON_SAMPLE_SET_FIELD(fork, u64, time);
+)
+
+__FUNC_PROCESS_NON_SAMPLE(exit,
+ __NON_SAMPLE_SET_FIELD(fork, u32, pid);
+ __NON_SAMPLE_SET_FIELD(fork, u32, ppid);
+ __NON_SAMPLE_SET_FIELD(fork, u32, tid);
+ __NON_SAMPLE_SET_FIELD(fork, u32, ptid);
+ __NON_SAMPLE_SET_FIELD(fork, u64, time);
+)
#undef __NON_SAMPLE_SET_FIELD
#undef __FUNC_PROCESS_NON_SAMPLE
@@ -1123,6 +1140,22 @@ __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(comm,
__NON_SAMPLE_ADD_FIELD(string, comm);
)
+__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(fork,
+ __NON_SAMPLE_ADD_FIELD(u32, pid);
+ __NON_SAMPLE_ADD_FIELD(u32, ppid);
+ __NON_SAMPLE_ADD_FIELD(u32, tid);
+ __NON_SAMPLE_ADD_FIELD(u32, ptid);
+ __NON_SAMPLE_ADD_FIELD(u64, time);
+)
+
+__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(exit,
+ __NON_SAMPLE_ADD_FIELD(u32, pid);
+ __NON_SAMPLE_ADD_FIELD(u32, ppid);
+ __NON_SAMPLE_ADD_FIELD(u32, tid);
+ __NON_SAMPLE_ADD_FIELD(u32, ptid);
+ __NON_SAMPLE_ADD_FIELD(u64, time);
+)
+
#undef __NON_SAMPLE_ADD_FIELD
#undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS
@@ -1134,6 +1167,12 @@ static int setup_non_sample_events(struct ctf_writer *cw,
ret = add_comm_event(cw);
if (ret)
return ret;
+ ret = add_exit_event(cw);
+ if (ret)
+ return ret;
+ ret = add_fork_event(cw);
+ if (ret)
+ return ret;
return 0;
}
@@ -1432,8 +1471,11 @@ int bt_convert__perf2ctf(const char *input, const char *path,
struct ctf_writer *cw = &c.writer;
int err = -1;
- if (opts->non_sample)
+ if (opts->non_sample) {
c.tool.comm = process_comm_event;
+ c.tool.exit = process_exit_event;
+ c.tool.fork = process_fork_event;
+ }
perf_config(convert__config, &c);
--
1.8.3.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web