Commit | Line | Data |
---|---|---|
c38914e1 MJ |
1 | // SPDX-FileCopyrightText: 2023 Advanced Micro Devices, Inc. All rights reserved. |
2 | // SPDX-FileCopyrightText: 2024 EfficiOS, Inc. | |
3 | // | |
4 | // SPDX-License-Identifier: MIT | |
74c0b9b3 OD |
5 | |
6 | #include <limits.h> | |
7 | #include <stdint.h> | |
8 | ||
9 | #include "lttng-roctx.h" | |
10 | ||
11 | static void lttng_roctxMark(const char *message) | |
12 | { | |
13 | lttng_ust_tracepoint(roctx, mark, message); | |
14 | next_roctx_core_table.roctxMarkA_fn(message); | |
15 | } | |
16 | ||
17 | static int lttng_roctxRangePush(const char *message) | |
18 | { | |
19 | int level = next_roctx_core_table.roctxRangePushA_fn(message); | |
20 | ||
21 | lttng_ust_tracepoint(roctx, range_push, message, level); | |
22 | ||
23 | return level; | |
24 | } | |
25 | ||
26 | static int lttng_roctxRangePop(void) | |
27 | { | |
28 | int level = next_roctx_core_table.roctxRangePop_fn(); | |
29 | ||
30 | lttng_ust_tracepoint(roctx, range_pop, level); | |
31 | ||
32 | return level; | |
33 | } | |
34 | ||
35 | static roctx_range_id_t lttng_roctxRangeStart(const char *message) | |
36 | { | |
37 | roctx_range_id_t id; | |
38 | ||
39 | id = next_roctx_core_table.roctxRangeStartA_fn(message); | |
40 | ||
41 | lttng_ust_tracepoint(roctx, range_start, message, id); | |
42 | ||
43 | return id; | |
44 | } | |
45 | ||
46 | static void lttng_roctxRangeStop(roctx_range_id_t id) | |
47 | { | |
48 | lttng_ust_tracepoint(roctx, range_stop, id); | |
49 | next_roctx_core_table.roctxRangeStop_fn(id); | |
50 | } | |
51 | ||
52 | static int lttng_roctxGetThreadId(roctx_thread_id_t *tid) | |
53 | { | |
54 | int ret = next_roctx_core_table.roctxGetThreadId_fn(tid); | |
55 | lttng_ust_tracepoint(roctx, get_thread_id, *tid); | |
56 | return ret; | |
57 | } | |
58 | ||
59 | static void lttng_roctx_install_wrappers(void) | |
60 | { | |
61 | lttng_roctx_core_table.roctxMarkA_fn = <tng_roctxMark; | |
62 | lttng_roctx_core_table.roctxRangePushA_fn = <tng_roctxRangePush; | |
63 | lttng_roctx_core_table.roctxRangePop_fn = <tng_roctxRangePop; | |
64 | lttng_roctx_core_table.roctxRangeStartA_fn = <tng_roctxRangeStart; | |
65 | lttng_roctx_core_table.roctxRangeStop_fn = <tng_roctxRangeStop; | |
66 | } | |
67 |