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
28 #include "tracepoint_benchmark.h"
29 #include <ust/type-serializer.h>
31 #define NR_EVENTS 10000000
33 DEFINE_TRACE(ust_event
);
35 void tp_probe(void *data
, unsigned int p1
);
37 DEFINE_UST_MARKER_TP(event
, ust_event
, tp_probe
, "p1 %u");
40 * Probe 1 --> ust_event
42 void tp_probe(void *data
, unsigned int p1
)
44 struct ust_marker
*marker
;
46 marker
= &GET_UST_MARKER(event
);
47 ltt_specialized_trace(marker
, data
, &p1
, sizeof(p1
), sizeof(p1
));
50 static void __attribute__((constructor
)) init()
52 register_tracepoint(ust_event
, tp_probe
, NULL
);
55 void single_trace(unsigned int v
)
57 tracepoint(ust_event
, v
);
64 for (i
= 0; i
< NR_EVENTS
; i
++)
74 int main(int argc
, char **argv
)
82 nr_threads
= atoi(argv
[1]);
85 printf("Starting test for %d threads\n", nr_threads
);
87 tid
= malloc(sizeof(*tid
) * nr_threads
);
89 for (i
= 0; i
< nr_threads
; i
++) {
90 err
= pthread_create(&tid
[i
], NULL
, thr1
, NULL
);
95 for (i
= 0; i
< nr_threads
; i
++) {
96 err
= pthread_join(tid
[i
], &tret
);
This page took 0.031654 seconds and 4 git commands to generate.