ust: continue port
[ust.git] / hello / hello.c
... / ...
CommitLineData
1#include <stdio.h>
2#include <unistd.h>
3#include <sys/mman.h>
4
5#include "../libmarkers/marker.h"
6#include "usterr.h"
7#include "tracer.h"
8
9void probe(const struct marker *mdata,
10 void *probe_private, void *call_private,
11 const char *fmt, va_list *args)
12{
13 printf("In probe\n");
14}
15
16//ust// void try_map()
17//ust// {
18//ust// char *m;
19//ust//
20//ust// /* maybe add MAP_LOCKED */
21//ust// m = mmap(NULL, 4096, PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE , -1, 0);
22//ust// if(m == (char*)-1) {
23//ust// perror("mmap");
24//ust// return;
25//ust// }
26//ust//
27//ust// printf("The mapping is at %p.\n", m);
28//ust// strcpy(m, "Hello, Mapping!");
29//ust// }
30
31int main()
32{
33 int result;
34
35 init_ustrelay_transport();
36
37 char trace_name[] = "theusttrace";
38 char trace_type[] = "usttrace";
39
40 marker_probe_register("abc", "testmark", "", probe, NULL);
41 marker_probe_register("metadata", "core_marker_id", "channel %s name %s event_id %hu int #1u%zu long #1u%zu pointer #1u%zu size_t #1u%zu alignment #1u%u", probe, NULL);
42
43 result = ltt_trace_setup(trace_name);
44 if(result < 0) {
45 ERR("ltt_trace_setup failed");
46 return 1;
47 }
48
49//ust// result = ltt_trace_set_type(trace_name, trace_type);
50//ust// if(result < 0) {
51//ust// ERR("ltt_trace_set_type failed");
52//ust// return 1;
53//ust// }
54
55 result = ltt_trace_alloc(trace_name);
56 if(result < 0) {
57 ERR("ltt_trace_alloc failed");
58 return 1;
59 }
60
61// try_map();
62
63 printf("Hello, World!\n");
64
65
66 trace_mark(abc, testmark, "", MARK_NOARGS);
67
68 scanf("%*s");
69
70 return 0;
71}
This page took 0.02972 seconds and 4 git commands to generate.