+void print_fields(struct bt_ctf_event *event)
+{
+ unsigned int cnt, i;
+ const struct definition *const * list;
+ const struct definition *scope;
+ enum ctf_type_id type;
+ const char *str;
+
+ scope = bt_ctf_get_top_level_scope(event, BT_EVENT_FIELDS);
+
+ bt_ctf_get_field_list(event, scope, &list, &cnt);
+ for (i = 0; i < cnt; i++) {
+ if (i != 0)
+ printf(", ");
+ printf("%s = ", bt_ctf_field_name(list[i]));
+ type = bt_ctf_field_type(list[i]);
+ if (type == CTF_TYPE_INTEGER) {
+ if (bt_ctf_get_int_signedness(list[i]) == 0)
+ printf("%" PRIu64 "", bt_ctf_get_uint64(list[i]));
+ else
+ printf("%" PRId64 "", bt_ctf_get_int64(list[i]));
+ } else if (type == CTF_TYPE_STRING) {
+ printf("%s", bt_ctf_get_string(list[i]));
+ } else if (type == CTF_TYPE_ARRAY) {
+ str = bt_ctf_get_char_array(list[i]);
+ if (str)
+ printf("%s", str);
+ }
+ }
+}
+