2 * Copyright (C) 2010 David Goulet <david.goulet@polymtl.ca>
3 * Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * This test is aimed at testing tracepoint *with* ust_marker :
23 * 1) tracepoint named : "ust_event"
24 * -) Probe 1 registered and recording the value 42
29 #define TRACEPOINT_CREATE_PROBES
30 #include "tracepoint_benchmark.h"
32 /* Yes, this is now internal. */
33 #include "../../../libust/type-serializer.h"
35 #define NR_EVENTS 10000000
37 void tp_probe(void *data
, unsigned int p1
);
39 DEFINE_UST_MARKER_TP(event
, ust_event
, tp_probe
, "p1 %u");
42 * Probe 1 --> ust_event
44 void tp_probe(void *data
, unsigned int p1
)
46 struct ust_marker
*marker
;
48 marker
= &GET_UST_MARKER(event
);
49 ltt_specialized_trace(marker
, data
, &p1
, sizeof(p1
), sizeof(p1
));
52 static void __attribute__((constructor
)) init()
54 __register_tracepoint(ust_event
, tp_probe
, NULL
);
57 void single_trace(unsigned int v
)
59 tracepoint(ust_event
, v
);
66 for (i
= 0; i
< NR_EVENTS
; i
++)
76 int main(int argc
, char **argv
)
84 nr_threads
= atoi(argv
[1]);
87 printf("Starting test for %d threads\n", nr_threads
);
89 tid
= malloc(sizeof(*tid
) * nr_threads
);
91 for (i
= 0; i
< nr_threads
; i
++) {
92 err
= pthread_create(&tid
[i
], NULL
, thr1
, NULL
);
97 for (i
= 0; i
< nr_threads
; i
++) {
98 err
= pthread_join(tid
[i
], &tret
);
This page took 0.047188 seconds and 4 git commands to generate.