From: Philippe Proulx Date: Fri, 18 Oct 2019 17:38:44 +0000 (-0400) Subject: Remove unused `src/lib/trace-ir/clock-snapshot-set.h` X-Git-Tag: v2.0.0-rc2~61 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=51013cac66f5acd0ddbb0503a9e8d51f979f94a6 Remove unused `src/lib/trace-ir/clock-snapshot-set.h` Signed-off-by: Philippe Proulx Change-Id: I43fb1d20ef0e88748e70c034f77ce34c7eed0b8d Reviewed-on: https://review.lttng.org/c/babeltrace/+/2219 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- diff --git a/src/lib/trace-ir/Makefile.am b/src/lib/trace-ir/Makefile.am index 11e1e542..5ce62239 100644 --- a/src/lib/trace-ir/Makefile.am +++ b/src/lib/trace-ir/Makefile.am @@ -7,7 +7,6 @@ libtrace_ir_la_SOURCES = \ clock-class.h \ clock-snapshot.c \ clock-snapshot.h \ - clock-snapshot-set.h \ event.c \ event-class.c \ event-class.h \ diff --git a/src/lib/trace-ir/clock-snapshot-set.h b/src/lib/trace-ir/clock-snapshot-set.h deleted file mode 100644 index 7c3e7eb2..00000000 --- a/src/lib/trace-ir/clock-snapshot-set.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef BABELTRACE_GRAPH_CLOCK_SNAPSHOT_SET_H -#define BABELTRACE_GRAPH_CLOCK_SNAPSHOT_SET_H - -/* - * Copyright 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: - * - * 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. - */ - -/* Protection: this file uses BT_LIB_LOG*() macros directly */ -#ifndef BT_LIB_LOG_SUPPORTED -# error Please include "lib/logging.h" before including this file. -#endif - -#include -#include -#include "common/assert.h" - -#include "clock-snapshot.h" -#include "clock-class.h" - -/* Protection: this file uses BT_LIB_LOG*() macros directly */ -#ifndef BT_LIB_LOG_SUPPORTED -# error Please include "lib/logging.h" before including this file. -#endif - -struct bt_clock_snapshot_set { - /* Unique objects owned by this */ - GPtrArray *clock_snapshots; - - /* Weak; points to one of the clock snapshots above */ - struct bt_clock_snapshot *default_cs; -}; - -static inline -int bt_clock_snapshot_set_initialize(struct bt_clock_snapshot_set *cs_set) -{ - int ret = 0; - - cs_set->clock_snapshots = g_ptr_array_sized_new(1); - if (!cs_set->clock_snapshots) { - BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one GPtrArray."); - ret = -1; - goto end; - } - - cs_set->default_cs = NULL; - -end: - return ret; -} - -static inline -void bt_clock_snapshot_set_reset(struct bt_clock_snapshot_set *cs_set) -{ - uint64_t i; - - BT_ASSERT_DBG(cs_set); - BT_ASSERT_DBG(cs_set->clock_snapshots); - - for (i = 0; i < cs_set->clock_snapshots->len; i++) { - struct bt_clock_snapshot *cs = cs_set->clock_snapshots->pdata[i]; - - BT_ASSERT_DBG(cs); - bt_clock_snapshot_reset(cs); - } - - cs_set->default_cs = NULL; -} - -static inline -void bt_clock_snapshot_set_finalize(struct bt_clock_snapshot_set *cs_set) -{ - uint64_t i; - - BT_ASSERT(cs_set); - - if (cs_set->clock_snapshots) { - for (i = 0; i < cs_set->clock_snapshots->len; i++) { - struct bt_clock_snapshot *cs = - cs_set->clock_snapshots->pdata[i]; - - BT_ASSERT(cs); - bt_clock_snapshot_recycle(cs); - } - - g_ptr_array_free(cs_set->clock_snapshots, TRUE); - } - - cs_set->default_cs = NULL; -} - -static inline -int bt_clock_snapshot_set_set_clock_snapshot(struct bt_clock_snapshot_set *cs_set, - struct bt_clock_class *cc, uint64_t raw_value) -{ - int ret = 0; - struct bt_clock_snapshot *clock_snapshot = NULL; - uint64_t i; - - BT_ASSERT_DBG(cs_set); - BT_ASSERT_DBG(cc); - - /* - * Check if we already have a value for this clock class. - * - * TODO: When we have many clock classes, make this more - * efficient. - */ - for (i = 0; i < cs_set->clock_snapshots->len; i++) { - struct bt_clock_snapshot *cs = cs_set->clock_snapshots->pdata[i]; - - BT_ASSERT_DBG(cs); - - if (cs->clock_class == cc) { - clock_snapshot = cs; - break; - } - } - - if (!clock_snapshot) { - clock_snapshot = bt_clock_snapshot_create(cc); - if (!clock_snapshot) { - BT_LIB_LOGE_APPEND_CAUSE( - "Cannot create a clock snapshot from a clock class: " - "%![cc-]+K", cc); - ret = -1; - goto end; - } - - g_ptr_array_add(cs_set->clock_snapshots, clock_snapshot); - } - - bt_clock_snapshot_set_raw_value(clock_snapshot, raw_value); - -end: - return ret; -} - -static inline -void bt_clock_snapshot_set_set_default_clock_snapshot( - struct bt_clock_snapshot_set *cs_set, uint64_t raw_value) -{ - BT_ASSERT_DBG(cs_set); - BT_ASSERT_DBG(cs_set->default_cs); - bt_clock_snapshot_set_raw_value(cs_set->default_cs, raw_value); -} - -#endif /* BABELTRACE_GRAPH_CLOCK_SNAPSHOT_SET_H */