@@ -38,9 +38,6 @@
#include <sys/time.h>
#include <sys/mman.h>
-#define USEC_PER_SEC 1000000
-#define NSEC_PER_SEC 1000000000
-
#define SIGTEST SIGHUP
enum {
@@ -30,8 +30,14 @@ int parse_time_string(char *val);
void enable_trace_mark(void);
void tracemark(char *fmt, ...) __attribute__((format(printf, 1, 2)));
+#define MSEC_PER_SEC 1000
#define USEC_PER_SEC 1000000
#define NSEC_PER_SEC 1000000000
+#define USEC_TO_NSEC(u) ((u) * 1000)
+#define USEC_TO_SEC(u) (u) / USEC_PER_SEC)
+#define NSEC_TO_USEC(n) ((n) / 1000)
+#define SEC_TO_NSEC(s) ((s) * NSEC_PER_SEC)
+#define SEC_TO_USEC(s) ((s) * USEC_PER_SEC)
static inline void tsnorm(struct timespec *ts)
{
@@ -50,15 +50,6 @@
#include "error.h"
-/* conversions */
-#define USEC_PER_SEC 1000000
-#define NSEC_PER_SEC 1000000000
-#define USEC_TO_NSEC(u) ((u) * 1000)
-#define USEC_TO_SEC(u) ((u) / USEC_PER_SEC)
-#define NSEC_TO_USEC(n) ((n) / 1000)
-#define SEC_TO_NSEC(s) ((s) * NSEC_PER_SEC)
-#define SEC_TO_USEC(s) ((s) * USEC_PER_SEC)
-
/* test timeout */
#define TIMEOUT 2
@@ -27,13 +27,9 @@
#include <pthread.h>
-#define USEC_PER_SEC 1000000
-
#define SYNCMQ_NAME "/syncmsg%d"
#define TESTMQ_NAME "/testmsg%d"
#define MSG_SIZE 8
-#define MSEC_PER_SEC 1000
-#define NSEC_PER_SEC 1000000000
char *syncmsg = "Syncing";
char *testmsg = "Testing";
@@ -25,8 +25,6 @@
#include <pthread.h>
-#define USEC_PER_SEC 1000000
-
enum {
AFFINITY_UNSPECIFIED,
AFFINITY_SPECIFIED,
@@ -17,7 +17,7 @@
#include <signal.h>
#include <time.h>
-#define NSEC_PER_SEC 1000000000
+#include "rt-utils.h"
/* Program parameters:
* max_queue_len: maximum latency allowed, in nanoseconds (int).
@@ -34,9 +34,6 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#define USEC_PER_SEC 1000000
-#define NSEC_PER_SEC 1000000000
-
/* Must be power of 2 ! */
#define VALBUF_SIZE 16384
@@ -43,8 +43,6 @@
#include <pthread.h>
-#define USEC_PER_SEC 1000000
-
enum {
AFFINITY_UNSPECIFIED,
AFFINITY_SPECIFIED,
@@ -32,8 +32,6 @@
#include "rt-get_cpu.h"
#include "error.h"
-#define USEC_PER_SEC 1000000
-
#define SEM_WAIT_FOR_RECEIVER 0
#define SEM_WAIT_FOR_SENDER 1
Several tests define the same time values. Move them all to common header to avoid code duplication. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- src/backfire/sendme.c | 3 --- src/include/rt-utils.h | 6 ++++++ src/pi_tests/pi_stress.c | 9 --------- src/pmqtest/pmqtest.c | 4 ---- src/ptsematest/ptsematest.c | 2 -- src/queuelat/queuelat.c | 2 +- src/signaltest/signaltest.c | 3 --- src/sigwaittest/sigwaittest.c | 2 -- src/svsematest/svsematest.c | 2 -- 9 files changed, 7 insertions(+), 26 deletions(-)