Move immediate.h, marker.h and tracepoint.h to include/ust/
[ust.git] / tests / hello / hello.c
CommitLineData
68c1021b
PMF
1#include <stdio.h>
2#include <unistd.h>
b6bf28ec 3#include <sys/mman.h>
9c67dc50
PMF
4#include <stdarg.h>
5#include <sys/types.h>
6#include <sys/stat.h>
7#include <fcntl.h>
4486e566 8#include <signal.h>
68c1021b 9
93d0f2ea 10#include <ust/marker.h>
474d745f 11#include "tp.h"
9c67dc50 12
59b161cd 13
8d938dbd
PMF
14void inthandler(int sig)
15{
16 printf("in handler\n");
17 exit(0);
18}
19
20int 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
5f54827b 46int main()
b6bf28ec 47{
98963de4 48 int i;
5f54827b 49
8d938dbd
PMF
50 init_int_handler();
51
68c1021b 52 printf("Hello, World!\n");
59b161cd 53
9c67dc50 54 sleep(1);
688760ef 55 for(i=0; i<50; i++) {
20b37a31
PMF
56 trace_mark(ust, bar, "str %s", "FOOBAZ");
57 trace_mark(ust, bar2, "number1 %d number2 %d", 53, 9800);
474d745f 58 trace_hello_tptest(i);
9c67dc50 59 usleep(100000);
8d938dbd 60 }
59b161cd 61
68c1021b
PMF
62 scanf("%*s");
63
688760ef
PMF
64 ltt_trace_stop("auto");
65 ltt_trace_destroy("auto");
66
67 DBG("TRACE STOPPED");
68 scanf("%*s");
69
68c1021b
PMF
70 return 0;
71}
c463904d 72
1f8b0dff
PMF
73MARKER_LIB;
74TRACEPOINT_LIB;
This page took 0.025818 seconds and 4 git commands to generate.