--- /dev/null
+/* depend: */
+/* cflags: */
+/* linker: mtime.o test.o stat.o -lm -lrt */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "mtime.h"
+#include "test.h"
+
+/* global variables */
+
+dts_t *deltas = NULL;
+int nb_measurements = 0;
+
+char *message = "Cycle latency";
+void (*usage_ext) (FILE *) = NULL;
+int (*parse_arg_ext) (char *) = NULL;
+
+int try = 0;
+
+#define MAXDUR 1000
+#define MINDUR 100
+
+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++) {
+
+ int duration = MINDUR * ((MAXDUR / MINDUR) * rand () / RAND_MAX);
+
+ ts_t ts1, ts2;
+ sys_timestamp (&ts1);
+ usleep (duration);
+ sys_timestamp (&ts2);
+ deltas[i] = diff_timestamp (&ts2, &ts1) - duration;
+ }
+
+ return 0;
+}