summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a620ae1)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
+enum bt_clock_class_status {
+ BT_CLOCK_CLASS_STATUS_OK = 0,
+ BT_CLOCK_CLASS_STATUS_NOMEM = -12,
+ BT_CLOCK_CLASS_STATUS_OVERFLOW = -75,
+};
+
extern const char *bt_clock_class_get_name(
const bt_clock_class *clock_class);
extern const char *bt_clock_class_get_name(
const bt_clock_class *clock_class);
extern bt_uuid bt_clock_class_get_uuid(
const bt_clock_class *clock_class);
extern bt_uuid bt_clock_class_get_uuid(
const bt_clock_class *clock_class);
-extern int bt_clock_class_cycles_to_ns_from_origin(
+extern enum bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin(
const bt_clock_class *clock_class,
uint64_t cycles, int64_t *ns_from_origin);
const bt_clock_class *clock_class,
uint64_t cycles, int64_t *ns_from_origin);
/* For bt_bool, bt_uuid, bt_clock_class */
#include <babeltrace/types.h>
/* For bt_bool, bt_uuid, bt_clock_class */
#include <babeltrace/types.h>
+/* For enum bt_clock_class_status */
+#include <babeltrace/trace-ir/clock-class-const.h>
+
#ifdef __cplusplus
extern "C" {
#endif
extern bt_clock_class *bt_clock_class_create(void);
#ifdef __cplusplus
extern "C" {
#endif
extern bt_clock_class *bt_clock_class_create(void);
-extern int bt_clock_class_set_name(bt_clock_class *clock_class,
- const char *name);
+extern enum bt_clock_class_status bt_clock_class_set_name(
+ bt_clock_class *clock_class, const char *name);
-extern int bt_clock_class_set_description(bt_clock_class *clock_class,
- const char *description);
+extern enum bt_clock_class_status bt_clock_class_set_description(
+ bt_clock_class *clock_class, const char *description);
extern void bt_clock_class_set_frequency(bt_clock_class *clock_class,
uint64_t freq);
extern void bt_clock_class_set_frequency(bt_clock_class *clock_class,
uint64_t freq);
#include <babeltrace/assert-pre-internal.h>
#include <babeltrace/compat/uuid-internal.h>
#include <babeltrace/assert-pre-internal.h>
#include <babeltrace/compat/uuid-internal.h>
+#include <babeltrace/trace-ir/clock-class-const.h>
+#include <babeltrace/trace-ir/clock-class.h>
#include <babeltrace/trace-ir/clock-class-internal.h>
#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/utils-internal.h>
#include <babeltrace/trace-ir/clock-class-internal.h>
#include <babeltrace/trace-ir/clock-snapshot-internal.h>
#include <babeltrace/trace-ir/utils-internal.h>
return clock_class->name.value;
}
return clock_class->name.value;
}
-int bt_clock_class_set_name(struct bt_clock_class *clock_class,
- const char *name)
+enum bt_clock_class_status bt_clock_class_set_name(
+ struct bt_clock_class *clock_class, const char *name)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
g_string_assign(clock_class->name.str, name);
clock_class->name.value = clock_class->name.str->str;
BT_LIB_LOGV("Set clock class's name: %!+K", clock_class);
g_string_assign(clock_class->name.str, name);
clock_class->name.value = clock_class->name.str->str;
BT_LIB_LOGV("Set clock class's name: %!+K", clock_class);
+ return BT_CLOCK_CLASS_STATUS_OK;
}
const char *bt_clock_class_get_description(
}
const char *bt_clock_class_get_description(
return clock_class->description.value;
}
return clock_class->description.value;
}
-int bt_clock_class_set_description(struct bt_clock_class *clock_class,
- const char *descr)
+enum bt_clock_class_status bt_clock_class_set_description(
+ struct bt_clock_class *clock_class, const char *descr)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(descr, "Description");
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(descr, "Description");
clock_class->description.value = clock_class->description.str->str;
BT_LIB_LOGV("Set clock class's description: %!+K",
clock_class);
clock_class->description.value = clock_class->description.str->str;
BT_LIB_LOGV("Set clock class's description: %!+K",
clock_class);
+ return BT_CLOCK_CLASS_STATUS_OK;
}
uint64_t bt_clock_class_get_frequency(const struct bt_clock_class *clock_class)
}
uint64_t bt_clock_class_get_frequency(const struct bt_clock_class *clock_class)
((struct bt_clock_class *) clock_class)->frozen = 1;
}
((struct bt_clock_class *) clock_class)->frozen = 1;
}
-int bt_clock_class_cycles_to_ns_from_origin(
+enum bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin(
const struct bt_clock_class *clock_class,
uint64_t cycles, int64_t *ns)
{
const struct bt_clock_class *clock_class,
uint64_t cycles, int64_t *ns)
{
BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)");
ret = bt_util_ns_from_origin(clock_class, cycles, ns);
if (ret) {
BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)");
ret = bt_util_ns_from_origin(clock_class, cycles, ns);
if (ret) {
+ ret = BT_CLOCK_CLASS_STATUS_OVERFLOW;
BT_LIB_LOGW("Cannot convert cycles to nanoseconds "
"from origin for given clock class: "
"value overflows the signed 64-bit integer range: "
BT_LIB_LOGW("Cannot convert cycles to nanoseconds "
"from origin for given clock class: "
"value overflows the signed 64-bit integer range: "