Fix: Use fs_initcall instead of rootfs_initcall
[lttng-modules.git] / tests / clock-plugin / lttng-clock-plugin-test.c
CommitLineData
db758d11
MD
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-clock.h> /* From lttng-modules */
27
28static u64 trace_clock_read64_example(void)
29{
30 /* Freeze time. */
31 return 0;
32}
33
34static u64 trace_clock_freq_example(void)
35{
36 return 1000; /* 1KHz */
37}
38
39static int trace_clock_uuid_example(char *uuid)
40{
41 const char myuuid[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
42 memcpy(uuid, myuuid, LTTNG_MODULES_UUID_STR_LEN);
43 return 0;
44}
45
46static const char *trace_clock_name_example(void)
47{
48 return "lttng_test_clock_override";
49}
50
51static const char *trace_clock_description_example(void)
52{
53 return "Freeze time with 1KHz for regression test";
54}
55
56static
57struct 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,
63};
64
65static __init
66int lttng_clock_plugin_init(void)
67{
68 return lttng_clock_register_plugin(&ltc, THIS_MODULE);
69}
de0203be 70fs_initcall(lttng_clock_plugin_init);
db758d11
MD
71
72static __exit
73void lttng_clock_plugin_exit(void)
74{
75 lttng_clock_unregister_plugin(&ltc, THIS_MODULE);
76}
77module_exit(lttng_clock_plugin_exit);
78
79MODULE_LICENSE("GPL and additional rights");
80MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
81MODULE_DESCRIPTION("LTTng Clock Plugin Example");
This page took 0.026453 seconds and 4 git commands to generate.