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-tracer.h>
27 #include <lttng-clock.h> /* From lttng-modules */
29 static u64
trace_clock_read64_example(void)
35 static u64
trace_clock_freq_example(void)
37 return 1000; /* 1KHz */
40 static int trace_clock_uuid_example(char *uuid
)
42 const char myuuid
[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
43 memcpy(uuid
, myuuid
, LTTNG_MODULES_UUID_STR_LEN
);
47 static const char *trace_clock_name_example(void)
49 return "lttng_test_clock_override";
52 static const char *trace_clock_description_example(void)
54 return "Freeze time with 1KHz for regression test";
58 struct lttng_trace_clock ltc
= {
59 .read64
= trace_clock_read64_example
,
60 .freq
= trace_clock_freq_example
,
61 .uuid
= trace_clock_uuid_example
,
62 .name
= trace_clock_name_example
,
63 .description
= trace_clock_description_example
,
67 int lttng_clock_plugin_init(void)
69 return lttng_clock_register_plugin(<c
, THIS_MODULE
);
71 fs_initcall(lttng_clock_plugin_init
);
74 void lttng_clock_plugin_exit(void)
76 lttng_clock_unregister_plugin(<c
, THIS_MODULE
);
78 module_exit(lttng_clock_plugin_exit
);
80 MODULE_LICENSE("GPL and additional rights");
81 MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
82 MODULE_DESCRIPTION("LTTng Clock Plugin Example");
83 MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION
) "."
84 __stringify(LTTNG_MODULES_MINOR_VERSION
) "."
85 __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION
)
86 LTTNG_MODULES_EXTRAVERSION
);