Tracepoint API namespacing 'TRACEPOINT_DEFINE'
[lttng-ust.git] / tests / compile / test-app-ctx / hello.c
index da347714d5d8fc68906bc38ebcc75ca1406bf9e2..723f179f4809c9e8d13d8f1718eb1650ee4583ae 100644 (file)
@@ -25,13 +25,13 @@ struct mmsghdr;
 #include <stdlib.h>
 #include <stdbool.h>
 
-#define TRACEPOINT_DEFINE
+#define LTTNG_UST_TRACEPOINT_DEFINE
 #include "ust_tests_hello.h"
 
 #include <lttng/ust-events.h>
-#include <lttng/ringbuffer-context.h>
+#include <lttng/ust-ringbuffer-context.h>
 /* Internal header. */
-#include <ust-context-provider.h>
+#include <common/ust-context-provider.h>
 
 static __thread unsigned int test_count;
 
@@ -42,54 +42,54 @@ void test_inc_count(void)
 }
 
 static
-size_t test_get_size(struct lttng_ust_ctx_field *field, size_t offset)
+size_t test_get_size(void *priv __attribute__((unused)), size_t offset)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
        size_t size = 0;
 
-       size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(char));
+       size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(char));
        size += sizeof(char);           /* tag */
        switch (sel) {
        case LTTNG_UST_DYNAMIC_TYPE_NONE:
                break;
        case LTTNG_UST_DYNAMIC_TYPE_S8:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int8_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int8_t));
                size += sizeof(int8_t);         /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_S16:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int16_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int16_t));
                size += sizeof(int16_t);        /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_S32:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int32_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int32_t));
                size += sizeof(int32_t);        /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_S64:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int64_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int64_t));
                size += sizeof(int64_t);        /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U8:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint8_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint8_t));
                size += sizeof(uint8_t);                /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U16:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint16_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint16_t));
                size += sizeof(uint16_t);       /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U32:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t));
                size += sizeof(uint32_t);       /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_U64:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t));
                size += sizeof(uint64_t);       /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_FLOAT:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(float));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(float));
                size += sizeof(float);          /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
-               size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(double));
+               size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(double));
                size += sizeof(double);         /* variant */
                break;
        case LTTNG_UST_DYNAMIC_TYPE_STRING:
@@ -103,8 +103,8 @@ size_t test_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 }
 
 static
-void test_record(struct lttng_ust_ctx_field *field,
-                struct lttng_ust_lib_ring_buffer_ctx *ctx,
+void test_record(void *priv __attribute__((unused)),
+                struct lttng_ust_ring_buffer_ctx *ctx,
                 struct lttng_ust_channel_buffer *lttng_chan_buf)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
@@ -196,7 +196,7 @@ void test_record(struct lttng_ust_ctx_field *field,
 }
 
 static
-void test_get_value(struct lttng_ust_ctx_field *field,
+void test_get_value(void *priv __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
@@ -253,10 +253,10 @@ struct lttng_ust_context_provider myprovider = {
 };
 
 static
-void inthandler(int sig)
+void inthandler(int sig __attribute__((unused)))
 {
        printf("in SIGUSR1 handler\n");
-       tracepoint(ust_tests_hello, tptest_sighandler);
+       lttng_ust_tracepoint(ust_tests_hello, tptest_sighandler);
 }
 
 static
@@ -289,6 +289,7 @@ int init_int_handler(void)
 
 int main(int argc, char **argv)
 {
+       struct lttng_ust_registered_context_provider *reg_provider;
        int i, netint;
        long values[] = { 1, 2, 3 };
        char text[10] = "test";
@@ -302,7 +303,8 @@ int main(int argc, char **argv)
        if (argc == 2)
                delay = atoi(argv[1]);
 
-       if (lttng_ust_context_provider_register(&myprovider))
+       reg_provider = lttng_ust_context_provider_register(&myprovider);
+       if (!reg_provider)
                abort();
 
        fprintf(stderr, "Hello, World!\n");
@@ -312,12 +314,12 @@ int main(int argc, char **argv)
        fprintf(stderr, "Tracing... ");
        for (i = 0; i < 1000000; i++) {
                netint = htonl(i);
-               tracepoint(ust_tests_hello, tptest, i, netint, values,
+               lttng_ust_tracepoint(ust_tests_hello, tptest, i, netint, values,
                           text, strlen(text), dbl, flt, mybool);
                test_inc_count();
                //usleep(100000);
        }
-       lttng_ust_context_provider_unregister(&myprovider);
+       lttng_ust_context_provider_unregister(reg_provider);
        fprintf(stderr, " done.\n");
        return 0;
 }
This page took 0.025195 seconds and 4 git commands to generate.