From c057dea051159b06050ab5d6b640dfb7e1654ba7 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 5 Sep 2017 18:09:49 -0400 Subject: [PATCH] Split clock value API from clock class API MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- include/Makefile.am | 28 ++++----- include/babeltrace/babeltrace.h | 1 + .../babeltrace/ctf-ir/clock-class-internal.h | 8 --- .../babeltrace/ctf-ir/clock-value-internal.h | 40 +++++++++++++ include/babeltrace/ctf-ir/clock-value.h | 57 +++++++++++++++++++ lib/ctf-ir/clock-class.c | 1 + lib/ctf-ir/event.c | 2 + 7 files changed, 116 insertions(+), 21 deletions(-) create mode 100644 include/babeltrace/ctf-ir/clock-value-internal.h create mode 100644 include/babeltrace/ctf-ir/clock-value.h diff --git a/include/Makefile.am b/include/Makefile.am index cd03f56a..22c1605f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,11 +2,11 @@ babeltraceincludedir = "$(includedir)/babeltrace" babeltraceinclude_HEADERS = \ babeltrace/babeltrace.h \ - babeltrace/values.h \ - babeltrace/ref.h \ babeltrace/logging.h \ - babeltrace/version.h \ - babeltrace/types.h + babeltrace/ref.h \ + babeltrace/types.h \ + babeltrace/values.h \ + babeltrace/version.h # Legacy API (for CTF writer) babeltracectfincludedir = "$(includedir)/babeltrace/ctf" @@ -17,25 +17,26 @@ babeltracectfinclude_HEADERS = \ babeltracectfwriterincludedir = "$(includedir)/babeltrace/ctf-writer" babeltracectfwriterinclude_HEADERS = \ babeltrace/ctf-writer/clock.h \ - babeltrace/ctf-writer/writer.h \ babeltrace/ctf-writer/event-fields.h \ babeltrace/ctf-writer/event-types.h \ babeltrace/ctf-writer/event.h \ + babeltrace/ctf-writer/stream-class.h \ babeltrace/ctf-writer/stream.h \ - babeltrace/ctf-writer/stream-class.h + babeltrace/ctf-writer/writer.h # CTF IR API babeltracectfirincludedir = "$(includedir)/babeltrace/ctf-ir" babeltracectfirinclude_HEADERS = \ babeltrace/ctf-ir/clock-class.h \ - babeltrace/ctf-ir/fields.h \ - babeltrace/ctf-ir/field-types.h \ - babeltrace/ctf-ir/event.h \ + babeltrace/ctf-ir/clock-value.h \ babeltrace/ctf-ir/event-class.h \ + babeltrace/ctf-ir/event.h \ babeltrace/ctf-ir/field-path.h \ - babeltrace/ctf-ir/stream.h \ + babeltrace/ctf-ir/field-types.h \ + babeltrace/ctf-ir/fields.h \ babeltrace/ctf-ir/packet.h \ babeltrace/ctf-ir/stream-class.h \ + babeltrace/ctf-ir/stream.h \ babeltrace/ctf-ir/trace.h \ babeltrace/ctf-ir/utils.h \ babeltrace/ctf-ir/visitor.h @@ -43,8 +44,8 @@ babeltracectfirinclude_HEADERS = \ # Plugin and plugin development API babeltracepluginincludedir = "$(includedir)/babeltrace/plugin" babeltraceplugininclude_HEADERS = \ - babeltrace/plugin/plugin.h \ - babeltrace/plugin/plugin-dev.h + babeltrace/plugin/plugin-dev.h \ + babeltrace/plugin/plugin.h # Graph, component, and notification API babeltracegraphincludedir = "$(includedir)/babeltrace/graph" @@ -67,9 +68,9 @@ babeltracegraphinclude_HEADERS = \ babeltrace/graph/notification-heap.h \ babeltrace/graph/notification-inactivity.h \ babeltrace/graph/notification-iterator.h \ - babeltrace/graph/notification.h \ babeltrace/graph/notification-packet.h \ babeltrace/graph/notification-stream.h \ + babeltrace/graph/notification.h \ babeltrace/graph/output-port-notification-iterator.h \ babeltrace/graph/port.h \ babeltrace/graph/private-component-filter.h \ @@ -103,6 +104,7 @@ noinst_HEADERS = \ babeltrace/compiler-internal.h \ babeltrace/ctf-ir/attributes-internal.h \ babeltrace/ctf-ir/clock-class-internal.h \ + babeltrace/ctf-ir/clock-value-internal.h \ babeltrace/ctf-ir/event-class-internal.h \ babeltrace/ctf-ir/event-internal.h \ babeltrace/ctf-ir/field-path-internal.h \ diff --git a/include/babeltrace/babeltrace.h b/include/babeltrace/babeltrace.h index 45dac14d..f1a798df 100644 --- a/include/babeltrace/babeltrace.h +++ b/include/babeltrace/babeltrace.h @@ -46,6 +46,7 @@ /* CTF IR API */ #include +#include #include #include #include diff --git a/include/babeltrace/ctf-ir/clock-class-internal.h b/include/babeltrace/ctf-ir/clock-class-internal.h index 7f901e7e..2b4fdcf4 100644 --- a/include/babeltrace/ctf-ir/clock-class-internal.h +++ b/include/babeltrace/ctf-ir/clock-class-internal.h @@ -56,14 +56,6 @@ struct bt_ctf_clock_class { int frozen; }; -struct bt_ctf_clock_value { - struct bt_object base; - struct bt_ctf_clock_class *clock_class; - uint64_t value; - bool ns_from_epoch_overflows; - int64_t ns_from_epoch; -}; - BT_HIDDEN void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class); diff --git a/include/babeltrace/ctf-ir/clock-value-internal.h b/include/babeltrace/ctf-ir/clock-value-internal.h new file mode 100644 index 00000000..7284a35f --- /dev/null +++ b/include/babeltrace/ctf-ir/clock-value-internal.h @@ -0,0 +1,40 @@ +#ifndef BABELTRACE_CTF_IR_CLOCK_VALUE_INTERNAL_H +#define BABELTRACE_CTF_IR_CLOCK_VALUE_INTERNAL_H + +/* + * Copyright 2017 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. + */ + +#include +#include +#include + +struct bt_ctf_clock_class; + +struct bt_ctf_clock_value { + struct bt_object base; + struct bt_ctf_clock_class *clock_class; + uint64_t value; + bool ns_from_epoch_overflows; + int64_t ns_from_epoch; +}; + +#endif /* BABELTRACE_CTF_IR_CLOCK_VALUE_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/clock-value.h b/include/babeltrace/ctf-ir/clock-value.h new file mode 100644 index 00000000..e7b91a9c --- /dev/null +++ b/include/babeltrace/ctf-ir/clock-value.h @@ -0,0 +1,57 @@ +#ifndef BABELTRACE_CTF_IR_CLOCK_VALUE_H +#define BABELTRACE_CTF_IR_CLOCK_VALUE_H + +/* + * BabelTrace - CTF IR: Clock class + * + * Copyright 2013, 2014 Jérémie Galarneau + * Copyright 2017 Philippe Proulx + * + * Author: Jérémie Galarneau + * + * 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. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_ctf_clock_class; +struct bt_ctf_clock_value; + +extern struct bt_ctf_clock_value *bt_ctf_clock_value_create( + struct bt_ctf_clock_class *clock_class, uint64_t value); +extern struct bt_ctf_clock_class *bt_ctf_clock_value_get_class( + struct bt_ctf_clock_value *clock_value); +extern int bt_ctf_clock_value_get_value( + struct bt_ctf_clock_value *clock_value, uint64_t *raw_value); +extern int bt_ctf_clock_value_get_value_ns_from_epoch( + struct bt_ctf_clock_value *clock_value, int64_t *value_ns); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_CTF_IR_CLOCK_VALUE_H */ diff --git a/lib/ctf-ir/clock-class.c b/lib/ctf-ir/clock-class.c index 5ebeba5a..2dd6536a 100644 --- a/lib/ctf-ir/clock-class.c +++ b/lib/ctf-ir/clock-class.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/lib/ctf-ir/event.c b/lib/ctf-ir/event.c index cb1d9c86..62fc4328 100644 --- a/lib/ctf-ir/event.c +++ b/lib/ctf-ir/event.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include -- 2.34.1