X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=tests%2Ftracepoint%2Ftracepoint_test.c;h=34cdb115dd32e8bfbe88927eab7263294d5fbe8c;hb=HEAD;hp=cd3939c7b2625b72728a1c4669cc6f1b6aa6fb87;hpb=cd5de8df6ea38d5810c4abd92edf20a24179f0f5;p=lttng-ust.git diff --git a/tests/tracepoint/tracepoint_test.c b/tests/tracepoint/tracepoint_test.c deleted file mode 100644 index cd3939c7..00000000 --- a/tests/tracepoint/tracepoint_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2010 David Goulet - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * This test is aimed at testing tracepoint *with* trace_mark : - * - * 1) tracepoint named : "ust_event" - * -) Probe 1 registered and recording the value 13 (x5) - * -) Probe 2 registered and recording the value 42 (x5) - * -) Probe 3 registered and recording the payload of the struct message - * but using a *different* tracepoint (event_msg) - * - * 2) tracepoint named : "ust_event2" - * -) Probe 4 registered and recording the value 42 (x100) - */ - -#include -#include -#include "tracepoint_test.h" - -DEFINE_TRACE(ust_event); -DEFINE_TRACE(ust_event2); - -static struct message msg_probe3 = { - .payload = "probe3", -}; - -/* - * Probe 4 --> ust_event2 - * Will record 100 times the value 42 - */ -void tp_probe4(void *data, unsigned int p4) -{ - int i; - for (i = 0; i < 100; i++) { - trace_mark_tp(ust, event2, ust_event2, tp_probe4, "probe4 %u", p4); - } -} - -/* - * Probe 3 --> ust_event *and* event_msg (from inside) - * Will record the payload of msg_prob3 struct - * from the data pointer of the probe - */ -void tp_probe3(void *data, unsigned int p3) -{ - struct message *msg; - msg = (struct message*) data; - trace_mark_tp(ust, event_msg, ust_event_msg, - tp_probe3, "probe %s", msg->payload); -} - -/* - * Probe 2 --> ust_event - * Will record 5 times the number 13 - */ -void tp_probe2(void *data, unsigned int p2) -{ - int i; - for (i = 0; i < 5; i++) { - trace_mark_tp(ust, event, ust_event, tp_probe2, "probe %u", 13); - } -} - -/* - * Probe 1 --> ust_event - * Will record 5 times the unsigned int v = 42 - */ -void tp_probe(void *data, unsigned int p1) -{ - int i; - for (i = 0; i < 5; i++) { - trace_mark_tp(ust, event, ust_event, tp_probe, "probe %u", p1); - } -} - -static void __attribute__((constructor)) init() -{ - register_trace_ust_event(tp_probe, NULL); - register_trace_ust_event(tp_probe2, NULL); - register_trace_ust_event(tp_probe3, &msg_probe3); - register_trace_ust_event2(tp_probe4, NULL); -} - -int main(int argc, char **argv) { - unsigned int v = 42; - /* Tracepoint 1 : ust_event */ - trace_ust_event(v); - /* Tracepoint 2 : ust_event2 */ - trace_ust_event2(v); - - return 0; -}