port perfnotes to windows. addresses #1246

git-svn-id: file:///svn/toku/tokudb.1032b@8046 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Rich Prohaska 2013-04-16 23:57:29 -04:00 committed by Yoni Fogel
parent b232b6e23e
commit 755bb35712
7 changed files with 55 additions and 3 deletions

View file

@ -3,7 +3,7 @@
/* Insert a bunch of stuff */
#include <portability.h>
#include <toku_portability.h>
#include <assert.h>
#include <errno.h>
#include <string.h>

View file

@ -1,6 +1,6 @@
/* Scan the bench.tokudb/bench.db over and over. */
#include <portability.h>
#include <toku_portability.h>
#include <assert.h>
#include <db.h>
#include <errno.h>

View file

@ -1,6 +1,6 @@
CPPFLAGS = -I../../include -I..
CFLAGS = -Wall -Werror -g -O0
LDFLAGS = ../tokulinux.a
LDFLAGS = ../tokulinux.a
SRCS = $(wildcard test-*.c)
TARGETS = $(patsubst %.c,%,$(SRCS))
@ -9,5 +9,8 @@ all: $(TARGETS)
%: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS)
test-gettime: test-gettime.c
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) -lrt
clean:
rm -rf $(TARGETS)

View file

@ -0,0 +1,17 @@
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <toku_time.h>
int main(void) {
int r;
struct timespec ts;
r = clock_gettime(CLOCK_REALTIME, &ts);
assert(r == 0);
sleep(10);
r = clock_gettime(CLOCK_REALTIME, &ts);
assert(r == 0);
return 0;
}

View file

@ -0,0 +1,14 @@
#include <stdio.h>
#include <assert.h>
#include <toku_time.h>
int main(void) {
int r;
struct timeval tv;
struct timezone tz;
r = gettimeofday(&tv, &tz);
assert(r == 0);
return 0;
}

2
linux/toku_time.h Normal file
View file

@ -0,0 +1,2 @@
#include <time.h>
#include <sys/time.h>

16
windows/toku_time.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef TOKU_TIME_H
#define TOKU_TIME_H
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
int gettimeofday(struct timeval *tv, struct timezone *tz);
#ifdef __cplusplus
};
#endif
#endif