[lttng-dev] Access metadata via libbabeltrace

Yao Qi yao at codesourcery.com
Fri Apr 18 06:07:22 EDT 2014


Hi,
I have a metadata like this:

event {
        name = "register";
        id = 0;
        fields := struct {
                ascii contents[440];
        };
};

and I can get the length of the array if I have an event,

	  const struct bt_definition *scope
	    = bt_ctf_get_top_level_scope (event,
					  BT_EVENT_FIELDS);
	  const struct bt_definition *array
	    = bt_ctf_get_field (event, scope, "contents");

	  block_size
	    = bt_ctf_get_array_len (bt_ctf_get_decl_from_def (array));

block_size is what I want.  However, how can I get the array length
without an event?  I looked into babeltrace source for a while, but
don't see any API on metadata.

-- 
Yao (齐尧)



More information about the lttng-dev mailing list