2 * lttng-clock-plugin-test.c
4 * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; only
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/module.h>
22 #include <linux/ktime.h>
23 #include <linux/hrtimer.h>
24 #include <linux/time.h>
26 #include <lttng-clock.h> /* From lttng-modules */
28 static u64
trace_clock_read64_example(void)
34 static u64
trace_clock_freq_example(void)
36 return 1000; /* 1KHz */
39 static int trace_clock_uuid_example(char *uuid
)
41 const char myuuid
[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
42 memcpy(uuid
, myuuid
, LTTNG_MODULES_UUID_STR_LEN
);
46 static const char *trace_clock_name_example(void)
48 return "lttng_test_clock_override";
51 static const char *trace_clock_description_example(void)
53 return "Freeze time with 1KHz for regression test";
57 struct lttng_trace_clock ltc
= {
58 .read64
= trace_clock_read64_example
,
59 .freq
= trace_clock_freq_example
,
60 .uuid
= trace_clock_uuid_example
,
61 .name
= trace_clock_name_example
,
62 .description
= trace_clock_description_example
,
66 int lttng_clock_plugin_init(void)
68 return lttng_clock_register_plugin(<c
, THIS_MODULE
);
70 rootfs_initcall(lttng_clock_plugin_init
);
73 void lttng_clock_plugin_exit(void)
75 lttng_clock_unregister_plugin(<c
, THIS_MODULE
);
77 module_exit(lttng_clock_plugin_exit
);
79 MODULE_LICENSE("GPL and additional rights");
80 MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
81 MODULE_DESCRIPTION("LTTng Clock Plugin Example");