X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=doc%2Fexamples%2Ftrigger-condition-event-matches%2Finstrumented-app.c;fp=doc%2Fexamples%2Ftrigger-condition-event-matches%2Finstrumented-app.c;h=dce6e577fef9b208c17b29cddfcf482f42f41320;hb=db45ed781368444b7072d2c59b8a80e5fa1752a8;hp=0000000000000000000000000000000000000000;hpb=188419c4eee5d623605d6c7bd797c18ae8564647;p=lttng-tools.git diff --git a/doc/examples/trigger-condition-event-matches/instrumented-app.c b/doc/examples/trigger-condition-event-matches/instrumented-app.c new file mode 100644 index 000000000..dce6e577f --- /dev/null +++ b/doc/examples/trigger-condition-event-matches/instrumented-app.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2020 Jérémie Galarneau + * + * SPDX-License-Identifier: MIT + * + */ + +#include "tracepoint-trigger-example.h" + +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + uint64_t i; + + for (i = 0; i < UINT64_MAX; i++) { + char time_str[64]; + struct timeval tv; + time_t the_time; + + gettimeofday(&tv, NULL); + the_time = tv.tv_sec; + + strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T", + localtime(&the_time)); + printf("%s.%ld - Tracing event \"trigger_example:my_event\"\n", + time_str, tv.tv_usec); + + tracepoint(trigger_example, my_event, i); + sleep(2); + } + return 0; +}