docs: Add supported versions and fix-backport policy
[lttng-tools.git] / tests / regression / ust / low-throughput / main.c
1 /*
2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #include <poll.h>
9 #include <pthread.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12
13 #define TRACEPOINT_DEFINE
14 #include "tp.h"
15
16 /*
17 * Thread recording a tracepoint every minute for 20 minutes.
18 */
19 static void *th_event_minute(void *data __attribute__((unused)))
20 {
21 int i;
22
23 /* Loop for 20 minutes */
24 for (i = 1; i < 21; i++) {
25 /* Sleep 60 seconds */
26 (void) poll(NULL, 0, 60000);
27
28 /* 20 minutes tracepoint */
29 if ((i % 20) == 0) {
30 tracepoint(tp, slow, i, "twenty");
31 }
32
33 /* 10 minutes tracepoint */
34 if ((i % 10) == 0) {
35 tracepoint(tp, slow, i, "ten");
36 }
37
38 /* 1 minute tracepoint */
39 tracepoint(tp, slow, i, "one");
40 }
41
42 return NULL;
43 }
44
45 /*
46 * main
47 */
48 int main(void)
49 {
50 int ret;
51 void *status;
52 pthread_t thread;
53
54 ret = pthread_create(&thread, NULL, th_event_minute, NULL);
55 if (ret != 0) {
56 perror("pthread_create event minute");
57 goto error;
58 }
59
60 ret = pthread_join(thread, &status);
61 if (ret != 0) {
62 perror("pthread_join");
63 goto error;
64 }
65
66 return 0;
67
68 error:
69 return 1;
70 }
This page took 0.031759 seconds and 5 git commands to generate.