1c97db939e9a5740846e9015c6be74d098ea77b6
5 #include "../libmarkers/marker.h"
8 #include "marker-control.h"
10 void probe(const struct marker
*mdata
,
11 void *probe_private
, void *call_private
,
12 const char *fmt
, va_list *args
)
17 //ust// void try_map()
21 //ust// /* maybe add MAP_LOCKED */
22 //ust// m = mmap(NULL, 4096, PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE , -1, 0);
23 //ust// if(m == (char*)-1) {
24 //ust// perror("mmap");
28 //ust// printf("The mapping is at %p.\n", m);
29 //ust// strcpy(m, "Hello, Mapping!");
32 //sig_atomic_t must_quit;
34 void inthandler(int sig
)
36 printf("in handler\n");
40 int init_int_handler(void)
45 result
= sigemptyset(&act
.sa_mask
);
47 PERROR("sigemptyset");
51 act
.sa_handler
= inthandler
;
52 act
.sa_flags
= SA_RESTART
;
54 /* Only defer ourselves. Also, try to restart interrupted
55 * syscalls to disturb the traced program as little as possible.
57 result
= sigaction(SIGINT
, &act
, NULL
);
66 //ust// DEFINE_MUTEX(probes_mutex);
68 //ust// static LIST_HEAD(probes_registered_list);
70 //ust// int ltt_marker_connect(const char *channel, const char *mname,
71 //ust// const char *pname)
75 //ust// struct ltt_active_marker *pdata;
76 //ust// struct ltt_available_probe *probe;
78 //ust// ltt_lock_traces();
79 //ust// mutex_lock(&probes_mutex);
80 //ust// probe = get_probe_from_name(pname);
82 //ust// ret = -ENOENT;
85 //ust// pdata = marker_get_private_data(channel, mname, probe->probe_func, 0);
86 //ust// if (pdata && !IS_ERR(pdata)) {
87 //ust// ret = -EEXIST;
90 //ust// pdata = kmem_cache_zalloc(markers_loaded_cachep, GFP_KERNEL);
92 //ust// ret = -ENOMEM;
95 //ust// pdata->probe = probe;
97 //ust// * ID has priority over channel in case of conflict.
99 //ust// ret = marker_probe_register(channel, mname, NULL,
100 //ust// probe->probe_func, pdata);
102 //ust// kmem_cache_free(markers_loaded_cachep, pdata);
104 //ust// list_add(&pdata->node, &markers_loaded_list);
106 //ust// mutex_unlock(&probes_mutex);
107 //ust// ltt_unlock_traces();
112 //ust// int ltt_probe_register(struct ltt_available_probe *pdata)
115 //ust// int comparison;
116 //ust// struct ltt_available_probe *iter;
118 //ust// mutex_lock(&probes_mutex);
119 //ust// list_for_each_entry_reverse(iter, &probes_registered_list, node) {
120 //ust// comparison = strcmp(pdata->name, iter->name);
121 //ust// if (!comparison) {
122 //ust// ret = -EBUSY;
124 //ust// } else if (comparison > 0) {
125 //ust// /* We belong to the location right after iter. */
126 //ust// list_add(&pdata->node, &iter->node);
130 //ust// /* Should be added at the head of the list */
131 //ust// list_add(&pdata->node, &probes_registered_list);
133 //ust// mutex_unlock(&probes_mutex);
138 //ust// struct ltt_available_probe default_probe = {
139 //ust// .name = "default",
140 //ust// .format = NULL,
141 //ust// .probe_func = ltt_vtrace,
142 //ust// .callbacks[0] = ltt_serialize_data,
151 init_ustrelay_transport();
153 printf("page size is %d\n", sysconf(_SC_PAGE_SIZE
));
155 char trace_name
[] = "theusttrace";
156 char trace_type
[] = "ustrelay";
158 marker_control_init();
160 marker_probe_register("abc", "testmark", "", probe
, NULL
);
161 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
);
162 //ust// result = ltt_probe_register(&default_probe);
164 //ust// ERR("ltt_probe_register");
166 result
= ltt_marker_connect("abc", "testmark2", "default");
168 ERR("ltt_marker_connect");
171 result
= ltt_trace_setup(trace_name
);
173 ERR("ltt_trace_setup failed");
177 result
= ltt_trace_set_type(trace_name
, trace_type
);
179 ERR("ltt_trace_set_type failed");
183 result
= ltt_trace_alloc(trace_name
);
185 ERR("ltt_trace_alloc failed");
189 result
= ltt_trace_start(trace_name
);
191 ERR("ltt_trace_start failed");
196 printf("Hello, World!\n");
199 trace_mark(abc
, testmark
, "", MARK_NOARGS
);
200 trace_mark(abc
, testmark2
, "", MARK_NOARGS
);
This page took 0.039807 seconds and 3 git commands to generate.