summaryrefslogtreecommitdiff
path: root/tests/dlt-test-preregister-context.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dlt-test-preregister-context.c')
-rw-r--r--tests/dlt-test-preregister-context.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/dlt-test-preregister-context.c b/tests/dlt-test-preregister-context.c
new file mode 100644
index 0000000..ad10d6f
--- /dev/null
+++ b/tests/dlt-test-preregister-context.c
@@ -0,0 +1,32 @@
+/**
+ * Copyright (C) 2015 Intel Corporation
+ *
+ */
+
+#include <unistd.h> /* for fork() */
+
+#include "dlt.h"
+
+/**
+ * @brief sample code for using pre-registered contexts
+ */
+int main()
+{
+ DltContext mainContext;
+ DLT_REGISTER_CONTEXT(mainContext, "CTXP", "main context");
+
+ DLT_LOG(mainContext, DLT_LOG_WARN, DLT_STRING("First message before app registered"));
+ usleep(200000);
+
+ DLT_LOG(mainContext, DLT_LOG_WARN, DLT_STRING("Second message before app registered"));
+ usleep(200000);
+
+ DLT_REGISTER_APP("PRNT", "Sample pre-register application");
+
+ DLT_LOG(mainContext, DLT_LOG_WARN, DLT_STRING("First message after app registered"));
+ usleep(200000);
+
+ DLT_UNREGISTER_APP();
+
+ return 0;
+}