2 * SPDX-License-Identifier: MIT
4 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
7 #ifndef BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_INTERNAL_H
8 #define BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_INTERNAL_H
10 #include "lib/object.h"
14 #include "clock-class.h"
17 struct bt_clock_class
;
19 struct bt_clock_snapshot
{
20 struct bt_object base
;
21 struct bt_clock_class
*clock_class
;
22 uint64_t value_cycles
;
23 bool ns_from_origin_overflows
;
24 int64_t ns_from_origin
;
29 void bt_clock_snapshot_set(struct bt_clock_snapshot
*clock_snapshot
)
31 BT_ASSERT_DBG(clock_snapshot
);
32 clock_snapshot
->is_set
= true;
36 void bt_clock_snapshot_reset(struct bt_clock_snapshot
*clock_snapshot
)
38 BT_ASSERT_DBG(clock_snapshot
);
39 clock_snapshot
->is_set
= false;
43 void set_ns_from_origin(struct bt_clock_snapshot
*clock_snapshot
)
45 if (bt_util_ns_from_origin_clock_class(clock_snapshot
->clock_class
,
46 clock_snapshot
->value_cycles
,
47 &clock_snapshot
->ns_from_origin
)) {
48 clock_snapshot
->ns_from_origin_overflows
= true;
53 void bt_clock_snapshot_set_raw_value(struct bt_clock_snapshot
*clock_snapshot
,
56 BT_ASSERT_DBG(clock_snapshot
);
57 clock_snapshot
->value_cycles
= cycles
;
58 set_ns_from_origin(clock_snapshot
);
59 bt_clock_snapshot_set(clock_snapshot
);
62 void bt_clock_snapshot_destroy(struct bt_clock_snapshot
*clock_snapshot
);
64 struct bt_clock_snapshot
*bt_clock_snapshot_new(struct bt_clock_class
*clock_class
);
66 struct bt_clock_snapshot
*bt_clock_snapshot_create(
67 struct bt_clock_class
*clock_class
);
69 void bt_clock_snapshot_recycle(struct bt_clock_snapshot
*clock_snapshot
);
71 #endif /* BABELTRACE_TRACE_IR_CLOCK_SNAPSHOT_INTERNAL_H */
This page took 0.032709 seconds and 4 git commands to generate.