More benchmark stuff

上级 e1944711
......@@ -6,10 +6,12 @@
#define O_CREATE O_CREAT
#define xfork() fork()
#define xexit() exit(EXIT_SUCCESS)
typedef uint64_t u64;
#else
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "amd64.h"
#define xfork() fork(0)
#define xexit() exit()
#endif
......@@ -73,6 +75,7 @@ main(int ac, char **av)
}
close(fd);
u64 t0 = rdtsc();
for (int i = 0; i < nthread; i++) {
int pid = xfork();
if (pid == 0)
......@@ -81,5 +84,10 @@ main(int ac, char **av)
die("fork");
}
for (int i = 0; i < nthread; i++)
wait();
u64 t1 = rdtsc();
printf("filebench: %lu\n", t1-t0);
return 0;
}
......@@ -61,6 +61,10 @@
#define NCPU 2
#define MTRACE 0
#define PERFSIZE (16<<20ull)
#elif defined(HW_bench)
#define NCPU 48
#define MTRACE 0
#define PERFSIZE (16<<20ull)
#else
#error "Unknown HW"
#endif
......
......@@ -43,13 +43,19 @@ setaffinity(int c)
}
static inline uint64_t
read_tsc(void)
rdtsc(void)
{
uint64_t a, d;
__asm __volatile("rdtsc" : "=a" (a), "=d" (d));
return ((uint64_t) a) | (((uint64_t) d) << 32);
}
static inline uint64_t
read_tsc(void)
{
return rdtsc();
}
static inline void
rep_nop(void)
{
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论