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

perf tools: tool->finished_round() doesn't need perf_session

It is all about flushing the ordered queue or piping it thru, no need
for a perf_session pointer.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-g47fx3ys0t9271cp0dcabjc7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+34 -14
+8 -1
tools/perf/builtin-inject.c
··· 53 53 return 0; 54 54 } 55 55 56 + static int perf_event__repipe_oe_synth(struct perf_tool *tool, 57 + union perf_event *event, 58 + struct ordered_events *oe __maybe_unused) 59 + { 60 + return perf_event__repipe_synth(tool, event); 61 + } 62 + 56 63 static int perf_event__repipe_op2_synth(struct perf_tool *tool, 57 64 union perf_event *event, 58 65 struct perf_session *session ··· 413 406 .unthrottle = perf_event__repipe, 414 407 .attr = perf_event__repipe_attr, 415 408 .tracing_data = perf_event__repipe_op2_synth, 416 - .finished_round = perf_event__repipe_op2_synth, 409 + .finished_round = perf_event__repipe_oe_synth, 417 410 .build_id = perf_event__repipe_op2_synth, 418 411 .id_index = perf_event__repipe_op2_synth, 419 412 },
+5 -2
tools/perf/builtin-kvm.c
··· 18 18 #include "util/stat.h" 19 19 #include "util/top.h" 20 20 #include "util/data.h" 21 + #include "util/ordered-events.h" 21 22 22 23 #include <sys/prctl.h> 23 24 #ifdef HAVE_TIMERFD_SUPPORT ··· 784 783 785 784 /* flush queue after each round in which we processed events */ 786 785 if (ntotal) { 787 - kvm->session->ordered_events.next_flush = flush_time; 788 - err = kvm->tool.finished_round(&kvm->tool, NULL, kvm->session); 786 + struct ordered_events *oe = &kvm->session->ordered_events; 787 + 788 + oe->next_flush = flush_time; 789 + err = ordered_events__flush(oe, OE_FLUSH__ROUND); 789 790 if (err) { 790 791 if (kvm->lost_events) 791 792 pr_info("\nLost events: %" PRIu64 "\n\n",
+15 -9
tools/perf/util/session.c
··· 225 225 return 0; 226 226 } 227 227 228 + static int process_build_id_stub(struct perf_tool *tool __maybe_unused, 229 + union perf_event *event __maybe_unused, 230 + struct perf_session *session __maybe_unused) 231 + { 232 + dump_printf(": unhandled!\n"); 233 + return 0; 234 + } 235 + 228 236 static int process_finished_round_stub(struct perf_tool *tool __maybe_unused, 229 237 union perf_event *event __maybe_unused, 230 - struct perf_session *perf_session 231 - __maybe_unused) 238 + struct ordered_events *oe __maybe_unused) 232 239 { 233 240 dump_printf(": unhandled!\n"); 234 241 return 0; ··· 243 236 244 237 static int process_finished_round(struct perf_tool *tool, 245 238 union perf_event *event, 246 - struct perf_session *session); 239 + struct ordered_events *oe); 247 240 248 241 static int process_id_index_stub(struct perf_tool *tool __maybe_unused, 249 242 union perf_event *event __maybe_unused, ··· 281 274 if (tool->tracing_data == NULL) 282 275 tool->tracing_data = process_event_synth_tracing_data_stub; 283 276 if (tool->build_id == NULL) 284 - tool->build_id = process_finished_round_stub; 277 + tool->build_id = process_build_id_stub; 285 278 if (tool->finished_round == NULL) { 286 279 if (tool->ordered_events) 287 280 tool->finished_round = process_finished_round; ··· 533 526 */ 534 527 static int process_finished_round(struct perf_tool *tool __maybe_unused, 535 528 union perf_event *event __maybe_unused, 536 - struct perf_session *session) 529 + struct ordered_events *oe) 537 530 { 538 - struct ordered_events *oe = &session->ordered_events; 539 - 540 531 return ordered_events__flush(oe, OE_FLUSH__ROUND); 541 532 } 542 533 ··· 966 961 union perf_event *event, 967 962 u64 file_offset) 968 963 { 969 - struct perf_tool *tool = session->ordered_events.tool; 964 + struct ordered_events *oe = &session->ordered_events; 965 + struct perf_tool *tool = oe->tool; 970 966 int fd = perf_data_file__fd(session->file); 971 967 int err; 972 968 ··· 995 989 case PERF_RECORD_HEADER_BUILD_ID: 996 990 return tool->build_id(tool, event, session); 997 991 case PERF_RECORD_FINISHED_ROUND: 998 - return tool->finished_round(tool, event, session); 992 + return tool->finished_round(tool, event, oe); 999 993 case PERF_RECORD_ID_INDEX: 1000 994 return tool->id_index(tool, event, session); 1001 995 default:
+6 -2
tools/perf/util/tool.h
··· 10 10 struct perf_sample; 11 11 struct perf_tool; 12 12 struct machine; 13 + struct ordered_events; 13 14 14 15 typedef int (*event_sample)(struct perf_tool *tool, union perf_event *event, 15 16 struct perf_sample *sample, ··· 26 25 typedef int (*event_op2)(struct perf_tool *tool, union perf_event *event, 27 26 struct perf_session *session); 28 27 28 + typedef int (*event_oe)(struct perf_tool *tool, union perf_event *event, 29 + struct ordered_events *oe); 30 + 29 31 struct perf_tool { 30 32 event_sample sample, 31 33 read; ··· 42 38 unthrottle; 43 39 event_attr_op attr; 44 40 event_op2 tracing_data; 45 - event_op2 finished_round, 46 - build_id, 41 + event_oe finished_round; 42 + event_op2 build_id, 47 43 id_index; 48 44 bool ordered_events; 49 45 bool ordering_requires_timestamps;