projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix AC_LANG_SOURCE usage: only takes one parameter
[lttng-ust.git]
/
tests
/
register_test
/
register_test.c
diff --git
a/tests/register_test/register_test.c
b/tests/register_test/register_test.c
index 90fca12edf99f3ceba67f5e82ee22aa07774079f..1221e0aacccb25e04a3aca0a62f744bd6cb27d40 100644
(file)
--- a/
tests/register_test/register_test.c
+++ b/
tests/register_test/register_test.c
@@
-1,4
+1,6
@@
-/* Copyright (C) 2010 Nils Carlson
+/*
+ * Copyright (C) 2010 Nils Carlson
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@
-27,11
+29,9
@@
#include <ust/marker.h>
#include "usterr.h"
#include <ust/marker.h>
#include "usterr.h"
-#include "tracer.h"
-#include "tp.h"
-
-DEFINE_TRACE(hello_tptest);
+#define TRACEPOINT_CREATE_PROBES
+#include "tp.h"
struct hello_trace_struct {
char *message;
struct hello_trace_struct {
char *message;
@@
-45,7
+45,7
@@
void tptest_probe(void *data, int anint)
{
struct hello_trace_struct *hello;
char message[30];
{
struct hello_trace_struct *hello;
char message[30];
- hello
=
(struct hello_trace_struct *)data;
+ hello
=
(struct hello_trace_struct *)data;
//printf("this is the message: %s\n", hello->message);
snprintf(message, 30, "this is the %s\n", hello->message);
}
//printf("this is the message: %s\n", hello->message);
snprintf(message, 30, "this is the %s\n", hello->message);
}
@@
-53,43
+53,43
@@
void tptest_probe(void *data, int anint)
#define HELLO_LENGTH 100
#define HELLO_LENGTH 100
-static void *
register_thread_main(void *data)
+static void *register_thread_main(void *data)
{
{
- int ret, i, j = 0;
-
+ int i, j = 0;
struct hello_trace_struct hello[HELLO_LENGTH];
struct hello_trace_struct hello[HELLO_LENGTH];
- for (i
=0; i<
HELLO_LENGTH; i++) {
- hello[i].message = malloc(6
*
sizeof(char));
- hello[i].message[0] = 'a'
+i%25
;
+ for (i
= 0; i <
HELLO_LENGTH; i++) {
+ hello[i].message = malloc(6
*
sizeof(char));
+ hello[i].message[0] = 'a'
+ (i % 25)
;
memcpy(&hello[i].message[1], "ello", 5);
}
memcpy(&hello[i].message[1], "ello", 5);
}
- for (i
=0; i<
1000; i++) {
- while (!
register_trace_hello_tptest(
tptest_probe,
-
&hello[j%
HELLO_LENGTH])) {
+ for (i
= 0; i <
1000; i++) {
+ while (!
__register_tracepoint(hello_tptest,
tptest_probe,
+
&hello[j %
HELLO_LENGTH])) {
usleep(10);
j++;
}
printf("Registered all\n");
usleep(10);
j++;
}
printf("Registered all\n");
- while (!
unregister_trace_hello_tptest(
tptest_probe,
-
&hello[j%
HELLO_LENGTH])) {
+ while (!
__unregister_tracepoint(hello_tptest,
tptest_probe,
+
&hello[j %
HELLO_LENGTH])) {
usleep(10);
j++;
}
printf("Unregistered all\n");
}
usleep(10);
j++;
}
printf("Unregistered all\n");
}
+ return NULL;
}
}
-int main()
+int main(
int argc, char **argv
)
{
pthread_t register_thread;
int i;
pthread_create(®ister_thread, NULL, register_thread_main, NULL);
{
pthread_t register_thread;
int i;
pthread_create(®ister_thread, NULL, register_thread_main, NULL);
- for(i
=0; i<
1000000; i++) {
- trace
_hello_tptest(
i);
+ for(i
= 0; i <
1000000; i++) {
+ trace
point(hello_tptest,
i);
}
return 0;
}
return 0;
This page took
0.026026 seconds
and
4
git commands to generate.