X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;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;hp=0000000000000000000000000000000000000000;hb=595ed92e6d1d46347ac633315c5f711c2fc2015c;hpb=26f0c7794376456fcb5b13d4eae91c0ccf0dfe66 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; +}