2020-07-02 14:53:58 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-2.1
|
2013-12-03 14:09:27 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
|
|
|
|
* Copyright (C) 2009 Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "event-parse.h"
|
2018-08-28 18:50:38 -04:00
|
|
|
#include "trace-seq.h"
|
2013-12-03 14:09:27 +01:00
|
|
|
|
|
|
|
static int timer_expire_handler(struct trace_seq *s,
|
2018-08-08 14:02:47 -04:00
|
|
|
struct tep_record *record,
|
2018-11-30 10:44:07 -05:00
|
|
|
struct tep_event *event, void *context)
|
2013-12-03 14:09:27 +01:00
|
|
|
{
|
|
|
|
trace_seq_printf(s, "hrtimer=");
|
|
|
|
|
2018-08-08 14:02:52 -04:00
|
|
|
if (tep_print_num_field(s, "0x%llx", event, "timer",
|
|
|
|
record, 0) == -1)
|
|
|
|
tep_print_num_field(s, "0x%llx", event, "hrtimer",
|
|
|
|
record, 1);
|
2013-12-03 14:09:27 +01:00
|
|
|
|
|
|
|
trace_seq_printf(s, " now=");
|
|
|
|
|
2018-08-08 14:02:52 -04:00
|
|
|
tep_print_num_field(s, "%llu", event, "now", record, 1);
|
2013-12-03 14:09:27 +01:00
|
|
|
|
2018-08-08 14:02:52 -04:00
|
|
|
tep_print_func_field(s, " function=%s", event, "function",
|
2013-12-03 14:09:27 +01:00
|
|
|
record, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int timer_start_handler(struct trace_seq *s,
|
2018-08-08 14:02:47 -04:00
|
|
|
struct tep_record *record,
|
2018-11-30 10:44:07 -05:00
|
|
|
struct tep_event *event, void *context)
|
2013-12-03 14:09:27 +01:00
|
|
|
{
|
|
|
|
trace_seq_printf(s, "hrtimer=");
|
|
|
|
|
2018-08-08 14:02:52 -04:00
|
|
|
if (tep_print_num_field(s, "0x%llx", event, "timer",
|
|
|
|
record, 0) == -1)
|
|
|
|
tep_print_num_field(s, "0x%llx", event, "hrtimer",
|
|
|
|
record, 1);
|
2013-12-03 14:09:27 +01:00
|
|
|
|
2018-08-08 14:02:52 -04:00
|
|
|
tep_print_func_field(s, " function=%s", event, "function",
|
|
|
|
record, 0);
|
2013-12-03 14:09:27 +01:00
|
|
|
|
|
|
|
trace_seq_printf(s, " expires=");
|
2018-08-08 14:02:52 -04:00
|
|
|
tep_print_num_field(s, "%llu", event, "expires", record, 1);
|
2013-12-03 14:09:27 +01:00
|
|
|
|
|
|
|
trace_seq_printf(s, " softexpires=");
|
2018-08-08 14:02:52 -04:00
|
|
|
tep_print_num_field(s, "%llu", event, "softexpires", record, 1);
|
2013-12-03 14:09:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-04-01 12:43:17 -04:00
|
|
|
int TEP_PLUGIN_LOADER(struct tep_handle *tep)
|
2013-12-03 14:09:27 +01:00
|
|
|
{
|
2019-04-01 12:43:17 -04:00
|
|
|
tep_register_event_handler(tep, -1,
|
2018-08-08 14:03:02 -04:00
|
|
|
"timer", "hrtimer_expire_entry",
|
|
|
|
timer_expire_handler, NULL);
|
2013-12-03 14:09:27 +01:00
|
|
|
|
2019-04-01 12:43:17 -04:00
|
|
|
tep_register_event_handler(tep, -1, "timer", "hrtimer_start",
|
2018-08-08 14:03:02 -04:00
|
|
|
timer_start_handler, NULL);
|
2013-12-03 14:09:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2014-01-16 11:31:10 +09:00
|
|
|
|
2019-04-01 12:43:17 -04:00
|
|
|
void TEP_PLUGIN_UNLOADER(struct tep_handle *tep)
|
2014-01-16 11:31:10 +09:00
|
|
|
{
|
2019-04-01 12:43:17 -04:00
|
|
|
tep_unregister_event_handler(tep, -1,
|
2018-08-08 14:03:02 -04:00
|
|
|
"timer", "hrtimer_expire_entry",
|
|
|
|
timer_expire_handler, NULL);
|
2014-01-16 11:31:10 +09:00
|
|
|
|
2019-04-01 12:43:17 -04:00
|
|
|
tep_unregister_event_handler(tep, -1, "timer", "hrtimer_start",
|
2018-08-08 14:03:02 -04:00
|
|
|
timer_start_handler, NULL);
|
2014-01-16 11:31:10 +09:00
|
|
|
}
|