+++ /dev/null
-/* depend: */
-/* cflags: */
-/* linker: mtime.o test.o stat.o -lm -lpthread -lrt */
-
-#include <pthread.h>
-#include <stdio.h>
-
-#include "mtime.h"
-#include "test.h"
-
-/* global variables */
-
-dts_t *deltas = NULL;
-int nb_measurements = 0;
-
-char *message = "thread";
-void (*usage_ext) (FILE *) = NULL;
-int (*parse_arg_ext) (char *) = NULL;
-
-void* dummy_thread(void *arg) {
- (void)arg;
- return NULL;
-}
-
-int test (dts_t *buffer, int nb)
-{
-
- /* set global variables */
-
- deltas = buffer;
- nb_measurements = nb;
-
- /* thread test */
-
- for (int i = 0; i < nb_measurements; i++) {
-
- ts_t ts1;
- sys_timestamp (&ts1);
-
- pthread_t posix_t;
- if (pthread_create(&posix_t, NULL, dummy_thread, NULL) != 0) {
- fprintf (stderr, "error on pthread_create\n");
- return 1;
- }
-
- pthread_join(posix_t, NULL);
-
- ts_t ts2;
- sys_timestamp (&ts2);
-
- deltas[i++] = diff_timestamp (&ts2, &ts1);
- }
-
- return 0;
-}
--- /dev/null
+/* depend: */
+/* cflags: */
+/* linker: mtime.o test.o stat.o -lm -lpthread -lrt */
+
+#include <pthread.h>
+#include <stdio.h>
+
+#include "mtime.h"
+#include "test.h"
+
+/* global variables */
+
+dts_t *deltas = NULL;
+int nb_measurements = 0;
+
+char *message = "Thread (create and join) latency";
+void (*usage_ext) (FILE *) = NULL;
+int (*parse_arg_ext) (char *) = NULL;
+
+
+void* dummy_thread (__attribute__((unused)) void *arg)
+{
+ pthread_exit (NULL);
+}
+
+int test (dts_t *buffer, int nb)
+{
+
+ /* set global variables */
+
+ deltas = buffer;
+ nb_measurements = nb;
+
+ /* thread test */
+
+ for (int i = 0; i < nb_measurements; i++) {
+
+ ts_t ts1;
+ sys_timestamp (&ts1);
+
+ pthread_t posix_t;
+ if (pthread_create(&posix_t, NULL, dummy_thread, NULL) != 0) {
+ fprintf (stderr, "error on pthread_create\n");
+ return 1;
+ }
+
+ pthread_join(posix_t, NULL);
+
+ ts_t ts2;
+ sys_timestamp (&ts2);
+
+ deltas[i] = diff_timestamp (&ts2, &ts1);
+ }
+
+ return 0;
+}
--- /dev/null
+/* depend: */
+/* cflags: */
+/* linker: mtime.o test.o stat.o -lm -lpthread -lrt */
+
+#include <pthread.h>
+#include <stdio.h>
+
+#include "mtime.h"
+#include "test.h"
+
+/* global variables */
+
+dts_t *deltas = NULL;
+int nb_measurements = 0;
+
+char *message = "Thread (create) latency";
+void (*usage_ext) (FILE *) = NULL;
+int (*parse_arg_ext) (char *) = NULL;
+
+ts_t ts1, ts2;
+int try = 0;
+
+void* dummy_thread (__attribute__((unused)) void *arg)
+{
+ sys_timestamp (&ts2);
+ pthread_exit (NULL);
+}
+
+int test (dts_t *buffer, int nb)
+{
+
+ /* set global variables */
+
+ deltas = buffer;
+ nb_measurements = nb;
+
+ /* thread test */
+
+ for (int i = 0; i < nb_measurements; i++) {
+
+ sys_timestamp (&ts1);
+
+ pthread_t posix_t;
+ if (pthread_create(&posix_t, NULL, dummy_thread, NULL) != 0) {
+ fprintf (stderr, "error on pthread_create\n");
+ return 1;
+ }
+
+ pthread_join(posix_t, NULL);
+
+ deltas[i] = diff_timestamp (&ts2, &ts1);
+ }
+
+ return 0;
+}