Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wang Nan and committed by
Arnaldo Carvalho de Melo
ebccba3f 9e1a7ea1

+43 -1
+43 -1
tools/perf/util/data-convert-bt.c
··· 70 70 struct bt_ctf_field_type *array[6]; 71 71 } data; 72 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 75 77 struct convert { ··· 814 812 __NON_SAMPLE_SET_FIELD(comm, u32, tid); 815 813 __NON_SAMPLE_SET_FIELD(comm, string, comm); 816 814 ) 815 + __FUNC_PROCESS_NON_SAMPLE(fork, 816 + __NON_SAMPLE_SET_FIELD(fork, u32, pid); 817 + __NON_SAMPLE_SET_FIELD(fork, u32, ppid); 818 + __NON_SAMPLE_SET_FIELD(fork, u32, tid); 819 + __NON_SAMPLE_SET_FIELD(fork, u32, ptid); 820 + __NON_SAMPLE_SET_FIELD(fork, u64, time); 821 + ) 822 + 823 + __FUNC_PROCESS_NON_SAMPLE(exit, 824 + __NON_SAMPLE_SET_FIELD(fork, u32, pid); 825 + __NON_SAMPLE_SET_FIELD(fork, u32, ppid); 826 + __NON_SAMPLE_SET_FIELD(fork, u32, tid); 827 + __NON_SAMPLE_SET_FIELD(fork, u32, ptid); 828 + __NON_SAMPLE_SET_FIELD(fork, u64, time); 829 + ) 817 830 #undef __NON_SAMPLE_SET_FIELD 818 831 #undef __FUNC_PROCESS_NON_SAMPLE 819 832 ··· 1144 1127 __NON_SAMPLE_ADD_FIELD(string, comm); 1145 1128 ) 1146 1129 1130 + __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(fork, 1131 + __NON_SAMPLE_ADD_FIELD(u32, pid); 1132 + __NON_SAMPLE_ADD_FIELD(u32, ppid); 1133 + __NON_SAMPLE_ADD_FIELD(u32, tid); 1134 + __NON_SAMPLE_ADD_FIELD(u32, ptid); 1135 + __NON_SAMPLE_ADD_FIELD(u64, time); 1136 + ) 1137 + 1138 + __FUNC_ADD_NON_SAMPLE_EVENT_CLASS(exit, 1139 + __NON_SAMPLE_ADD_FIELD(u32, pid); 1140 + __NON_SAMPLE_ADD_FIELD(u32, ppid); 1141 + __NON_SAMPLE_ADD_FIELD(u32, tid); 1142 + __NON_SAMPLE_ADD_FIELD(u32, ptid); 1143 + __NON_SAMPLE_ADD_FIELD(u64, time); 1144 + ) 1145 + 1147 1146 #undef __NON_SAMPLE_ADD_FIELD 1148 1147 #undef __FUNC_ADD_NON_SAMPLE_EVENT_CLASS 1149 1148 ··· 1169 1136 int ret; 1170 1137 1171 1138 ret = add_comm_event(cw); 1139 + if (ret) 1140 + return ret; 1141 + ret = add_exit_event(cw); 1142 + if (ret) 1143 + return ret; 1144 + ret = add_fork_event(cw); 1172 1145 if (ret) 1173 1146 return ret; 1174 1147 return 0; ··· 1475 1436 struct ctf_writer *cw = &c.writer; 1476 1437 int err = -1; 1477 1438 1478 - if (opts->all) 1439 + if (opts->all) { 1479 1440 c.tool.comm = process_comm_event; 1441 + c.tool.exit = process_exit_event; 1442 + c.tool.fork = process_fork_event; 1443 + } 1480 1444 1481 1445 perf_config(convert__config, &c); 1482 1446