forked from cory/tildefriends
libuv 1.45.0, #include cleanup, probably something else.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4308 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
12
deps/libuv/test/benchmark-fs-stat.c
vendored
12
deps/libuv/test/benchmark-fs-stat.c
vendored
@ -60,6 +60,7 @@ static void warmup(const char* path) {
|
||||
|
||||
|
||||
static void sync_bench(const char* path) {
|
||||
char fmtbuf[2][32];
|
||||
uint64_t before;
|
||||
uint64_t after;
|
||||
uv_fs_t req;
|
||||
@ -74,9 +75,9 @@ static void sync_bench(const char* path) {
|
||||
after = uv_hrtime();
|
||||
|
||||
printf("%s stats (sync): %.2fs (%s/s)\n",
|
||||
fmt(1.0 * NUM_SYNC_REQS),
|
||||
fmt(&fmtbuf[0], 1.0 * NUM_SYNC_REQS),
|
||||
(after - before) / 1e9,
|
||||
fmt((1.0 * NUM_SYNC_REQS) / ((after - before) / 1e9)));
|
||||
fmt(&fmtbuf[1], (1.0 * NUM_SYNC_REQS) / ((after - before) / 1e9)));
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@ -93,6 +94,7 @@ static void stat_cb(uv_fs_t* fs_req) {
|
||||
static void async_bench(const char* path) {
|
||||
struct async_req reqs[MAX_CONCURRENT_REQS];
|
||||
struct async_req* req;
|
||||
char fmtbuf[2][32];
|
||||
uint64_t before;
|
||||
uint64_t after;
|
||||
int count;
|
||||
@ -112,10 +114,10 @@ static void async_bench(const char* path) {
|
||||
after = uv_hrtime();
|
||||
|
||||
printf("%s stats (%d concurrent): %.2fs (%s/s)\n",
|
||||
fmt(1.0 * NUM_ASYNC_REQS),
|
||||
fmt(&fmtbuf[0], 1.0 * NUM_ASYNC_REQS),
|
||||
i,
|
||||
(after - before) / 1e9,
|
||||
fmt((1.0 * NUM_ASYNC_REQS) / ((after - before) / 1e9)));
|
||||
fmt(&fmtbuf[1], (1.0 * NUM_ASYNC_REQS) / ((after - before) / 1e9)));
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
@ -131,6 +133,6 @@ BENCHMARK_IMPL(fs_stat) {
|
||||
warmup(path);
|
||||
sync_bench(path);
|
||||
async_bench(path);
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
MAKE_VALGRIND_HAPPY(uv_default_loop());
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user