From: Herman Bruyninckx via lttng-dev <lttng-dev@lists.lttng.org>
To: Kienan Stewart <kstewart@efficios.com>
Cc: lttng-dev@lists.lttng.org
Subject: Re: Problems with arrays of floats (lttng 2.13)
Date: Sat, 10 May 2025 10:14:10 +0200 (CEST) [thread overview]
Message-ID: <c25050a5-9e48-1042-5428-a33c4602fcdf@kuleuven.be> (raw)
In-Reply-To: <7078c448-41bb-4ec3-be56-cfd93ea94ce7@efficios.com>
[-- Attachment #1: Type: text/plain, Size: 4140 bytes --]
On Fri, 9 May 2025, Kienan Stewart wrote:
> Hi Herman,
>
> On 5/9/25 6:03 AM, Herman Bruyninckx via lttng-dev wrote:
>> Dear all,
>>
>> I want to trace an array of floats, but I always get bogus output at the
>> (Python) Babeltrace2 site...
>
> could you give an example of the tracepoint you have setup in your code that
> doesn't work, with the corresponding output?
Thank you for your swift reaction. Much appreaciated.
First of all, my apologies: I should have provided the required information the first time around already.
---
This is the information about the installed versions of the relevant software:
$ uname -a
Linux SET-L-ME-P22061 6.11.0-24-generic #24-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 14 18:13:56 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ lttng -V
lttng (LTTng Trace Control) 2.13.13 - Nordicité
$ babeltrace2 -V
Babeltrace 2.0.6 "Amqui"
---
---
My application code generates a trace as follows:
Tracepoint "-tp.h":
LTTNG_UST_TRACEPOINT_EVENT(
comm_activity,
range_scan,
/* Input arguments */
LTTNG_UST_TP_ARGS(
int *, distances,
),
/* Output event fields */
LTTNG_UST_TP_FIELDS(
lttng_ust_field_array(int, distances,distances,5)
)
int testmeas[5] = {1, 2, 3, 4, 5};
// double testmeas[5] = {1., 2., 3., 4., 5.};
// (one array for test with integers, one with doubles):
lttng_ust_tracepoint(comm_activity,range_scan,5,testmeas, "range_scan");
---
> Could you explain what you mean by (Python) babeltrace2 site?
This is the Python code I use to display the trace generated above:
(inspired by <https://babeltrace.org/docs/v2.0/python/bt2/examples.html>)
---
file tt.py:
import bt2
import sys
# Get the trace path from the first command-line argument.
path = sys.argv[1]
# Create a trace collection message iterator with this path.
msg_it = bt2.TraceCollectionMessageIterator(path)
# Iterate the trace messages.
for msg in msg_it:
# `bt2._EventMessageConst` is the Python type of an event message.
if type(msg) is bt2._EventMessageConst:
# An event message holds a trace event.
event = msg.event
# Only check `range_scan` events.
if event.name != 'comm_activity:range_scan':
continue
print(event.payload_field)
---
and these are the resulting traces (for int and double, respectively, and with the C and Python versions of Babeltrace):
$ babeltrace2 ~/git-repositories/communication_5c/build/test_session/
[12:19:11.381152129] (+?.?????????) SET-L-ME-P22061 comm_activity:range_scan: { cpu_id = 6 }, { distances = [ [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5 ] }
$ python3 tt.py ~/git-repositories/communication_5c/build/test_session/
{'distances': [1, 2, 3, 4, 5]}
----
bt2$ babeltrace2 ~/git-repositories/communication_5c/build/test_session/
[10:04:51.068836215] (+?.?????????) SET-L-ME-P22061 comm_activity:range_scan: { cpu_id = 6 }, { distances = [ [0] = 0, [1] = 1072693248, [2] = 0, [3] = 1073741824, [4] = 0 ] }
$ python3 tt.py ~/git-repositories/communication_5c/build/test_session/
{'distances': [0, 1072693248, 0, 1073741824, 0]}
> Are you instrumenting python code, or are you instrumenting a C/C++
> application with lttng-ust?
The latter.
>> I have no problems with arrays of integers, though.
>>
>> Is the float array feature not yet implemented in lttng 2.13?
>> Will it be in 2.14? (Also the "BLOB" feature is useful for me.)
>>
>
> I don't see any changes in lttng-ust for 2.14 that allow for tracepoints that
> have float arrays or blobs. lttng-modules 2.14 does add support for CTF 2.
> The support for CTF 2 in lttng-tools 2.14 will remain at an experimental
> level.
>
> From the release notes:
>
> CTF 2 output isn't enabled by default and is intended solely for
> preview and feedback purposes: having an experimental support will
> allow users to test and evaluate CTF 2 until we make it the
> default output format.
>
>
>> Thanks for your help.
>>
>> Herman
>
> thanks,
> kienan
Herman
> [1]:
> https://git.lttng.org/?p=lttng-tools.git;a=blob_plain;f=ChangeLog;hb=11f963148df9597de6d891d96d748bae5ced7149
>
>
next prev parent reply other threads:[~2025-05-10 8:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 10:03 Herman Bruyninckx via lttng-dev
2025-05-09 15:10 ` Kienan Stewart via lttng-dev
2025-05-10 8:14 ` Herman Bruyninckx via lttng-dev [this message]
2025-05-13 14:38 ` Kienan Stewart via lttng-dev
2025-05-13 15:40 ` Herman Bruyninckx via lttng-dev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c25050a5-9e48-1042-5428-a33c4602fcdf@kuleuven.be \
--to=lttng-dev@lists.lttng.org \
--cc=herman.bruyninckx@kuleuven.be \
--cc=kstewart@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox