aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-06-24 07:22:12 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-28 09:54:58 -0400
commitebccba3fe0a02f622f80e6be0e8ecb1a9a3ed983 (patch)
treef80cc76eaf80b553799fa93358054fbfb94907e3 /tools
parent9e1a7ea19f9f8e3e40c5ad1a5cc3615c1746ae7b (diff)
perf data ctf: Generate fork and exit events to CTF output
If 'all' is selected, convert fork and exit events to output CTF stream. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1466767332-114472-8-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/data-convert-bt.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index 5dd62ba07438..4f979bb27b6c 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -70,6 +70,8 @@ struct ctf_writer {
70 struct bt_ctf_field_type *array[6]; 70 struct bt_ctf_field_type *array[6];
71 } data; 71 } data;
72 struct bt_ctf_event_class *comm_class; 72 struct bt_ctf_event_class *comm_class;
73 struct bt_ctf_event_class *exit_class;
74 struct bt_ctf_event_class *fork_class;
73}; 75};
74 76
75struct convert { 77struct convert {
@@ -812,6 +814,21 @@ __FUNC_PROCESS_NON_SAMPLE(comm,
812 __NON_SAMPLE_SET_FIELD(comm, u32, tid); 814 __NON_SAMPLE_SET_FIELD(comm, u32, tid);
813 __NON_SAMPLE_SET_FIELD(comm, string, comm); 815 __NON_SAMPLE_SET_FIELD(comm, string, comm);
814) 816)
817__FUNC_PROCESS_NON_SAMPLE(fork,
818 __NON_SAMPLE_SET_FIELD(fork, u32, pid);
819 __NON_SAMPLE_SET_FIELD(fork, u32, ppid);
820 __NON_SAMPLE_SET_FIELD(fork, u32, tid);
821 __NON_SAMPLE_SET_FIELD(fork, u32, ptid);
822 __NON_SAMPLE_SET_FIELD(fork, u64, time);
823)
824
825__FUNC_PROCESS_NON_SAMPLE(exit,
826 __NON_SAMPLE_SET_FIELD(fork, u32, pid);
827 __NON_SAMPLE_SET_FIELD(fork, u32, ppid);
828 __NON_SAMPLE_SET_FIELD(fork, u32, tid);
829 __NON_SAMPLE_SET_FIELD(fork, u32, ptid);
830 __NON_SAMPLE_SET_FIELD(fork, u64, time);
831)
815#undef __NON_SAMPLE_SET_FIELD 832#undef __NON_SAMPLE_SET_FIELD
816#undef __FUNC_PROCESS_NON_SAMPLE 833#undef __FUNC_PROCESS_NON_SAMPLE
817 834
@@ -1127,6 +1144,22 @@ __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(comm,
1127 __NON_SAMPLE_ADD_FIELD(string, comm); 1144 __NON_SAMPLE_ADD_FIELD(string, comm);
1128) 1145)
1129 1146
1147__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(fork,
1148 __NON_SAMPLE_ADD_FIELD(u32, pid);
1149 __NON_SAMPLE_ADD_FIELD(u32, ppid);
1150 __NON_SAMPLE_ADD_FIELD(u32, tid);
1151 __NON_SAMPLE_ADD_FIELD(u32, ptid);
1152 __NON_SAMPLE_ADD_FIELD(u64, time);
1153)
1154
1155__FUNC_ADD_NON_SAMPLE_EVENT_CLASS(exit,
1156 __NON_SAMPLE_ADD_FIELD(u32, pid);
1157 __NON_SAMPLE_ADD_FIELD(u32, ppid);
1158 __NON_SAMPLE_ADD_FIELD(u32, tid);
1159 __NON_SAMPLE_ADD_FIELD(u32, ptid);
1160 __NON_SAMPLE_ADD_FIELD(u64, time);
1161)
1162
1130#undef __NON_SAMPLE_ADD_FIELD 1163#undef __NON_SAMPLE_ADD_FIELD
1131#undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS 1164#undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS
1132 1165
@@ -1138,6 +1171,12 @@ static int setup_non_sample_events(struct ctf_writer *cw,
1138 ret = add_comm_event(cw); 1171 ret = add_comm_event(cw);
1139 if (ret) 1172 if (ret)
1140 return ret; 1173 return ret;
1174 ret = add_exit_event(cw);
1175 if (ret)
1176 return ret;
1177 ret = add_fork_event(cw);
1178 if (ret)
1179 return ret;
1141 return 0; 1180 return 0;
1142} 1181}
1143 1182
@@ -1436,8 +1475,11 @@ int bt_convert__perf2ctf(const char *input, const char *path,
1436 struct ctf_writer *cw = &c.writer; 1475 struct ctf_writer *cw = &c.writer;
1437 int err = -1; 1476 int err = -1;
1438 1477
1439 if (opts->all) 1478 if (opts->all) {
1440 c.tool.comm = process_comm_event; 1479 c.tool.comm = process_comm_event;
1480 c.tool.exit = process_exit_event;
1481 c.tool.fork = process_fork_event;
1482 }
1441 1483
1442 perf_config(convert__config, &c); 1484 perf_config(convert__config, &c);
1443 1485