Re: [OE-core] [PATCH] lttng: babeltrace: Fix negative clock offset
Hi, This patch breaks the API of stable-1.5. It is clearly mentioned in the commit message: It introduces API-breaking changes in the C and Python APIs, since we need to be able to return negative time values, which were previously used as errors (-1ULL). You can have it in your layer but it should never be upstreamed to yocto/oe in any case for the stable 1.5 branch of babeltrace. The change you are referencing (61cf588beae752e5ddfc60b6b5310f769ac9e852) is queued to be in Babeltrace 2.0.0. Richard: as part of the lttng/babeltrace team I advice against using this patch in OE. Cheers - Original Message - > From: "zhe he" > To: "openembedded-core" > Sent: Monday, September 2, 2019 11:09:24 PM > Subject: [OE-core] [PATCH] lttng: babeltrace: Fix negative clock offset > From: He Zhe > > Backport a patch to fix negative clock offset with the following errors, when > when using lttng to view traces. > [error] ctf_clock_declaration_visit: unexpected unary expression for clock > offset > [error] ctf_visitor_construct_metadata: clock declaration error > [error] Error in CTF metadata constructor -22 > > Signed-off-by: He Zhe > --- > meta/recipes-kernel/lttng/babeltrace_1.5.7.bb | 4 +- > ...andle-negative-time-and-offset-from-Epoch.patch | 853 + > 2 files changed, 856 insertions(+), 1 deletion(-) > create mode 100644 > meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch > > diff --git a/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb > b/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb > index 05ef6d0..4b9343d 100644 > --- a/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb > +++ b/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb > @@ -7,7 +7,9 @@ LIC_FILES_CHKSUM = > "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa" > > DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" > > -SRC_URI = > "git://git.linuxfoundation.org/diamon/babeltrace.git;branch=stable-1.5" > +SRC_URI = > "git://git.linuxfoundation.org/diamon/babeltrace.git;branch=stable-1.5 \ > + file://0001-Handle-negative-time-and-offset-from-Epoch.patch \ > + " > SRCREV = "d4014aeef4b89a4aaab1af42d7b0d143d62da0ff" > UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+(\.\d+)+)$" > > diff --git > a/meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch > b/meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch > new file mode 100644 > index 000..f93fea7 > --- /dev/null > +++ > b/meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch > @@ -0,0 +1,853 @@ > +From d6480f9dc6a6f6536da6c3df59006ba67ef0f622 Mon Sep 17 00:00:00 2001 > +From: Mathieu Desnoyers > +Date: Wed, 14 Aug 2019 13:24:31 +0800 > +Subject: [PATCH] Handle negative time and offset from Epoch > + > +Handle cases where a trace have a negative offset from Epoch. > +If Epoch is arbitrary (e.g. embedded system starting at 0, without any > +network access), the "0" can be used as correlation point between > +various components, and some components could start before the > +correlation point. Therefore, especially in traces where the time is > +meant to be shown in nanoseconds or cycles from the correlation point, > +it also makes sense to have a negative time value. > + > +It introduces API-breaking changes in the C and Python APIs, since we > +need to be able to return negative time values, which were previously > +used as errors (-1ULL). > + > +The --offset and --offset-ns command line parameters can now take > +negative offset (seconds and nanoseconds) values too. > + > +The [sec.ns] format is used as fallback so we don't attempt to pass > +a negative time value to POSIX time-formatting APIs. > + > +This also fixes an inaccurate return value in an error path of > +bt_ctf_event_populate_event_header(). > + > +Signed-off-by: Mathieu Desnoyers > + > +Upstream-Status: Backport[61cf588beae752e5ddfc60b6b5310f769ac9e852] > + > +Signed-off-by: He Zhe > +--- > + converter/babeltrace.c | 4 +- > + formats/ctf-text/ctf-text.c| 2 +- > + formats/ctf/ctf.c | 115 > +++-- > + formats/ctf/events-private.h | 11 +- > + formats/ctf/events.c | 11 +- > + .../ctf/metadata/ctf-visitor-generate-io-struct.c | 2 +- > + include/babeltrace/babeltrace-internal.h | 8 +- > + include/babeltrace/clock-internal.h| 2 +- > + include/babeltrace/ctf-ir/clock-inter
Re: [OE-core] [PATCH] lttng: babeltrace: Fix negative clock offset
On Tue, 2019-09-03 at 16:53 -0400, Jonathan Rajotte-Julien wrote: > Hi, > > This patch breaks the API of stable-1.5. It is clearly mentioned in > the commit message: > > It introduces API-breaking changes in the C and Python APIs, since > we > need to be able to return negative time values, which were > previously > used as errors (-1ULL). > > You can have it in your layer but it should never be upstreamed to > yocto/oe in any case for the stable 1.5 branch of babeltrace. > > The change you are referencing > (61cf588beae752e5ddfc60b6b5310f769ac9e852) is queued to be in > Babeltrace 2.0.0. > > Richard: as part of the lttng/babeltrace team I advice against using > this patch in OE. Thanks, it was in master-next but its now been removed locally and will propagate. I appreciate the advice. Cheers, Richard -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] lttng: babeltrace: Fix negative clock offset
From: He Zhe Backport a patch to fix negative clock offset with the following errors, when when using lttng to view traces. [error] ctf_clock_declaration_visit: unexpected unary expression for clock offset [error] ctf_visitor_construct_metadata: clock declaration error [error] Error in CTF metadata constructor -22 Signed-off-by: He Zhe --- meta/recipes-kernel/lttng/babeltrace_1.5.7.bb | 4 +- ...andle-negative-time-and-offset-from-Epoch.patch | 853 + 2 files changed, 856 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch diff --git a/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb b/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb index 05ef6d0..4b9343d 100644 --- a/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb +++ b/meta/recipes-kernel/lttng/babeltrace_1.5.7.bb @@ -7,7 +7,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=76ba15dd76a248e1dd526bca0e2125fa" DEPENDS = "glib-2.0 util-linux popt bison-native flex-native" -SRC_URI = "git://git.linuxfoundation.org/diamon/babeltrace.git;branch=stable-1.5" +SRC_URI = "git://git.linuxfoundation.org/diamon/babeltrace.git;branch=stable-1.5 \ + file://0001-Handle-negative-time-and-offset-from-Epoch.patch \ + " SRCREV = "d4014aeef4b89a4aaab1af42d7b0d143d62da0ff" UPSTREAM_CHECK_GITTAGREGEX = "v(?P\d+(\.\d+)+)$" diff --git a/meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch b/meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch new file mode 100644 index 000..f93fea7 --- /dev/null +++ b/meta/recipes-kernel/lttng/files/0001-Handle-negative-time-and-offset-from-Epoch.patch @@ -0,0 +1,853 @@ +From d6480f9dc6a6f6536da6c3df59006ba67ef0f622 Mon Sep 17 00:00:00 2001 +From: Mathieu Desnoyers +Date: Wed, 14 Aug 2019 13:24:31 +0800 +Subject: [PATCH] Handle negative time and offset from Epoch + +Handle cases where a trace have a negative offset from Epoch. +If Epoch is arbitrary (e.g. embedded system starting at 0, without any +network access), the "0" can be used as correlation point between +various components, and some components could start before the +correlation point. Therefore, especially in traces where the time is +meant to be shown in nanoseconds or cycles from the correlation point, +it also makes sense to have a negative time value. + +It introduces API-breaking changes in the C and Python APIs, since we +need to be able to return negative time values, which were previously +used as errors (-1ULL). + +The --offset and --offset-ns command line parameters can now take +negative offset (seconds and nanoseconds) values too. + +The [sec.ns] format is used as fallback so we don't attempt to pass +a negative time value to POSIX time-formatting APIs. + +This also fixes an inaccurate return value in an error path of +bt_ctf_event_populate_event_header(). + +Signed-off-by: Mathieu Desnoyers + +Upstream-Status: Backport[61cf588beae752e5ddfc60b6b5310f769ac9e852] + +Signed-off-by: He Zhe +--- + converter/babeltrace.c | 4 +- + formats/ctf-text/ctf-text.c| 2 +- + formats/ctf/ctf.c | 115 +++-- + formats/ctf/events-private.h | 11 +- + formats/ctf/events.c | 11 +- + .../ctf/metadata/ctf-visitor-generate-io-struct.c | 2 +- + include/babeltrace/babeltrace-internal.h | 8 +- + include/babeltrace/clock-internal.h| 2 +- + include/babeltrace/ctf-ir/clock-internal.h | 2 +- + include/babeltrace/ctf/events.h| 8 +- + include/babeltrace/ctf/types.h | 6 +- + include/babeltrace/format.h| 10 +- + include/babeltrace/trace-handle-internal.h | 8 +- + include/babeltrace/trace-handle.h | 25 +++-- + lib/context.c | 44 +--- + lib/trace-handle.c | 40 +++ + tests/lib/test_ctf_writer.c| 6 +- + tests/lib/test_seek.c | 26 ++--- + 18 files changed, 209 insertions(+), 121 deletions(-) + +diff --git a/converter/babeltrace.c b/converter/babeltrace.c +index ef783ed..2ac1617 100644 +--- a/converter/babeltrace.c b/converter/babeltrace.c +@@ -375,7 +375,7 @@ static int parse_options(int argc, char **argv) + goto end; + } + errno = 0; +- opt_clock_offset = strtoull(str, , 0); ++ opt_clock_offset = strtoll(str, , 0); + if (*endptr != '\0' || str == endptr || errno != 0) { + fprintf(stderr, "[error] Incorrect --clock-offset argument: %s\n", str); + ret = -EINVAL; +@@ -400,7 +400,7