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