dc220c46075141063200ea856dab819f311b7579
[ust.git] / tests / hello / hello.c
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <sys/mman.h>
4 #include <stdarg.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <fcntl.h>
8 #include <signal.h>
9
10 #include <ust/marker.h>
11 #include "tp.h"
12
13
14 void inthandler(int sig)
15 {
16 printf("in handler\n");
17 exit(0);
18 }
19
20 int init_int_handler(void)
21 {
22 int result;
23 struct sigaction act;
24
25 result = sigemptyset(&act.sa_mask);
26 if(result == -1) {
27 PERROR("sigemptyset");
28 return -1;
29 }
30
31 act.sa_handler = inthandler;
32 act.sa_flags = SA_RESTART;
33
34 /* Only defer ourselves. Also, try to restart interrupted
35 * syscalls to disturb the traced program as little as possible.
36 */
37 result = sigaction(SIGINT, &act, NULL);
38 if(result == -1) {
39 PERROR("sigaction");
40 return -1;
41 }
42
43 return 0;
44 }
45
46 int main()
47 {
48 int i;
49
50 init_int_handler();
51
52 printf("Hello, World!\n");
53
54 sleep(1);
55 for(i=0; i<50; i++) {
56 trace_mark(ust, bar, "str %s", "FOOBAZ");
57 trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
58 trace_hello_tptest(i);
59 usleep(100000);
60 }
61
62 scanf("%*s");
63
64 ltt_trace_stop("auto");
65 ltt_trace_destroy("auto");
66
67 DBG("TRACE STOPPED");
68 scanf("%*s");
69
70 return 0;
71 }
72
73 MARKER_LIB;
74 TRACEPOINT_LIB;
This page took 0.029361 seconds and 3 git commands to generate.