Commit | Line | Data |
---|---|---|
842c2b97 JD |
1 | /* |
2 | * trace_handle.c | |
3 | * | |
4 | * Babeltrace Library | |
5 | * | |
6 | * Copyright 2012 EfficiOS Inc. and Linux Foundation | |
7 | * | |
8 | * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
9 | * Julien Desfossez <julien.desfossez@efficios.com> | |
10 | * | |
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: | |
17 | * | |
18 | * The above copyright notice and this permission notice shall be included in | |
19 | * all copies or substantial portions of the Software. | |
20 | */ | |
21 | ||
22 | #include <stdint.h> | |
23 | #include <stdlib.h> | |
24 | #include <babeltrace/babeltrace.h> | |
25 | #include <babeltrace/context.h> | |
26 | #include <babeltrace/trace-handle.h> | |
27 | #include <babeltrace/trace-handle-internal.h> | |
28 | ||
29 | struct bt_trace_handle *bt_trace_handle_create(struct bt_context *ctx) | |
30 | { | |
31 | struct bt_trace_handle *th; | |
32 | ||
6cba487f | 33 | th = g_new0(struct bt_trace_handle, 1); |
842c2b97 JD |
34 | th->id = ctx->last_trace_handle_id++; |
35 | return th; | |
36 | } | |
37 | ||
6cba487f MD |
38 | void bt_trace_handle_destroy(struct bt_trace_handle *th) |
39 | { | |
40 | g_free(th); | |
41 | } | |
42 | ||
43 | int bt_trace_handle_get_id(struct bt_trace_handle *th) | |
842c2b97 | 44 | { |
6cba487f | 45 | return th->id; |
842c2b97 JD |
46 | } |
47 | ||
6cba487f | 48 | const char *bt_trace_handle_get_path(struct bt_trace_handle *th) |
842c2b97 | 49 | { |
6cba487f | 50 | return th->path; |
842c2b97 JD |
51 | } |
52 | ||
53 | uint64_t bt_trace_handle_get_timestamp_begin(struct bt_trace_handle *th) | |
54 | { | |
6cba487f | 55 | return th->timestamp_begin; |
842c2b97 JD |
56 | } |
57 | ||
58 | uint64_t bt_trace_handle_get_timestamp_end(struct bt_trace_handle *th) | |
59 | { | |
6cba487f | 60 | return th->timestamp_end; |
842c2b97 | 61 | } |