X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Ftrace-handle.c;fp=lib%2Ftrace-handle.c;h=fce2397c0d2c4481bd7515db07ac004067e10f77;hp=0000000000000000000000000000000000000000;hb=842c2b97eab577484edae763770dfd1440490818;hpb=7d97fad984e6abfd809225a86983b12eab90b3bd diff --git a/lib/trace-handle.c b/lib/trace-handle.c new file mode 100644 index 00000000..fce2397c --- /dev/null +++ b/lib/trace-handle.c @@ -0,0 +1,70 @@ +/* + * trace_handle.c + * + * Babeltrace Library + * + * Copyright 2012 EfficiOS Inc. and Linux Foundation + * + * Author: Mathieu Desnoyers + * Julien Desfossez + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + */ + +#include +#include +#include +#include +#include +#include + +struct bt_trace_handle *bt_trace_handle_create(struct bt_context *ctx) +{ + struct bt_trace_handle *th; + + th = calloc(1, sizeof(struct bt_trace_handle)); + if (!th) { + perror("allocating trace_handle"); + return NULL; + } + if (!ctx) + return NULL; + + th->id = ctx->last_trace_handle_id++; + return th; +} + +void bt_trace_handle_destroy(struct bt_trace_handle *bt) +{ + if (bt) + free(bt); +} + +char *bt_trace_handle_get_path(struct bt_trace_handle *th) +{ + if (th && th->path) + return th->path; + return NULL; +} + +uint64_t bt_trace_handle_get_timestamp_begin(struct bt_trace_handle *th) +{ + if (th) + return th->timestamp_begin; + return -1ULL; +} + +uint64_t bt_trace_handle_get_timestamp_end(struct bt_trace_handle *th) +{ + if (th) + return th->timestamp_end; + return -1ULL; +}