6 * Copyright 2012 EfficiOS Inc. and Linux Foundation
8 * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Julien Desfossez <julien.desfossez@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 #include <babeltrace/babeltrace.h>
33 #include <babeltrace/context.h>
34 #include <babeltrace/context-internal.h>
35 #include <babeltrace/trace-handle.h>
36 #include <babeltrace/trace-handle-internal.h>
38 struct bt_trace_handle
*bt_trace_handle_create(struct bt_context
*ctx
)
40 struct bt_trace_handle
*th
;
45 th
= g_new0(struct bt_trace_handle
, 1);
46 th
->id
= ctx
->last_trace_handle_id
++;
50 void bt_trace_handle_destroy(struct bt_trace_handle
*th
)
55 const char *bt_trace_handle_get_path(struct bt_context
*ctx
, int handle_id
)
57 struct bt_trace_handle
*handle
;
62 handle
= g_hash_table_lookup(ctx
->trace_handles
,
63 (gpointer
) (unsigned long) handle_id
);
69 uint64_t bt_trace_handle_get_timestamp_begin(struct bt_context
*ctx
,
70 int handle_id
, enum bt_clock_type type
)
72 struct bt_trace_handle
*handle
;
78 handle
= g_hash_table_lookup(ctx
->trace_handles
,
79 (gpointer
) (unsigned long) handle_id
);
84 if (type
== BT_CLOCK_REAL
) {
85 ret
= handle
->real_timestamp_begin
;
86 } else if (type
== BT_CLOCK_CYCLES
) {
87 ret
= handle
->cycles_timestamp_begin
;
96 uint64_t bt_trace_handle_get_timestamp_end(struct bt_context
*ctx
,
97 int handle_id
, enum bt_clock_type type
)
99 struct bt_trace_handle
*handle
;
105 handle
= g_hash_table_lookup(ctx
->trace_handles
,
106 (gpointer
) (unsigned long) handle_id
);
111 if (type
== BT_CLOCK_REAL
) {
112 ret
= handle
->real_timestamp_end
;
113 } else if (type
== BT_CLOCK_CYCLES
) {
114 ret
= handle
->cycles_timestamp_end
;
This page took 0.036542 seconds and 4 git commands to generate.