0001
0002
0003
0004
0005
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008 #include <string.h>
0009
0010 #include "event-parse.h"
0011 #include "trace-seq.h"
0012
0013 static int timer_expire_handler(struct trace_seq *s,
0014 struct tep_record *record,
0015 struct tep_event *event, void *context)
0016 {
0017 trace_seq_printf(s, "hrtimer=");
0018
0019 if (tep_print_num_field(s, "0x%llx", event, "timer",
0020 record, 0) == -1)
0021 tep_print_num_field(s, "0x%llx", event, "hrtimer",
0022 record, 1);
0023
0024 trace_seq_printf(s, " now=");
0025
0026 tep_print_num_field(s, "%llu", event, "now", record, 1);
0027
0028 tep_print_func_field(s, " function=%s", event, "function",
0029 record, 0);
0030 return 0;
0031 }
0032
0033 static int timer_start_handler(struct trace_seq *s,
0034 struct tep_record *record,
0035 struct tep_event *event, void *context)
0036 {
0037 trace_seq_printf(s, "hrtimer=");
0038
0039 if (tep_print_num_field(s, "0x%llx", event, "timer",
0040 record, 0) == -1)
0041 tep_print_num_field(s, "0x%llx", event, "hrtimer",
0042 record, 1);
0043
0044 tep_print_func_field(s, " function=%s", event, "function",
0045 record, 0);
0046
0047 trace_seq_printf(s, " expires=");
0048 tep_print_num_field(s, "%llu", event, "expires", record, 1);
0049
0050 trace_seq_printf(s, " softexpires=");
0051 tep_print_num_field(s, "%llu", event, "softexpires", record, 1);
0052 return 0;
0053 }
0054
0055 int TEP_PLUGIN_LOADER(struct tep_handle *tep)
0056 {
0057 tep_register_event_handler(tep, -1,
0058 "timer", "hrtimer_expire_entry",
0059 timer_expire_handler, NULL);
0060
0061 tep_register_event_handler(tep, -1, "timer", "hrtimer_start",
0062 timer_start_handler, NULL);
0063 return 0;
0064 }
0065
0066 void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
0067 {
0068 tep_unregister_event_handler(tep, -1,
0069 "timer", "hrtimer_expire_entry",
0070 timer_expire_handler, NULL);
0071
0072 tep_unregister_event_handler(tep, -1, "timer", "hrtimer_start",
0073 timer_start_handler, NULL);
0074 }