Feature #508
openarrays of floats are stored and/or displayed as arrays of ints
0%
Description
The attached patch modifies the hello.cxx test (from lttng-ust 2.1.1) to add an array of floats argument.
as you see in the following output (babeltrace v1.0.3 with the python bindings patchs), the field floatarrfield shows ints instead of the expected floats:
$ rm -rf ~/lttng-traces/ ; lttng create && lttng enable-event -a -u && lttng start && ./run && lttng stop && lttng destroy && babeltrace ~/lttng-traces | head -n 2
Session auto-20130419-222314 created.
Traces will be written in /home/sbarthelemy/lttng-traces/auto-20130419-222314
All UST events are enabled in channel channel0
Tracing started for session auto-20130419-222314
Hello, World!
Tracing... done.
Waiting for data availability
Tracing stopped for session auto-20130419-222314
Session auto-20130419-222314 destroyed
[22:23:14.605465399] (+?.?????????) ald-0987-de:hello:30232 ust_tests_hello:tptest: { cpu_id = 5 }, { intfield = 0, intfield2 = 0x0, longfield = 0, netintfield = 0, netintfieldhex = 0x0, arrfield1 = [ [0] = 1, [1] = 2, [2] = 3 ], arrfield2 = "test", _seqfield1_length = 4, seqfield1 = [ [0] = 116, [1] = 101, [2] = 115, [3] = 116 ], _seqfield2_length = 4, seqfield2 = "test", stringfield = "test", floatfield = 2222.1, doublefield = 2.1, floatarrfield = [ [0] = 1066192077, [1] = 1074580685, [2] = 1079194419 ] }
[22:23:14.605470207] (+0.000004808) ald-0987-de:hello:30232 ust_tests_hello:tptest: { cpu_id = 5 }, { intfield = 1, intfield2 = 0x1, longfield = 1, netintfield = 1, netintfieldhex = 0x1, arrfield1 = [ [0] = 1, [1] = 2, [2] = 3 ], arrfield2 = "test", _seqfield1_length = 4, seqfield1 = [ [0] = 116, [1] = 101, [2] = 115, [3] = 116 ], _seqfield2_length = 4, seqfield2 = "test", stringfield = "test", floatfield = 2222.1, doublefield = 2.1, floatarrfield = [ [0] = 1066192077, [1] = 1074580685, [2] = 1079194419 ] }
as a workaround, the floating point value can be retrieved in python using:
In [1]: import struct
In [2]: struct.unpack('f', struct.pack('i', 1066192077))
Out[2]: (1.100000023841858,)
Files
MD Updated by Mathieu Desnoyers over 12 years ago
- Description updated (diff)
- Status changed from New to Feedback
please upload your metadata file.
Thanks,
Mathieu
SB Updated by Sébastien Barthélémy over 12 years ago
MD Updated by Mathieu Desnoyers over 12 years ago
integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _floatarrfield[3];
wrong type declared by UST.
MD Updated by Mathieu Desnoyers over 12 years ago
I don't really see how we could distinguish between float and integer at the macro level.
So we might end up having to implement a ctf_array_float() in include/lttng/ust-tracepoint-event.h.
Thoughts ?
SB Updated by Sébastien Barthélémy over 12 years ago
Mathieu Desnoyers wrote:
I don't really see how we could distinguish between float and integer at the macro level.
So we might end up having to implement a ctf_array_float() in include/lttng/ust-tracepoint-event.h.
Thoughts ?
maybe something like
#define ctf_array(type, field, var, size) ctf_array_##type(field, var, size)
MD Updated by Mathieu Desnoyers over 12 years ago
#define ctf_array(type, field, var, size) ctf_array_##type(field, var, size)
won't work, because "type" can be "unsigned long" (with space), which cannot be used in an identifier.
MD Updated by Mathieu Desnoyers over 12 years ago
would a new "ctf_array_float" be a sensible solution then ? I'm tempted to flag this bug as a feature request though.
SB Updated by Sébastien Barthélémy over 12 years ago
Mathieu Desnoyers wrote:
would a new "ctf_array_float" be a sensible solution then ?
yes adding ctf_array_float & ctf_array_double sounds sensible (and I have not better solution)
MD Updated by Mathieu Desnoyers over 12 years ago
- Tracker changed from Bug to Feature
MJ Updated by Michael Jeanson over 3 years ago
- Target version set to Wishlist