1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
3 * lttng-clock-plugin-test.c
5 * Copyright (C) 2014, 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 #include <linux/module.h>
9 #include <linux/ktime.h>
10 #include <linux/hrtimer.h>
11 #include <linux/time.h>
13 #include <lttng-tracer.h>
14 #include <lttng-clock.h> /* From lttng-modules */
16 static u64
trace_clock_read64_example(void)
22 static u64
trace_clock_freq_example(void)
24 return 1000; /* 1KHz */
27 static int trace_clock_uuid_example(char *uuid
)
29 const char myuuid
[] = "83c63deb-7aa4-48fb-abda-946f400d76e6";
30 memcpy(uuid
, myuuid
, LTTNG_MODULES_UUID_STR_LEN
);
34 static const char *trace_clock_name_example(void)
36 return "lttng_test_clock_override";
39 static const char *trace_clock_description_example(void)
41 return "Freeze time with 1KHz for regression test";
45 struct lttng_trace_clock ltc
= {
46 .read64
= trace_clock_read64_example
,
47 .freq
= trace_clock_freq_example
,
48 .uuid
= trace_clock_uuid_example
,
49 .name
= trace_clock_name_example
,
50 .description
= trace_clock_description_example
,
54 int lttng_clock_plugin_init(void)
56 return lttng_clock_register_plugin(<c
, THIS_MODULE
);
58 fs_initcall(lttng_clock_plugin_init
);
61 void lttng_clock_plugin_exit(void)
63 lttng_clock_unregister_plugin(<c
, THIS_MODULE
);
65 module_exit(lttng_clock_plugin_exit
);
67 MODULE_LICENSE("GPL and additional rights");
68 MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
69 MODULE_DESCRIPTION("LTTng Clock Plugin Example");
70 MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION
) "."
71 __stringify(LTTNG_MODULES_MINOR_VERSION
) "."
72 __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION
)
73 LTTNG_MODULES_EXTRAVERSION
);