5f05e225641610960346a80773f57f55862d9bdc
[lttng-ust.git] / 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
9 #include "../libmarkers/marker.h"
10 #include "usterr.h"
11 #include "tracer.h"
12 #include "marker-control.h"
13 #include "relay.h"
14 #include "tp.h"
15
16
17 void probe(const struct marker *mdata,
18 void *probe_private, void *call_private,
19 const char *fmt, va_list *args)
20 {
21 printf("In probe\n");
22 }
23
24 void inthandler(int sig)
25 {
26 printf("in handler\n");
27 exit(0);
28 }
29
30 int init_int_handler(void)
31 {
32 int result;
33 struct sigaction act;
34
35 result = sigemptyset(&act.sa_mask);
36 if(result == -1) {
37 PERROR("sigemptyset");
38 return -1;
39 }
40
41 act.sa_handler = inthandler;
42 act.sa_flags = SA_RESTART;
43
44 /* Only defer ourselves. Also, try to restart interrupted
45 * syscalls to disturb the traced program as little as possible.
46 */
47 result = sigaction(SIGINT, &act, NULL);
48 if(result == -1) {
49 PERROR("sigaction");
50 return -1;
51 }
52
53 return 0;
54 }
55
56 int main()
57 {
58 int result;
59 int i;
60
61 init_int_handler();
62
63 printf("Hello, World!\n");
64
65 sleep(1);
66 for(i=0; i<50; i++) {
67 trace_mark(ust, bar, "str %s", "FOOBAZ");
68 trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
69 trace_hello_tptest(i);
70 usleep(100000);
71 }
72
73 scanf("%*s");
74
75 ltt_trace_stop("auto");
76 ltt_trace_destroy("auto");
77
78 DBG("TRACE STOPPED");
79 scanf("%*s");
80
81 return 0;
82 }
83
84 MARKER_LIB
85 TRACEPOINT_LIB
This page took 0.032723 seconds and 3 git commands to generate.