X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Futils.h;h=f37d1a828d6a2d81eb5078a2431bb5630163966b;hp=d68bd54b8540f6e8482b8ac9d86da71a8163ec1d;hb=0235b0db7de5bcacdb3650c92461f2ce5eb2143d;hpb=578e048b5debf169e286e5b5cc747b5d6c16886d diff --git a/src/lib/trace-ir/utils.h b/src/lib/trace-ir/utils.h index d68bd54b..f37d1a82 100644 --- a/src/lib/trace-ir/utils.h +++ b/src/lib/trace-ir/utils.h @@ -1,30 +1,15 @@ -#ifndef BABELTRACE_TRACE_IR_UTILS_INTERNAL_H -#define BABELTRACE_TRACE_IR_UTILS_INTERNAL_H - /* - * 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 */ -#include "common/babeltrace.h" +#ifndef BABELTRACE_TRACE_IR_UTILS_INTERNAL_H +#define BABELTRACE_TRACE_IR_UTILS_INTERNAL_H + +#include "common/macros.h" #include +#include #include #include "clock-class.h" @@ -62,7 +47,7 @@ bool bt_util_get_base_offset_ns(int64_t offset_seconds, uint64_t offset_cycles, bool overflows = false; uint64_t offset_cycles_ns; - BT_ASSERT(base_offset_ns); + BT_ASSERT_DBG(base_offset_ns); /* Initialize nanosecond timestamp to clock's offset in seconds */ if (offset_seconds <= (INT64_MIN / INT64_C(1000000000) - 1) || @@ -82,10 +67,10 @@ bool bt_util_get_base_offset_ns(int64_t offset_seconds, uint64_t offset_cycles, *base_offset_ns = offset_seconds * INT64_C(1000000000); /* Add offset in cycles */ - BT_ASSERT(offset_cycles < frequency); + BT_ASSERT_DBG(offset_cycles < frequency); offset_cycles_ns = bt_util_ns_from_value(frequency, offset_cycles); - BT_ASSERT(offset_cycles_ns < 1000000000); + BT_ASSERT_DBG(offset_cycles_ns < 1000000000); *base_offset_ns += (int64_t) offset_cycles_ns; end: @@ -120,7 +105,7 @@ int bt_util_ns_from_origin_inline(int64_t base_offset_ns, } value_ns_signed = (int64_t) value_ns_unsigned; - BT_ASSERT(value_ns_signed >= 0); + BT_ASSERT_DBG(value_ns_signed >= 0); if (*ns_from_origin <= 0) { goto add_value;