2013-12-03 21:09:27 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
|
|
|
|
* Copyright (C) 2009 Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation;
|
|
|
|
* version 2.1 of the License (not later!)
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, see <http://www.gnu.org/licenses>
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "event-parse.h"
|
2018-08-29 06:50:38 +08:00
|
|
|
#include "trace-seq.h"
|
2013-12-03 21:09:27 +08:00
|
|
|
|
|
|
|
static int timer_expire_handler(struct trace_seq *s,
|
2018-08-09 02:02:47 +08:00
|
|
|
struct tep_record *record,
|
2018-09-20 02:56:44 +08:00
|
|
|
struct tep_event_format *event, void *context)
|
2013-12-03 21:09:27 +08:00
|
|
|
{
|
|
|
|
trace_seq_printf(s, "hrtimer=");
|
|
|
|
|
2018-08-09 02:02:52 +08: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 21:09:27 +08:00
|
|
|
|
|
|
|
trace_seq_printf(s, " now=");
|
|
|
|
|
2018-08-09 02:02:52 +08:00
|
|
|
tep_print_num_field(s, "%llu", event, "now", record, 1);
|
2013-12-03 21:09:27 +08:00
|
|
|
|
2018-08-09 02:02:52 +08:00
|
|
|
tep_print_func_field(s, " function=%s", event, "function",
|
2013-12-03 21:09:27 +08:00
|
|
|
record, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int timer_start_handler(struct trace_seq *s,
|
2018-08-09 02:02:47 +08:00
|
|
|
struct tep_record *record,
|
2018-09-20 02:56:44 +08:00
|
|
|
struct tep_event_format *event, void *context)
|
2013-12-03 21:09:27 +08:00
|
|
|
{
|
|
|
|
trace_seq_printf(s, "hrtimer=");
|
|
|
|
|
2018-08-09 02:02:52 +08: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 21:09:27 +08:00
|
|
|
|
2018-08-09 02:02:52 +08:00
|
|
|
tep_print_func_field(s, " function=%s", event, "function",
|
|
|
|
record, 0);
|
2013-12-03 21:09:27 +08:00
|
|
|
|
|
|
|
trace_seq_printf(s, " expires=");
|
2018-08-09 02:02:52 +08:00
|
|
|
tep_print_num_field(s, "%llu", event, "expires", record, 1);
|
2013-12-03 21:09:27 +08:00
|
|
|
|
|
|
|
trace_seq_printf(s, " softexpires=");
|
2018-08-09 02:02:52 +08:00
|
|
|
tep_print_num_field(s, "%llu", event, "softexpires", record, 1);
|
2013-12-03 21:09:27 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-09 02:02:48 +08:00
|
|
|
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
|
2013-12-03 21:09:27 +08:00
|
|
|
{
|
2018-08-09 02:03:02 +08:00
|
|
|
tep_register_event_handler(pevent, -1,
|
|
|
|
"timer", "hrtimer_expire_entry",
|
|
|
|
timer_expire_handler, NULL);
|
2013-12-03 21:09:27 +08:00
|
|
|
|
2018-08-09 02:03:02 +08:00
|
|
|
tep_register_event_handler(pevent, -1, "timer", "hrtimer_start",
|
|
|
|
timer_start_handler, NULL);
|
2013-12-03 21:09:27 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2014-01-16 10:31:10 +08:00
|
|
|
|
2018-08-09 02:02:48 +08:00
|
|
|
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
|
2014-01-16 10:31:10 +08:00
|
|
|
{
|
2018-08-09 02:03:02 +08:00
|
|
|
tep_unregister_event_handler(pevent, -1,
|
|
|
|
"timer", "hrtimer_expire_entry",
|
|
|
|
timer_expire_handler, NULL);
|
2014-01-16 10:31:10 +08:00
|
|
|
|
2018-08-09 02:03:02 +08:00
|
|
|
tep_unregister_event_handler(pevent, -1, "timer", "hrtimer_start",
|
|
|
|
timer_start_handler, NULL);
|
2014-01-16 10:31:10 +08:00
|
|
|
}
|