X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=debug%2Fsorter%2Fasio-test.c;h=a7c61627e77c49482fc7cdc961fc66dad0e9f48a;hb=8c48090e240d68564c79eb29ac9004cc911bb5d0;hp=974f70a1a03430b3fd936ec6302fb1b435755631;hpb=bed5fbc254249bffa909516d82091ff68b1a5b63;p=libucw.git diff --git a/debug/sorter/asio-test.c b/debug/sorter/asio-test.c index 974f70a1..a7c61627 100644 --- a/debug/sorter/asio-test.c +++ b/debug/sorter/asio-test.c @@ -15,14 +15,16 @@ #define COPY #define DIRECT O_DIRECT +static timestamp_t timer; + #define P_INIT do { cnt = 0; cnt_rep = 0; cnt_ms = 1; } while(0) #define P_UPDATE(cc) do { \ cnt += cc; \ - if (cnt >= cnt_rep) { cnt_ms += get_timer(); \ + if (cnt >= cnt_rep) { cnt_ms += get_timer(&timer); \ printf("%d of %d MB (%.2f MB/sec)\r", (int)(cnt >> 20), (int)(total_size >> 20), (double)cnt / 1048576 * 1000 / cnt_ms); \ fflush(stdout); cnt_rep += 1<<26; } } while(0) #define P_FINAL do { \ - cnt_ms += get_timer(); \ + cnt_ms += get_timer(&timer); \ log(L_INFO, "Spent %.3f sec (%.2f MB/sec)", (double)cnt_ms/1000, (double)cnt / 1048576 * 1000 / cnt_ms); \ } while(0) @@ -40,7 +42,7 @@ int main(int argc, char **argv) byte name[files][16]; struct asio_request *req[files]; - init_timer(); + init_timer(&timer); io_queue.buffer_size = bufsize; io_queue.max_writebacks = 2; @@ -79,7 +81,7 @@ int main(int argc, char **argv) die("Cannot create %s: %m", name[i]); } sync(); - get_timer(); + get_timer(&timer); log(L_INFO, "Writing %d MB to %d files in parallel with %d byte buffers", (int)(total_size >> 20), files, bufsize); P_INIT;