[Rock-dev] Questions Regarding Typelib

Janosch Machowinski Janosch.Machowinski at dfki.de
Sat Jun 7 23:13:59 CEST 2014


Hey,
I was annoyed by the current playback speed for logdata,
which is 0.6 of realtime on my Core i7. Therefore I invested
a day to look into the pocolog cpp implementation.

Indexing and log stream alignment is a lot faster with
the C++ implementation. Opening of an index file takes
~30ms now. Stream alignment for a 3GB data set with
3 Million samples around 2 seconds.

The raw playback speed, meaning loading all data from
disc for all streams, is at 24x the speed of realtime at the
moment.

The next step would be to create a binding for pocolog_cpp
and replace the pocolog implementation with this one.

I am unsure about the Interface to the ruby part though.
My first Idea was to do the unpacking of the types in Cpp
and only give out packed types, if they do not match the
local types. In general I don't really like to give out packed
types in the same way as unpacked ones.

Anyway, giving out unpacked types, seems not to work,
as one needs the RTT typesystem for unpacking (if I
understood the code right...)
How would I create a packed typelib::Value on the C++
side ?

> Yes. You must create a big enough buffer (use type.size() to know how 
> big) and initialize it with Typelib::init()
How does Typelib::init work ? I didn't find code that would set up the 
virtual table
or the code segment...

Greetings
     Janosch

Am 07.06.2014 16:29, schrieb Sylvain Joyeux:
> On Thu, Jun 5, 2014 at 1:05 PM, Janosch Machowinski 
> <Janosch.Machowinski at dfki.de <mailto:Janosch.Machowinski at dfki.de>> wrote:
>
>     It loads a type description, either from the installed TLB files,
>     or from a log stream. From this a Typelib::Type is generated.
>
> Not exactly. TLB files represent a registry, i.e. a self-consistent 
> set of types (Pocolog streams simply embed a XML document that is in 
> the same format than the .tlb files). What you therefore get from the 
> XML description is a Typelib::Registry object out of which you can 
> query for the Typelib::Type object(s) that describe your type.
>
>     To store or load a type, one needs to create a Typelib::Value
>     A typlib value is a unpacked version of the Type, plus the type
>     description
>
> You store and load a value, not a type. Types describe values.
>
> A value is a typed pointer, i.e. a pointer to memory with the 
> Typelib::Type object that describes the binary layout of said memory.
>
>     Here is my first question, how can I load non POD types. I suppose,
>     I must supply a preinitialized type as target Pointer ?
>
>     Is there a way of doing this anonymously ?
>
> Yes. You must create a big enough buffer (use type.size() to know how 
> big) and initialize it with Typelib::init()

>
>     How do I check (in c++) if the local type and the stream type are
>     the same ?
>     I suppose I load the system tlb and check it against the stream
>     tlb, is
>     there
>     already a function for this ?
>
> For you application; type.isSame(*other_type) will do the trick. Do 
> NOT use == unless you know the two types are within the same registry. 
> Another way is to merge the two registries. It will fail if some types 
> are found with same name and different definitions (thus ensuring that 
> all the types are the same)
>
> Warning: there is no such thing as a 'system tlb'. TLBs are saved 
> per-orogen component to make sure that it indeed describes the types 
> that the component uses (very important in case of partial rebuilds 
> after a type change)
>
> Sylvain



More information about the Rock-dev mailing list