Cleanup: modinfo keys
[lttng-modules.git] / tests / clock-plugin / lttng-clock-plugin-test.c
1 /*
2 * lttng-clock-plugin-test.c
3 *
4 * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #include <linux/module.h>
22 #include <linux/ktime.h>
23 #include <linux/hrtimer.h>
24 #include <linux/time.h>
25
26 #include <lttng-tracer.h>
27 #include <lttng-clock.h> /* From lttng-modules */
28
29 static u64 trace_clock_read64_example(void)
30 {
31 /* Freeze time. */
32 return 0;
33 }
34
35 static u64 trace_clock_freq_example(void)
36 {
37 return 1000; /* 1KHz */
38 }
39
40 static int trace_clock_uuid_example(char *uuid)
41 {
42 const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
43 memcpy(uuid, myuuid, LTTNG_MODULES_UUID_STR_LEN);
44 return 0;
45 }
46
47 static const char *trace_clock_name_example(void)
48 {
49 return "lttng_test_clock_override";
50 }
51
52 static const char *trace_clock_description_example(void)
53 {
54 return "Freeze time with 1KHz for regression test";
55 }
56
57 static
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,
64 };
65
66 static __init
67 int lttng_clock_plugin_init(void)
68 {
69 return lttng_clock_register_plugin(&ltc, THIS_MODULE);
70 }
71 fs_initcall(lttng_clock_plugin_init);
72
73 static __exit
74 void lttng_clock_plugin_exit(void)
75 {
76 lttng_clock_unregister_plugin(&ltc, THIS_MODULE);
77 }
78 module_exit(lttng_clock_plugin_exit);
79
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);
This page took 0.032341 seconds and 4 git commands to generate.