Debian Codegraph @

examples/barectf-tracepoint/barectf-tracepoint-linux-fs.h

raw
1 #ifndef _BARECTF_TRACEPOINT_LINUX_FS
2 #define _BARECTF_TRACEPOINT_LINUX_FS
3
4 /*
5 * The MIT License (MIT)
6 *
7 * Copyright (c) 2016 Philippe Proulx <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 */
27
28 #include <barectf-platform-linux-fs.h>
29
30 /*
31 * Include generated barectf header file: this contains the prefix and
32 * default stream name to be used by the tracepoint() macro.
33 */
34 #include "barectf.h"
35
36 /* define how the context is to be found by tracepoint() calls */
37 #define BARECTF_TRACEPOINT_CTX (global_barectf_ctx)
38
39 /* then include this: */
40 #include <barectf-tracepoint.h>
41
42 /* global barectf context (default stream) */
43 static struct barectf_default_ctx *global_barectf_ctx;
44
45 /* global barectf platform context */
46 static struct barectf_platform_linux_fs_ctx *global_barectf_platform_ctx;
47
48 /* init function for this version */
49 static void init_tracing(void)
50 {
51 /* initialize platform */
52 global_barectf_platform_ctx =
53 barectf_platform_linux_fs_init(512, "ctf-linux-fs/stream",
54 1, 2, 7);
55
56 if (!global_barectf_platform_ctx) {
57 fprintf(stderr, "Error: could not initialize platform\n");
58 exit(1);
59 }
60
61 global_barectf_ctx = barectf_platform_linux_fs_get_barectf_ctx(
62 global_barectf_platform_ctx);
63 }
64
65 /* finalization function for this version */
66 static void fini_tracing(void)
67 {
68 /* finalize platform */
69 barectf_platform_linux_fs_fini(global_barectf_platform_ctx);
70 }
71
72 #endif /* _BARECTF_TRACEPOINT_LINUX_FS */