Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / lib / traceevent / plugins / plugin_hrtimer.c
blobd98466788f14c95cbd63cdee2ff888138d0801f7
1 // SPDX-License-Identifier: LGPL-2.1
2 /*
3 * Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
4 * Copyright (C) 2009 Johannes Berg <johannes@sipsolutions.net>
5 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
10 #include "event-parse.h"
11 #include "trace-seq.h"
13 static int timer_expire_handler(struct trace_seq *s,
14 struct tep_record *record,
15 struct tep_event *event, void *context)
17 trace_seq_printf(s, "hrtimer=");
19 if (tep_print_num_field(s, "0x%llx", event, "timer",
20 record, 0) == -1)
21 tep_print_num_field(s, "0x%llx", event, "hrtimer",
22 record, 1);
24 trace_seq_printf(s, " now=");
26 tep_print_num_field(s, "%llu", event, "now", record, 1);
28 tep_print_func_field(s, " function=%s", event, "function",
29 record, 0);
30 return 0;
33 static int timer_start_handler(struct trace_seq *s,
34 struct tep_record *record,
35 struct tep_event *event, void *context)
37 trace_seq_printf(s, "hrtimer=");
39 if (tep_print_num_field(s, "0x%llx", event, "timer",
40 record, 0) == -1)
41 tep_print_num_field(s, "0x%llx", event, "hrtimer",
42 record, 1);
44 tep_print_func_field(s, " function=%s", event, "function",
45 record, 0);
47 trace_seq_printf(s, " expires=");
48 tep_print_num_field(s, "%llu", event, "expires", record, 1);
50 trace_seq_printf(s, " softexpires=");
51 tep_print_num_field(s, "%llu", event, "softexpires", record, 1);
52 return 0;
55 int TEP_PLUGIN_LOADER(struct tep_handle *tep)
57 tep_register_event_handler(tep, -1,
58 "timer", "hrtimer_expire_entry",
59 timer_expire_handler, NULL);
61 tep_register_event_handler(tep, -1, "timer", "hrtimer_start",
62 timer_start_handler, NULL);
63 return 0;
66 void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
68 tep_unregister_event_handler(tep, -1,
69 "timer", "hrtimer_expire_entry",
70 timer_expire_handler, NULL);
72 tep_unregister_event_handler(tep, -1, "timer", "hrtimer_start",
73 timer_start_handler, NULL);