barectf_platform_linux_fs_init(): accept DS file path, not trace dir.
[barectf.git] / examples / barectf-tracepoint / barectf-tracepoint-linux-fs.h
CommitLineData
e5298fbc
PP
1#ifndef _BARECTF_TRACEPOINT_LINUX_FS
2#define _BARECTF_TRACEPOINT_LINUX_FS
3
0a7000dc
PP
4/*
5 * The MIT License (MIT)
6 *
7 * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
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
e5298fbc
PP
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) */
43static struct barectf_default_ctx *global_barectf_ctx;
44
45/* global barectf platform context */
46static struct barectf_platform_linux_fs_ctx *global_barectf_platform_ctx;
47
48/* init function for this version */
49static void init_tracing(void)
50{
51 /* initialize platform */
52 global_barectf_platform_ctx =
6412698c
PP
53 barectf_platform_linux_fs_init(512, "ctf-linux-fs/stream",
54 1, 2, 7);
e5298fbc
PP
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 */
66static 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 */
This page took 0.041795 seconds and 4 git commands to generate.