SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / doc / examples / trigger-on-event / instrumented-app.c
1 /*
2 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "tracepoint-trigger-example.h"
9
10 #include <lttng/tracepoint.h>
11 #include <unistd.h>
12 #include <sys/time.h>
13 #include <time.h>
14 #include <stdio.h>
15
16 int main(int argc, char **argv)
17 {
18 uint64_t i;
19
20 for (i = 0; i < UINT64_MAX; i++) {
21 char time_str[64];
22 struct timeval tv;
23 time_t the_time;
24
25 gettimeofday(&tv, NULL);
26 the_time = tv.tv_sec;
27
28 strftime(time_str, sizeof(time_str), "[%m-%d-%Y] %T",
29 localtime(&the_time));
30 printf("%s.%ld - Tracing event \"trigger_example:my_event\"\n", time_str, tv.tv_usec);
31
32 tracepoint(trigger_example, my_event, i);
33 sleep(2);
34 }
35 return 0;
36 }
This page took 0.042586 seconds and 5 git commands to generate.