Project

General

Profile

Actions

Feature #508

open

arrays of floats are stored and/or displayed as arrays of ints

Added by Sébastien Barthélémy over 11 years ago. Updated almost 3 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
Start date:
04/19/2013
Due date:
% Done:

0%

Estimated time:

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

0001-test-array-of-floats-in-hello.cxx.patch (1.91 KB) 0001-test-array-of-floats-in-hello.cxx.patch Sébastien Barthélémy, 04/19/2013 04:33 PM
metadata (4 KB) metadata Sébastien Barthélémy, 04/19/2013 05:01 PM
Actions #1

Updated by Mathieu Desnoyers over 11 years ago

  • Description updated (diff)
  • Status changed from New to Feedback

please upload your metadata file.

Thanks,

Mathieu

Actions #2

Updated by Sébastien Barthélémy over 11 years ago

Mathieu Desnoyers wrote:

please upload your metadata file.

here it is.

Actions #3

Updated by Mathieu Desnoyers over 11 years ago

integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _floatarrfield[3];

wrong type declared by UST.
Actions #4

Updated by Mathieu Desnoyers over 11 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 ?

Actions #5

Updated by Sébastien Barthélémy over 11 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)
Actions #6

Updated by Mathieu Desnoyers over 11 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.

Actions #7

Updated by Mathieu Desnoyers over 11 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.

Actions #8

Updated by Sébastien Barthélémy over 11 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)

Actions #9

Updated by Mathieu Desnoyers over 11 years ago

  • Tracker changed from Bug to Feature
Actions #10

Updated by Michael Jeanson almost 3 years ago

  • Target version set to Wishlist
Actions

Also available in: Atom PDF