in progress...
[lttv.git] / markers-userspace / marker-lib.c
CommitLineData
99c5a086 1
2#include "marker.h"
52204d63 3#include <stdio.h>
c604f8bf 4#include <errno.h>
52204d63 5
6extern struct marker __start___markers[];
7extern struct marker __stop___markers[];
99c5a086 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 */
21void __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 */
34void marker_probe_cb(const struct marker *mdata, void *call_private,
35 const char *fmt, ...)
36{
c604f8bf 37 static unsigned int count = 0;
99c5a086 38
c604f8bf 39 printf("Test probe function %u\n", count++);
99c5a086 40}
52204d63 41
42__attribute__((constructor)) void marker_init(void)
43{
44 struct marker *iter;
c604f8bf 45 int ret;
52204d63 46
47 printf("Marker section : from %p to %p\n",
48 __start___markers, __stop___markers);
c604f8bf 49 ret = sys_marker(__start___markers, __stop___markers);
50 if (ret)
51 perror("Error connecting markers");
52204d63 52 for (iter = __start___markers; iter < __stop___markers; iter++) {
53 printf("Marker : %s\n", iter->name);
54 }
55}
This page took 0.023993 seconds and 4 git commands to generate.