X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Fcompile%2Ftest-app-ctx%2Fhello.c;h=da347714d5d8fc68906bc38ebcc75ca1406bf9e2;hb=74c3f8e27f5b750b71136ce1737972c28f288540;hp=d1cbca4c35a280dae29a61e68adcf44261afa263;hpb=dc325c1d762bbbdc1866e590f4649078f8600664;p=lttng-ust.git diff --git a/tests/compile/test-app-ctx/hello.c b/tests/compile/test-app-ctx/hello.c index d1cbca4c..da347714 100644 --- a/tests/compile/test-app-ctx/hello.c +++ b/tests/compile/test-app-ctx/hello.c @@ -35,6 +35,7 @@ struct mmsghdr; static __thread unsigned int test_count; +static void test_inc_count(void) { test_count++; @@ -109,8 +110,7 @@ void test_record(struct lttng_ust_ctx_field *field, int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES; char sel_char = (char) sel; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(char)); - lttng_chan_buf->ops->event_write(ctx, &sel_char, sizeof(sel_char)); + lttng_chan_buf->ops->event_write(ctx, &sel_char, sizeof(sel_char), lttng_ust_rb_alignof(char)); switch (sel) { case LTTNG_UST_DYNAMIC_TYPE_NONE: break; @@ -118,86 +118,76 @@ void test_record(struct lttng_ust_ctx_field *field, { int8_t v = -8; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S16: { int16_t v = -16; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S32: { int32_t v = -32; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_S64: { int64_t v = -64; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U8: { uint8_t v = 8; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U16: { uint16_t v = 16; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U32: { uint32_t v = 32; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_U64: { uint64_t v = 64; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(v)); - lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v)); + lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v), lttng_ust_rb_alignof(v)); break; } case LTTNG_UST_DYNAMIC_TYPE_FLOAT: { float f = 22322.0; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(f)); - lttng_chan_buf->ops->event_write(ctx, &f, sizeof(f)); + lttng_chan_buf->ops->event_write(ctx, &f, sizeof(f), lttng_ust_rb_alignof(f)); break; } case LTTNG_UST_DYNAMIC_TYPE_DOUBLE: { double d = 2.0; - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(d)); - lttng_chan_buf->ops->event_write(ctx, &d, sizeof(d)); + lttng_chan_buf->ops->event_write(ctx, &d, sizeof(d), lttng_ust_rb_alignof(d)); break; } case LTTNG_UST_DYNAMIC_TYPE_STRING: { const char *str = "teststr"; - lttng_chan_buf->ops->event_write(ctx, str, strlen(str) + 1); + lttng_chan_buf->ops->event_write(ctx, str, strlen(str) + 1, 1); break; } default: @@ -253,20 +243,23 @@ void test_get_value(struct lttng_ust_ctx_field *field, } } +static char myprovider_name[] = "$app.myprovider"; struct lttng_ust_context_provider myprovider = { .struct_size = sizeof(struct lttng_ust_context_provider), - .name = "$app.myprovider", + .name = myprovider_name, .get_size = test_get_size, .record = test_record, .get_value = test_get_value, }; +static void inthandler(int sig) { printf("in SIGUSR1 handler\n"); tracepoint(ust_tests_hello, tptest_sighandler); } +static int init_int_handler(void) { int result; @@ -294,8 +287,6 @@ int init_int_handler(void) return 0; } -void test_inc_count(void); - int main(int argc, char **argv) { int i, netint;