AR=ar
RANLIB=ranlib
-CFLAGS += -g -std=c99 -pipe -Wall
+CFLAGS += -g -D_POSIX_C_SOURCE=200809L -std=c99 -pipe -Wall
LDFLAGS += -g -lpthread -lrt -lm
INC += -I$(ROOTDIR)/common
-#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static unsigned long long tic() {
struct timespec ts;
- if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
+ if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
fprintf(stderr, "bench: clock_gettime failed: %s\n", strerror(errno));
return 0;
}
-#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
static int failed;
static const char *name;
+static int slow;
static int verbose;
static int count;
static int nfailed;
return !!nfailed;
}
-int main() {
+static void usage() {
+ fprintf(stderr, "usage: ./t [-vs]\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[]) {
+ int c;
+
+ while((c = getopt(argc, argv, "vs")) != -1)
+ switch(c) {
+ case 'v':
+ verbose = 1;
+ break;
+ case 's':
+ slow = 1; /* TODO */
+ break;
+ default:
+ usage();
+ }
+ if (optind != argc)
+ usage();
+
#define T(t) run(#t, t);
#include "tests.h"
return summary();
-#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
-#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#define _POSIX_C_SOURCE 200809L
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
-#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#define _POSIX_C_SOURCE 200809L
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
-#define _POSIX_C_SOURCE 200809L
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>