in progress...
[lttv.git] / markers-userspace / marker-lib.c
1
2 #include "marker.h"
3 #include <stdio.h>
4 #include <errno.h>
5
6 extern struct marker __start___markers[];
7 extern struct marker __stop___markers[];
8
9 /**
10 * __mark_empty_function - Empty probe callback
11 * @probe_private: probe private data
12 * @call_private: call site private data
13 * @fmt: format string
14 * @...: variable argument list
15 *
16 * Empty callback provided as a probe to the markers. By providing this to a
17 * disabled marker, we make sure the execution flow is always valid even
18 * though the function pointer change and the marker enabling are two distinct
19 * operations that modifies the execution flow of preemptible code.
20 */
21 void __mark_empty_function(void *probe_private, void *call_private,
22 const char *fmt, va_list *args)
23 {
24 }
25
26 /*
27 * marker_probe_cb Callback that prepares the variable argument list for probes.
28 * @mdata: pointer of type struct marker
29 * @call_private: caller site private data
30 * @fmt: format string
31 * @...: Variable argument list.
32 *
33 */
34 void marker_probe_cb(const struct marker *mdata, void *call_private,
35 const char *fmt, ...)
36 {
37 static unsigned int count = 0;
38
39 printf("Test probe function %u\n", count++);
40 }
41
42 __attribute__((constructor)) void marker_init(void)
43 {
44 struct marker *iter;
45 int ret;
46
47 printf("Marker section : from %p to %p\n",
48 __start___markers, __stop___markers);
49 ret = sys_marker(__start___markers, __stop___markers);
50 if (ret)
51 perror("Error connecting markers");
52 for (iter = __start___markers; iter < __stop___markers; iter++) {
53 printf("Marker : %s\n", iter->name);
54 }
55 }
This page took 0.030489 seconds and 5 git commands to generate.