2 * The MIT License (MIT)
4 * Copyright (c) 2016-2020 Philippe Proulx <pproulx@efficios.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30 #include "barectf-platform-linux-fs.h"
41 static void trace_stuff(struct barectf_default_ctx
* const ctx
, const int argc
,
42 const char * const argv
[])
47 /* Record 40,000 events */
48 for (i
= 0; i
< 5000; ++i
) {
49 barectf_trace_simple_uint32(ctx
, i
* 1500);
50 barectf_trace_simple_int16(ctx
, -i
* 2);
51 barectf_trace_simple_float(ctx
, (float) i
/ 1.23);
59 barectf_trace_simple_string(ctx
, str
);
60 barectf_trace_context_no_payload(ctx
, i
, "ctx");
61 barectf_trace_simple_enum(ctx
, RUNNING
);
62 barectf_trace_a_few_fields(ctx
, -1, 301, -3.14159, str
, NEW
);
63 barectf_trace_bit_packed_integers(ctx
, 1, -1, 3, -2, 2, 7, 23,
65 barectf_trace_no_context_no_payload(ctx
);
66 barectf_trace_simple_enum(ctx
, TERMINATED
);
70 int main(const int argc
, const char * const argv
[])
72 struct barectf_platform_linux_fs_ctx
*platform_ctx
;
75 /* Initialize platform */
76 platform_ctx
= barectf_platform_linux_fs_init(512, "trace", 1, 2, 7);
80 "Error: failed to initialize Linux FS platform.\n");
85 /* Trace stuff (will create/write packets as it executes) */
86 trace_stuff(barectf_platform_linux_fs_get_barectf_ctx(platform_ctx
),
89 /* Finalize platform */
90 barectf_platform_linux_fs_fini(platform_ctx
);