X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Fclock-snapshot.c;h=cb45d56e0aacdc28d8844036c6a18ed3ae643f73;hb=426de3806a9e0aae838d69bcc8e26762dd33c788;hp=9d20c9c1a0ff69e7b4e378702155224bc8d509e7;hpb=43c59509042845f8d42c3e99ec74d45fa2dc0908;p=babeltrace.git diff --git a/src/lib/trace-ir/clock-snapshot.c b/src/lib/trace-ir/clock-snapshot.c index 9d20c9c1..cb45d56e 100644 --- a/src/lib/trace-ir/clock-snapshot.c +++ b/src/lib/trace-ir/clock-snapshot.c @@ -1,42 +1,23 @@ /* - * Copyright 2017-2018 Philippe Proulx - * - * 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: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright 2017-2018 Philippe Proulx */ #define BT_LOG_TAG "LIB/CLOCK-SNAPSHOT" #include "lib/logging.h" -#include "lib/assert-pre.h" -#include "common/uuid.h" +#include "lib/assert-cond.h" #include "clock-class.h" #include "clock-snapshot.h" #include #include "compat/compiler.h" #include #include "compat/string.h" -#include #include "lib/object.h" #include "common/assert.h" #include "lib/func-status.h" -BT_HIDDEN void bt_clock_snapshot_destroy(struct bt_clock_snapshot *clock_snapshot) { BT_ASSERT(clock_snapshot); @@ -45,7 +26,6 @@ void bt_clock_snapshot_destroy(struct bt_clock_snapshot *clock_snapshot) g_free(clock_snapshot); } -BT_HIDDEN struct bt_clock_snapshot *bt_clock_snapshot_new( struct bt_clock_class *clock_class) { @@ -71,7 +51,6 @@ end: return ret; } -BT_HIDDEN struct bt_clock_snapshot *bt_clock_snapshot_create( struct bt_clock_class *clock_class) { @@ -95,7 +74,6 @@ end: return clock_snapshot; } -BT_HIDDEN void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot) { struct bt_clock_class *clock_class; @@ -133,15 +111,16 @@ void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot) bt_object_put_ref(clock_class); } +BT_EXPORT uint64_t bt_clock_snapshot_get_value( const struct bt_clock_snapshot *clock_snapshot) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot"); - BT_ASSERT_PRE_DEV(clock_snapshot->is_set, - "Clock snapshot is not set: %!+k", clock_snapshot); + BT_ASSERT_PRE_DEV_CS_NON_NULL(clock_snapshot); + BT_ASSERT_DBG(clock_snapshot->is_set); return clock_snapshot->value_cycles; } +BT_EXPORT enum bt_clock_snapshot_get_ns_from_origin_status bt_clock_snapshot_get_ns_from_origin( const struct bt_clock_snapshot *clock_snapshot, @@ -150,10 +129,10 @@ bt_clock_snapshot_get_ns_from_origin( int ret = BT_FUNC_STATUS_OK; BT_ASSERT_PRE_DEV_NO_ERROR(); - BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot"); - BT_ASSERT_PRE_DEV_NON_NULL(ret_value_ns, "Value (ns) (output)"); - BT_ASSERT_PRE_DEV(clock_snapshot->is_set, - "Clock snapshot is not set: %!+k", clock_snapshot); + BT_ASSERT_PRE_DEV_CS_NON_NULL(clock_snapshot); + BT_ASSERT_PRE_DEV_NON_NULL("value-ns-output", ret_value_ns, + "Value (ns) (output)"); + BT_ASSERT_DBG(clock_snapshot->is_set); if (clock_snapshot->ns_from_origin_overflows) { BT_LIB_LOGE_APPEND_CAUSE( @@ -170,9 +149,10 @@ end: return ret; } +BT_EXPORT const struct bt_clock_class *bt_clock_snapshot_borrow_clock_class_const( const struct bt_clock_snapshot *clock_snapshot) { - BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot"); + BT_ASSERT_PRE_DEV_CS_NON_NULL(clock_snapshot); return clock_snapshot->clock_class; }