Dynamic type blob
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Oct 2022 16:15:18 +0000 (12:15 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Oct 2022 16:15:18 +0000 (12:15 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/side/trace.h
src/test.c
src/tracer.c

index 3b1283dce92b7a69143765f1c8205765075f19b1..6a18ec8891ade36b4ef0277ac332600ad37226b2 100644 (file)
@@ -104,6 +104,7 @@ enum side_dynamic_type {
        SIDE_DYNAMIC_TYPE_S16,
        SIDE_DYNAMIC_TYPE_S32,
        SIDE_DYNAMIC_TYPE_S64,
+       SIDE_DYNAMIC_TYPE_BLOB,
 
        SIDE_DYNAMIC_TYPE_FLOAT_BINARY16,
        SIDE_DYNAMIC_TYPE_FLOAT_BINARY32,
@@ -292,6 +293,7 @@ struct side_arg_dynamic_vec {
                int16_t side_s16;
                int32_t side_s32;
                int64_t side_s64;
+               uint8_t side_blob;
 
 #if __HAVE_FLOAT16
                _Float16 side_float_binary16;
@@ -725,6 +727,15 @@ struct side_tracer_dynamic_vla_visitor_ctx {
                        .side_s64 = (_val), \
                }, \
        }
+#define side_arg_dynamic_blob(_val, _attr) \
+       { \
+               .dynamic_type = SIDE_DYNAMIC_TYPE_BLOB, \
+               .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+               .attr = _attr, \
+               .u = { \
+                       .side_blob = (_val), \
+               }, \
+       }
 
 #define side_arg_dynamic_float_binary16(_val, _attr) \
        { \
index bfa30eecf5ac697c28d7bb528f08e3bd6fa3ffd3..0be274ce2758df3ab7a133225ec5470617842c5b 100644 (file)
@@ -1002,7 +1002,7 @@ void test_enum_bitmap(void)
 
 static uint8_t blob_fixint[] = { 0x55, 0x44, 0x33, 0x22, 0x11 };
 
-static side_define_event(my_provider_event_blob, "myprovider", "myeventblob", SIDE_LOGLEVEL_DEBUG,
+static side_define_event_variadic(my_provider_event_blob, "myprovider", "myeventblob", SIDE_LOGLEVEL_DEBUG,
        side_field_list(
                side_field_blob("blobfield", side_attr_list()),
                side_field_array("arrayblob", side_elem(side_type_blob(side_attr_list())), 3, side_attr_list()),
@@ -1018,12 +1018,26 @@ void test_blob(void)
        my_provider_event_blob.enabled = 1;
        side_event_cond(&my_provider_event_blob) {
                side_arg_define_vec(myarray, side_arg_list(side_arg_blob(1), side_arg_blob(2), side_arg_blob(3)));
-               side_event_call(&my_provider_event_blob,
+               side_arg_dynamic_define_vec(myvla,
+                       side_arg_list(
+                               side_arg_dynamic_blob(0x22, side_attr_list()),
+                               side_arg_dynamic_blob(0x33, side_attr_list()),
+                       )
+               );
+               side_event_call_variadic(&my_provider_event_blob,
                        side_arg_list(
                                side_arg_blob(0x55),
                                side_arg_array(&myarray),
                                side_arg_array_blob(blob_fixint),
                                side_arg_vla_blob(blob_fixint, SIDE_ARRAY_SIZE(blob_fixint)),
+                       ),
+                       side_arg_list(
+                               side_arg_dynamic_field("varblobfield",
+                                       side_arg_dynamic_blob(0x55, side_attr_list())
+                               ),
+                               side_arg_dynamic_field("varblobvla",
+                                       side_arg_dynamic_vla(&myvla, side_attr_list())
+                               ),
                        )
                );
        }
index 9a90de8c407a62fbddd7826aeae84c7671cd57fa..40d7fa430354c3c92fe928e53590dedb13bc730a 100644 (file)
@@ -832,6 +832,10 @@ void tracer_print_dynamic(const struct side_arg_dynamic_vec *item)
        case SIDE_DYNAMIC_TYPE_S64:
                printf("%" PRId64, item->u.side_s64);
                break;
+       case SIDE_DYNAMIC_TYPE_BLOB:
+               printf("0x%" PRIx8, item->u.side_blob);
+               break;
+
        case SIDE_DYNAMIC_TYPE_FLOAT_BINARY16:
 #if __HAVE_FLOAT16
                printf("%g", (double) item->u.side_float_binary16);
This page took 0.025415 seconds and 4 git commands to generate.