blob: dda2687eea05c9d05b68b4c9adbbb59326ad8d4b [file] [log] [blame]
Jens Axboe3c39a372006-06-06 20:56:12 +02001#include <stdio.h>
2#include <string.h>
3#include <sys/time.h>
4#include <sys/types.h>
Jens Axboe5c4e1db2006-06-07 14:17:08 +02005#include <sys/stat.h>
Jens Axboe3c39a372006-06-06 20:56:12 +02006#include <dirent.h>
7#include <libgen.h>
8#include <math.h>
9
10#include "fio.h"
Jens Axboe3c39a372006-06-06 20:56:12 +020011
12static struct itimerval itimer;
Jens Axboe5c4e1db2006-06-07 14:17:08 +020013static struct list_head disk_list = LIST_HEAD_INIT(disk_list);
Jens Axboec0a6b0d2007-02-26 12:28:58 +010014static dev_t last_dev;
Jens Axboe3c39a372006-06-06 20:56:12 +020015
Jens Axboedbe11252007-02-11 00:19:51 +010016/*
Jens Axboe34403fb2007-03-02 21:43:25 +010017 * Cheesy number->string conversion, complete with carry rounding error.
Jens Axboedbe11252007-02-11 00:19:51 +010018 */
Jens Axboeb3605062007-03-12 14:19:47 +010019static char *num2str(unsigned long num, int maxlen, int base, int pow2)
Jens Axboedbe11252007-02-11 00:19:51 +010020{
Jens Axboeb3605062007-03-12 14:19:47 +010021 char postfix[] = { ' ', 'K', 'M', 'G', 'P', 'E' };
22 unsigned int thousand;
Jens Axboedbe11252007-02-11 00:19:51 +010023 char *buf;
24 int i;
25
Jens Axboeb3605062007-03-12 14:19:47 +010026 if (pow2)
27 thousand = 1024;
28 else
29 thousand = 1000;
30
Jens Axboedbe11252007-02-11 00:19:51 +010031 buf = malloc(128);
32
33 for (i = 0; base > 1; i++)
34 base /= thousand;
35
36 do {
37 int len, carry = 0;
38
39 len = sprintf(buf, "%'lu", num);
40 if (len <= maxlen) {
Jens Axboeb3605062007-03-12 14:19:47 +010041 if (i >= 1) {
42 buf[len] = postfix[i];
43 buf[len + 1] = '\0';
44 }
Jens Axboedbe11252007-02-11 00:19:51 +010045 return buf;
46 }
47
48 if ((num % thousand) >= (thousand / 2))
49 carry = 1;
50
51 num /= thousand;
52 num += carry;
53 i++;
Jens Axboef3502ba2007-02-14 01:27:09 +010054 } while (i <= 5);
Jens Axboedbe11252007-02-11 00:19:51 +010055
56 return buf;
57}
58
Jens Axboe3c39a372006-06-06 20:56:12 +020059static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus)
60{
61 unsigned in_flight;
62 char line[256];
63 FILE *f;
64 char *p;
65
66 f = fopen(du->path, "r");
67 if (!f)
68 return 1;
69
70 p = fgets(line, sizeof(line), f);
71 if (!p) {
72 fclose(f);
73 return 1;
74 }
75
76 if (sscanf(p, "%u %u %llu %u %u %u %llu %u %u %u %u\n", &dus->ios[0], &dus->merges[0], &dus->sectors[0], &dus->ticks[0], &dus->ios[1], &dus->merges[1], &dus->sectors[1], &dus->ticks[1], &in_flight, &dus->io_ticks, &dus->time_in_queue) != 11) {
77 fclose(f);
78 return 1;
79 }
80
81 fclose(f);
82 return 0;
83}
84
85static void update_io_tick_disk(struct disk_util *du)
86{
87 struct disk_util_stat __dus, *dus, *ldus;
88 struct timeval t;
89
90 if (get_io_ticks(du, &__dus))
91 return;
92
93 dus = &du->dus;
94 ldus = &du->last_dus;
95
96 dus->sectors[0] += (__dus.sectors[0] - ldus->sectors[0]);
97 dus->sectors[1] += (__dus.sectors[1] - ldus->sectors[1]);
98 dus->ios[0] += (__dus.ios[0] - ldus->ios[0]);
99 dus->ios[1] += (__dus.ios[1] - ldus->ios[1]);
100 dus->merges[0] += (__dus.merges[0] - ldus->merges[0]);
101 dus->merges[1] += (__dus.merges[1] - ldus->merges[1]);
102 dus->ticks[0] += (__dus.ticks[0] - ldus->ticks[0]);
103 dus->ticks[1] += (__dus.ticks[1] - ldus->ticks[1]);
104 dus->io_ticks += (__dus.io_ticks - ldus->io_ticks);
105 dus->time_in_queue += (__dus.time_in_queue - ldus->time_in_queue);
106
Jens Axboe02bcaa82006-11-24 10:42:00 +0100107 fio_gettime(&t, NULL);
Jens Axboe3c39a372006-06-06 20:56:12 +0200108 du->msec += mtime_since(&du->time, &t);
109 memcpy(&du->time, &t, sizeof(t));
110 memcpy(ldus, &__dus, sizeof(__dus));
111}
112
113void update_io_ticks(void)
114{
115 struct list_head *entry;
116 struct disk_util *du;
117
118 list_for_each(entry, &disk_list) {
119 du = list_entry(entry, struct disk_util, list);
120 update_io_tick_disk(du);
121 }
122}
123
124static int disk_util_exists(dev_t dev)
125{
126 struct list_head *entry;
127 struct disk_util *du;
128
129 list_for_each(entry, &disk_list) {
130 du = list_entry(entry, struct disk_util, list);
131
132 if (du->dev == dev)
133 return 1;
134 }
135
136 return 0;
137}
138
139static void disk_util_add(dev_t dev, char *path)
140{
Jens Axboe1188caf2007-01-08 10:57:27 +0100141 struct disk_util *du, *__du;
142 struct list_head *entry;
Jens Axboe3c39a372006-06-06 20:56:12 +0200143
Jens Axboe1188caf2007-01-08 10:57:27 +0100144 du = malloc(sizeof(*du));
Jens Axboe3c39a372006-06-06 20:56:12 +0200145 memset(du, 0, sizeof(*du));
146 INIT_LIST_HEAD(&du->list);
147 sprintf(du->path, "%s/stat", path);
148 du->name = strdup(basename(path));
149 du->dev = dev;
150
Jens Axboe1188caf2007-01-08 10:57:27 +0100151 list_for_each(entry, &disk_list) {
152 __du = list_entry(entry, struct disk_util, list);
153
154 if (!strcmp(du->name, __du->name)) {
155 free(du->name);
156 free(du);
157 return;
158 }
159 }
160
Jens Axboe02bcaa82006-11-24 10:42:00 +0100161 fio_gettime(&du->time, NULL);
Jens Axboe3c39a372006-06-06 20:56:12 +0200162 get_io_ticks(du, &du->last_dus);
163
164 list_add_tail(&du->list, &disk_list);
165}
166
167static int check_dev_match(dev_t dev, char *path)
168{
169 unsigned int major, minor;
170 char line[256], *p;
171 FILE *f;
172
173 f = fopen(path, "r");
174 if (!f) {
175 perror("open path");
176 return 1;
177 }
178
179 p = fgets(line, sizeof(line), f);
180 if (!p) {
181 fclose(f);
182 return 1;
183 }
184
185 if (sscanf(p, "%u:%u", &major, &minor) != 2) {
186 fclose(f);
187 return 1;
188 }
189
190 if (((major << 8) | minor) == dev) {
191 fclose(f);
192 return 0;
193 }
194
195 fclose(f);
196 return 1;
197}
198
199static int find_block_dir(dev_t dev, char *path)
200{
201 struct dirent *dir;
202 struct stat st;
203 int found = 0;
204 DIR *D;
205
206 D = opendir(path);
207 if (!D)
208 return 0;
209
210 while ((dir = readdir(D)) != NULL) {
211 char full_path[256];
212
213 if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
214 continue;
Jens Axboe3c39a372006-06-06 20:56:12 +0200215
216 sprintf(full_path, "%s/%s", path, dir->d_name);
217
218 if (!strcmp(dir->d_name, "dev")) {
219 if (!check_dev_match(dev, full_path)) {
220 found = 1;
221 break;
222 }
223 }
224
Jens Axboe3307d652006-07-17 18:15:41 +0200225 if (lstat(full_path, &st) == -1) {
Jens Axboe3c39a372006-06-06 20:56:12 +0200226 perror("stat");
227 break;
228 }
229
230 if (!S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))
231 continue;
232
233 found = find_block_dir(dev, full_path);
234 if (found) {
235 strcpy(path, full_path);
236 break;
237 }
238 }
239
240 closedir(D);
241 return found;
242}
243
Jens Axboe55bc7fc2007-03-13 12:28:40 +0100244static void __init_disk_util(struct thread_data *td, struct fio_file *f)
Jens Axboe3c39a372006-06-06 20:56:12 +0200245{
246 struct stat st;
Jens Axboe0bbab0e2006-11-02 09:18:36 +0100247 char foo[PATH_MAX], tmp[PATH_MAX];
Jens Axboe3c39a372006-06-06 20:56:12 +0200248 dev_t dev;
249 char *p;
250
Jens Axboe53cdc682006-10-18 11:50:58 +0200251 if (!stat(f->file_name, &st)) {
Jens Axboe3c39a372006-06-06 20:56:12 +0200252 if (S_ISBLK(st.st_mode))
253 dev = st.st_rdev;
254 else
255 dev = st.st_dev;
256 } else {
257 /*
258 * must be a file, open "." in that path
259 */
Jens Axboe0bbab0e2006-11-02 09:18:36 +0100260 strncpy(foo, f->file_name, PATH_MAX - 1);
Jens Axboe3c39a372006-06-06 20:56:12 +0200261 p = dirname(foo);
262 if (stat(p, &st)) {
263 perror("disk util stat");
264 return;
265 }
266
267 dev = st.st_dev;
268 }
269
270 if (disk_util_exists(dev))
271 return;
Jens Axboec0a6b0d2007-02-26 12:28:58 +0100272
273 /*
274 * for an fs without a device, we will repeatedly stat through
275 * sysfs which can take oodles of time for thousands of files. so
276 * cache the last lookup and compare with that before going through
277 * everything again.
278 */
279 if (dev == last_dev)
280 return;
281
282 last_dev = dev;
Jens Axboe3c39a372006-06-06 20:56:12 +0200283
284 sprintf(foo, "/sys/block");
285 if (!find_block_dir(dev, foo))
286 return;
287
288 /*
289 * If there's a ../queue/ directory there, we are inside a partition.
290 * Check if that is the case and jump back. For loop/md/dm etc we
291 * are already in the right spot.
292 */
293 sprintf(tmp, "%s/../queue", foo);
294 if (!stat(tmp, &st)) {
295 p = dirname(foo);
296 sprintf(tmp, "%s/queue", p);
297 if (stat(tmp, &st)) {
Jens Axboe3b70d7e2006-06-08 21:48:46 +0200298 log_err("unknown sysfs layout\n");
Jens Axboe3c39a372006-06-06 20:56:12 +0200299 return;
300 }
Jens Axboe0bbab0e2006-11-02 09:18:36 +0100301 strncpy(tmp, p, PATH_MAX - 1);
Jens Axboe84585002006-10-19 20:26:22 +0200302 sprintf(foo, "%s", tmp);
Jens Axboe3c39a372006-06-06 20:56:12 +0200303 }
304
Jens Axboe55bc7fc2007-03-13 12:28:40 +0100305 if (td->ioscheduler && !td->sysfs_root)
Jens Axboeeecf2722006-10-20 14:00:36 +0200306 td->sysfs_root = strdup(foo);
307
Jens Axboe3c39a372006-06-06 20:56:12 +0200308 disk_util_add(dev, foo);
309}
310
Jens Axboe55bc7fc2007-03-13 12:28:40 +0100311void init_disk_util(struct thread_data *td)
312{
313 struct fio_file *f;
314 unsigned int i;
315
316 if (!td->do_disk_util ||
317 (td->io_ops->flags & (FIO_DISKLESSIO | FIO_NODISKUTIL)))
318 return;
319
Jens Axboe1c178182007-03-13 13:25:18 +0100320 for_each_file(td, f, i)
Jens Axboe55bc7fc2007-03-13 12:28:40 +0100321 __init_disk_util(td, f);
322}
323
Jens Axboe3c39a372006-06-06 20:56:12 +0200324void disk_util_timer_arm(void)
325{
326 itimer.it_value.tv_sec = 0;
327 itimer.it_value.tv_usec = DISK_UTIL_MSEC * 1000;
328 setitimer(ITIMER_REAL, &itimer, NULL);
329}
330
331void update_rusage_stat(struct thread_data *td)
332{
Jens Axboe756867b2007-03-06 15:19:24 +0100333 struct thread_stat *ts = &td->ts;
Jens Axboe3c39a372006-06-06 20:56:12 +0200334
Jens Axboe079ad092007-02-20 13:58:20 +0100335 getrusage(RUSAGE_SELF, &ts->ru_end);
336
337 ts->usr_time += mtime_since(&ts->ru_start.ru_utime, &ts->ru_end.ru_utime);
338 ts->sys_time += mtime_since(&ts->ru_start.ru_stime, &ts->ru_end.ru_stime);
339 ts->ctx += ts->ru_end.ru_nvcsw + ts->ru_end.ru_nivcsw - (ts->ru_start.ru_nvcsw + ts->ru_start.ru_nivcsw);
Jens Axboe3c39a372006-06-06 20:56:12 +0200340
Jens Axboe079ad092007-02-20 13:58:20 +0100341 memcpy(&ts->ru_start, &ts->ru_end, sizeof(ts->ru_end));
Jens Axboe3c39a372006-06-06 20:56:12 +0200342}
343
344static int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max,
345 double *mean, double *dev)
346{
Jens Axboe68704082007-01-10 19:56:37 +0100347 double n = is->samples;
Jens Axboe3c39a372006-06-06 20:56:12 +0200348
349 if (is->samples == 0)
350 return 0;
351
352 *min = is->min_val;
353 *max = is->max_val;
354
355 n = (double) is->samples;
Jens Axboe68704082007-01-10 19:56:37 +0100356 *mean = is->mean;
Jens Axboe3c39a372006-06-06 20:56:12 +0200357
Jens Axboe68704082007-01-10 19:56:37 +0100358 if (n > 1.0)
359 *dev = sqrt(is->S / (n - 1.0));
Jens Axboeef9c5c42007-01-03 14:21:13 +0100360 else
Jens Axboe68704082007-01-10 19:56:37 +0100361 *dev = -1.0;
Jens Axboeef9c5c42007-01-03 14:21:13 +0100362
Jens Axboe3c39a372006-06-06 20:56:12 +0200363 return 1;
364}
365
366static void show_group_stats(struct group_run_stats *rs, int id)
367{
Jens Axboedbe11252007-02-11 00:19:51 +0100368 char *p1, *p2, *p3, *p4;
369 const char *ddir_str[] = { " READ", " WRITE" };
370 int i;
371
Jens Axboe6d861442007-03-15 09:22:23 +0100372 log_info("\nRun status group %d (all jobs):\n", id);
Jens Axboe3c39a372006-06-06 20:56:12 +0200373
Jens Axboedbe11252007-02-11 00:19:51 +0100374 for (i = 0; i <= DDIR_WRITE; i++) {
375 if (!rs->max_run[i])
376 continue;
377
Jens Axboeb3605062007-03-12 14:19:47 +0100378 p1 = num2str(rs->io_kb[i], 6, 1000, 1);
379 p2 = num2str(rs->agg[i], 6, 1000, 1);
380 p3 = num2str(rs->min_bw[i], 6, 1000, 1);
381 p4 = num2str(rs->max_bw[i], 6, 1000, 1);
Jens Axboedbe11252007-02-11 00:19:51 +0100382
Jens Axboe6d861442007-03-15 09:22:23 +0100383 log_info("%s: io=%siB, aggrb=%siB/s, minb=%siB/s, maxb=%siB/s, mint=%llumsec, maxt=%llumsec\n", ddir_str[i], p1, p2, p3, p4, rs->min_run[i], rs->max_run[i]);
Jens Axboedbe11252007-02-11 00:19:51 +0100384
385 free(p1);
386 free(p2);
387 free(p3);
388 free(p4);
389 }
Jens Axboe3c39a372006-06-06 20:56:12 +0200390}
391
392static void show_disk_util(void)
393{
394 struct disk_util_stat *dus;
Jens Axboeb4a6a592006-10-20 13:54:47 +0200395 struct list_head *entry, *next;
Jens Axboe3c39a372006-06-06 20:56:12 +0200396 struct disk_util *du;
397 double util;
398
Jens Axboe6d861442007-03-15 09:22:23 +0100399 log_info("\nDisk stats (read/write):\n");
Jens Axboe3c39a372006-06-06 20:56:12 +0200400
401 list_for_each(entry, &disk_list) {
402 du = list_entry(entry, struct disk_util, list);
403 dus = &du->dus;
404
405 util = (double) 100 * du->dus.io_ticks / (double) du->msec;
406 if (util > 100.0)
407 util = 100.0;
408
Jens Axboe6d861442007-03-15 09:22:23 +0100409 log_info(" %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, in_queue=%u, util=%3.2f%%\n", du->name, dus->ios[0], dus->ios[1], dus->merges[0], dus->merges[1], dus->ticks[0], dus->ticks[1], dus->time_in_queue, util);
Jens Axboe3c39a372006-06-06 20:56:12 +0200410 }
Jens Axboeb4a6a592006-10-20 13:54:47 +0200411
412 /*
413 * now free the list
414 */
415 list_for_each_safe(entry, next, &disk_list) {
416 list_del(entry);
417 du = list_entry(entry, struct disk_util, list);
418 free(du->name);
419 free(du);
420 }
Jens Axboe3c39a372006-06-06 20:56:12 +0200421}
422
Jens Axboeb3605062007-03-12 14:19:47 +0100423#define ts_total_io_u(ts) \
424 ((ts)->total_io_u[0] + (ts)->total_io_u[1])
425
Jens Axboe22708902007-03-06 17:05:32 +0100426static void stat_calc_dist(struct thread_stat *ts, double *io_u_dist)
427{
428 int i;
429
430 /*
431 * Do depth distribution calculations
432 */
433 for (i = 0; i < FIO_IO_U_MAP_NR; i++) {
Jens Axboeb3605062007-03-12 14:19:47 +0100434 io_u_dist[i] = (double) ts->io_u_map[i] / (double) ts_total_io_u(ts);
Jens Axboe22708902007-03-06 17:05:32 +0100435 io_u_dist[i] *= 100.0;
436 }
437}
438
439static void stat_calc_lat(struct thread_stat *ts, double *io_u_lat)
440{
441 int i;
442
443 /*
444 * Do latency distribution calculations
445 */
446 for (i = 0; i < FIO_IO_U_LAT_NR; i++) {
Jens Axboeb3605062007-03-12 14:19:47 +0100447 io_u_lat[i] = (double) ts->io_u_lat[i] / (double) ts_total_io_u(ts);
Jens Axboe22708902007-03-06 17:05:32 +0100448 io_u_lat[i] *= 100.0;
449 }
450}
451
Jens Axboe756867b2007-03-06 15:19:24 +0100452static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
Jens Axboe3c39a372006-06-06 20:56:12 +0200453 int ddir)
454{
Jens Axboe3c9b60c2006-11-07 08:36:14 +0100455 const char *ddir_str[] = { "read ", "write" };
Jens Axboe3c39a372006-06-06 20:56:12 +0200456 unsigned long min, max;
Jens Axboeb3605062007-03-12 14:19:47 +0100457 unsigned long long bw, iops;
Jens Axboe3c39a372006-06-06 20:56:12 +0200458 double mean, dev;
Jens Axboeb3605062007-03-12 14:19:47 +0100459 char *io_p, *bw_p, *iops_p;
Jens Axboe3c39a372006-06-06 20:56:12 +0200460
Jens Axboe756867b2007-03-06 15:19:24 +0100461 if (!ts->runtime[ddir])
Jens Axboe3c39a372006-06-06 20:56:12 +0200462 return;
463
Jens Axboe756867b2007-03-06 15:19:24 +0100464 bw = ts->io_bytes[ddir] / ts->runtime[ddir];
Jens Axboeb3605062007-03-12 14:19:47 +0100465 iops = (1000 * ts->total_io_u[ddir]) / ts->runtime[ddir];
466 io_p = num2str(ts->io_bytes[ddir] >> 10, 6, 1000, 1);
467 bw_p = num2str(bw, 6, 1000, 1);
468 iops_p = num2str(iops, 6, 1, 0);
Jens Axboedbe11252007-02-11 00:19:51 +0100469
Jens Axboe6d861442007-03-15 09:22:23 +0100470 log_info(" %s: io=%siB, bw=%siB/s, iops=%s, runt=%6lumsec\n", ddir_str[ddir], io_p, bw_p, iops_p, ts->runtime[ddir]);
Jens Axboedbe11252007-02-11 00:19:51 +0100471
472 free(io_p);
473 free(bw_p);
Jens Axboeb3605062007-03-12 14:19:47 +0100474 free(iops_p);
Jens Axboe3c39a372006-06-06 20:56:12 +0200475
Jens Axboe079ad092007-02-20 13:58:20 +0100476 if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev))
Jens Axboe6d861442007-03-15 09:22:23 +0100477 log_info(" slat (msec): min=%5lu, max=%5lu, avg=%5.02f, stdev=%5.02f\n", min, max, mean, dev);
Jens Axboe3c39a372006-06-06 20:56:12 +0200478
Jens Axboe079ad092007-02-20 13:58:20 +0100479 if (calc_lat(&ts->clat_stat[ddir], &min, &max, &mean, &dev))
Jens Axboe6d861442007-03-15 09:22:23 +0100480 log_info(" clat (msec): min=%5lu, max=%5lu, avg=%5.02f, stdev=%5.02f\n", min, max, mean, dev);
Jens Axboe3c39a372006-06-06 20:56:12 +0200481
Jens Axboe079ad092007-02-20 13:58:20 +0100482 if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
Jens Axboe3c39a372006-06-06 20:56:12 +0200483 double p_of_agg;
484
485 p_of_agg = mean * 100 / (double) rs->agg[ddir];
Jens Axboe6d861442007-03-15 09:22:23 +0100486 log_info(" bw (KiB/s) : min=%5lu, max=%5lu, per=%3.2f%%, avg=%5.02f, stdev=%5.02f\n", min, max, p_of_agg, mean, dev);
Jens Axboe3c39a372006-06-06 20:56:12 +0200487 }
488}
489
Jens Axboe756867b2007-03-06 15:19:24 +0100490static void show_thread_status(struct thread_stat *ts,
Jens Axboe3c39a372006-06-06 20:56:12 +0200491 struct group_run_stats *rs)
492{
493 double usr_cpu, sys_cpu;
Jens Axboe69008992006-11-24 13:12:56 +0100494 unsigned long runtime;
Jens Axboe71619dc2007-01-13 23:56:33 +0100495 double io_u_dist[FIO_IO_U_MAP_NR];
Jens Axboeec118302007-02-17 04:38:20 +0100496 double io_u_lat[FIO_IO_U_LAT_NR];
Jens Axboe3c39a372006-06-06 20:56:12 +0200497
Jens Axboe756867b2007-03-06 15:19:24 +0100498 if (!(ts->io_bytes[0] + ts->io_bytes[1]))
Jens Axboe3c39a372006-06-06 20:56:12 +0200499 return;
500
Jens Axboe756867b2007-03-06 15:19:24 +0100501 if (!ts->error)
Jens Axboe6d861442007-03-15 09:22:23 +0100502 log_info("%s: (groupid=%d, jobs=%d): err=%2d: pid=%d\n", ts->name, ts->groupid, ts->members, ts->error, ts->pid);
Jens Axboe6d663072007-02-11 00:57:13 +0100503 else
Jens Axboe6d861442007-03-15 09:22:23 +0100504 log_info("%s: (groupid=%d, jobs=%d): err=%2d (%s): pid=%d\n", ts->name, ts->groupid, ts->members, ts->error, ts->verror, ts->pid);
Jens Axboe3c39a372006-06-06 20:56:12 +0200505
Jens Axboe7bdce1b2007-03-06 20:01:13 +0100506 if (ts->description)
Jens Axboe6d861442007-03-15 09:22:23 +0100507 log_info(" Description : [%s]\n", ts->description);
Jens Axboe7bdce1b2007-03-06 20:01:13 +0100508
Jens Axboe756867b2007-03-06 15:19:24 +0100509 if (ts->io_bytes[DDIR_READ])
510 show_ddir_status(rs, ts, DDIR_READ);
511 if (ts->io_bytes[DDIR_WRITE])
512 show_ddir_status(rs, ts, DDIR_WRITE);
Jens Axboe3c39a372006-06-06 20:56:12 +0200513
Jens Axboe756867b2007-03-06 15:19:24 +0100514 runtime = ts->total_run_time;
Jens Axboe69008992006-11-24 13:12:56 +0100515 if (runtime) {
Jens Axboe1e97cce2006-12-05 11:44:16 +0100516 double runt = (double) runtime;
Jens Axboe3c39a372006-06-06 20:56:12 +0200517
Jens Axboe756867b2007-03-06 15:19:24 +0100518 usr_cpu = (double) ts->usr_time * 100 / runt;
519 sys_cpu = (double) ts->sys_time * 100 / runt;
Jens Axboe3c39a372006-06-06 20:56:12 +0200520 } else {
521 usr_cpu = 0;
522 sys_cpu = 0;
523 }
524
Jens Axboe6d861442007-03-15 09:22:23 +0100525 log_info(" cpu : usr=%3.2f%%, sys=%3.2f%%, ctx=%lu\n", usr_cpu, sys_cpu, ts->ctx);
Jens Axboe71619dc2007-01-13 23:56:33 +0100526
Jens Axboe22708902007-03-06 17:05:32 +0100527 stat_calc_dist(ts, io_u_dist);
528 stat_calc_lat(ts, io_u_lat);
Jens Axboe71619dc2007-01-13 23:56:33 +0100529
Jens Axboe6d861442007-03-15 09:22:23 +0100530 log_info(" IO depths : 1=%3.1f%%, 2=%3.1f%%, 4=%3.1f%%, 8=%3.1f%%, 16=%3.1f%%, 32=%3.1f%%, >=64=%3.1f%%\n", io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]);
Jens Axboe61697c32007-02-05 15:04:46 +0100531
Jens Axboe6d861442007-03-15 09:22:23 +0100532 log_info(" lat (msec): 2=%3.1f%%, 4=%3.1f%%, 10=%3.1f%%, 20=%3.1f%%, 50=%3.1f%%, 100=%3.1f%%\n", io_u_lat[0], io_u_lat[1], io_u_lat[2], io_u_lat[3], io_u_lat[4], io_u_lat[5]);
533 log_info(" lat (msec): 250=%3.1f%%, 500=%3.1f%%, 750=%3.1f%%, 1000=%3.1f%%, >=2000=%3.1f%%\n", io_u_lat[6], io_u_lat[7], io_u_lat[8], io_u_lat[9], io_u_lat[10]);
Jens Axboe3c39a372006-06-06 20:56:12 +0200534}
535
Jens Axboe756867b2007-03-06 15:19:24 +0100536static void show_ddir_status_terse(struct thread_stat *ts,
Jens Axboec6ae0a52006-06-12 11:04:44 +0200537 struct group_run_stats *rs, int ddir)
538{
539 unsigned long min, max;
540 unsigned long long bw;
541 double mean, dev;
542
543 bw = 0;
Jens Axboe756867b2007-03-06 15:19:24 +0100544 if (ts->runtime[ddir])
545 bw = ts->io_bytes[ddir] / ts->runtime[ddir];
Jens Axboec6ae0a52006-06-12 11:04:44 +0200546
Jens Axboe6d861442007-03-15 09:22:23 +0100547 log_info(";%llu;%llu;%lu", ts->io_bytes[ddir] >> 10, bw, ts->runtime[ddir]);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200548
Jens Axboe079ad092007-02-20 13:58:20 +0100549 if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev))
Jens Axboe6d861442007-03-15 09:22:23 +0100550 log_info(";%lu;%lu;%f;%f", min, max, mean, dev);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200551 else
Jens Axboe6d861442007-03-15 09:22:23 +0100552 log_info(";%lu;%lu;%f;%f", 0UL, 0UL, 0.0, 0.0);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200553
Jens Axboe079ad092007-02-20 13:58:20 +0100554 if (calc_lat(&ts->clat_stat[ddir], &min, &max, &mean, &dev))
Jens Axboe6d861442007-03-15 09:22:23 +0100555 log_info(";%lu;%lu;%f;%f", min, max, mean, dev);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200556 else
Jens Axboe6d861442007-03-15 09:22:23 +0100557 log_info(";%lu;%lu;%f;%f", 0UL, 0UL, 0.0, 0.0);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200558
Jens Axboe079ad092007-02-20 13:58:20 +0100559 if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
Jens Axboec6ae0a52006-06-12 11:04:44 +0200560 double p_of_agg;
561
562 p_of_agg = mean * 100 / (double) rs->agg[ddir];
Jens Axboe6d861442007-03-15 09:22:23 +0100563 log_info(";%lu;%lu;%f%%;%f;%f", min, max, p_of_agg, mean, dev);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200564 } else
Jens Axboe6d861442007-03-15 09:22:23 +0100565 log_info(";%lu;%lu;%f%%;%f;%f", 0UL, 0UL, 0.0, 0.0, 0.0);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200566}
567
568
Jens Axboe756867b2007-03-06 15:19:24 +0100569static void show_thread_status_terse(struct thread_stat *ts,
Jens Axboec6ae0a52006-06-12 11:04:44 +0200570 struct group_run_stats *rs)
571{
Jens Axboe22708902007-03-06 17:05:32 +0100572 double io_u_dist[FIO_IO_U_MAP_NR];
573 double io_u_lat[FIO_IO_U_LAT_NR];
Jens Axboec6ae0a52006-06-12 11:04:44 +0200574 double usr_cpu, sys_cpu;
575
Jens Axboe6d861442007-03-15 09:22:23 +0100576 log_info("%s;%d;%d", ts->name, ts->groupid, ts->error);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200577
Jens Axboe756867b2007-03-06 15:19:24 +0100578 show_ddir_status_terse(ts, rs, 0);
579 show_ddir_status_terse(ts, rs, 1);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200580
Jens Axboe756867b2007-03-06 15:19:24 +0100581 if (ts->total_run_time) {
582 double runt = (double) ts->total_run_time;
Jens Axboec6ae0a52006-06-12 11:04:44 +0200583
Jens Axboe756867b2007-03-06 15:19:24 +0100584 usr_cpu = (double) ts->usr_time * 100 / runt;
585 sys_cpu = (double) ts->sys_time * 100 / runt;
Jens Axboec6ae0a52006-06-12 11:04:44 +0200586 } else {
587 usr_cpu = 0;
588 sys_cpu = 0;
589 }
590
Jens Axboe6d861442007-03-15 09:22:23 +0100591 log_info(";%f%%;%f%%;%lu", usr_cpu, sys_cpu, ts->ctx);
Jens Axboe22708902007-03-06 17:05:32 +0100592
593 stat_calc_dist(ts, io_u_dist);
594 stat_calc_lat(ts, io_u_lat);
595
Jens Axboe6d861442007-03-15 09:22:23 +0100596 log_info(";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%", io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]);
Jens Axboe22708902007-03-06 17:05:32 +0100597
Jens Axboe6d861442007-03-15 09:22:23 +0100598 log_info(";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%\n", io_u_lat[0], io_u_lat[1], io_u_lat[2], io_u_lat[3], io_u_lat[4], io_u_lat[5]);
599 log_info(";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%", io_u_lat[6], io_u_lat[7], io_u_lat[8], io_u_lat[9], io_u_lat[10]);
Jens Axboe22708902007-03-06 17:05:32 +0100600
601 if (ts->description)
Jens Axboe6d861442007-03-15 09:22:23 +0100602 log_info(";%s", ts->description);
Jens Axboe22708902007-03-06 17:05:32 +0100603
Jens Axboe6d861442007-03-15 09:22:23 +0100604 log_info("\n");
Jens Axboe756867b2007-03-06 15:19:24 +0100605}
606
Jens Axboe197574e2007-03-08 15:35:11 +0100607static void sum_stat(struct io_stat *dst, struct io_stat *src, int nr)
Jens Axboe756867b2007-03-06 15:19:24 +0100608{
609 double mean, S;
610
611 dst->min_val = min(dst->min_val, src->min_val);
612 dst->max_val = max(dst->max_val, src->max_val);
613 dst->samples += src->samples;
614
615 /*
616 * Needs a new method for calculating stddev, we cannot just
617 * average them we do below for nr > 1
618 */
619 if (nr == 1) {
620 mean = src->mean;
621 S = src->S;
622 } else {
Jens Axboec39cced2007-03-06 15:37:00 +0100623 mean = ((src->mean * (double) (nr - 1)) + dst->mean) / ((double) nr);
624 S = ((src->S * (double) (nr - 1)) + dst->S) / ((double) nr);
Jens Axboe756867b2007-03-06 15:19:24 +0100625 }
626
627 dst->mean = mean;
628 dst->S = S;
629}
630
Jens Axboe3c39a372006-06-06 20:56:12 +0200631void show_run_stats(void)
632{
633 struct group_run_stats *runstats, *rs;
634 struct thread_data *td;
Jens Axboe756867b2007-03-06 15:19:24 +0100635 struct thread_stat *threadstats, *ts;
Jens Axboe197574e2007-03-08 15:35:11 +0100636 int i, j, k, l, nr_ts, last_ts, idx;
Jens Axboe3c39a372006-06-06 20:56:12 +0200637
638 runstats = malloc(sizeof(struct group_run_stats) * (groupid + 1));
639
640 for (i = 0; i < groupid + 1; i++) {
641 rs = &runstats[i];
642
643 memset(rs, 0, sizeof(*rs));
644 rs->min_bw[0] = rs->min_run[0] = ~0UL;
645 rs->min_bw[1] = rs->min_run[1] = ~0UL;
646 }
647
Jens Axboe756867b2007-03-06 15:19:24 +0100648 /*
649 * find out how many threads stats we need. if group reporting isn't
650 * enabled, it's one-per-td.
651 */
652 nr_ts = 0;
653 last_ts = -1;
Jens Axboe34572e22006-10-20 09:33:18 +0200654 for_each_td(td, i) {
Jens Axboe756867b2007-03-06 15:19:24 +0100655 if (!td->group_reporting) {
656 nr_ts++;
657 continue;
658 }
659 if (last_ts == td->groupid)
660 continue;
661
662 last_ts = td->groupid;
663 nr_ts++;
664 }
665
666 threadstats = malloc(nr_ts * sizeof(struct thread_stat));
667
668 for (i = 0; i < nr_ts; i++) {
669 ts = &threadstats[i];
670
671 memset(ts, 0, sizeof(*ts));
Jens Axboede64df02007-03-08 19:09:49 +0100672 for (j = 0; j <= DDIR_WRITE; j++) {
Jens Axboe197574e2007-03-08 15:35:11 +0100673 ts->clat_stat[j].min_val = -1UL;
674 ts->slat_stat[j].min_val = -1UL;
675 ts->bw_stat[j].min_val = -1UL;
676 }
Jens Axboe7abd0e32007-03-12 15:24:43 +0100677 ts->groupid = -1;
Jens Axboe756867b2007-03-06 15:19:24 +0100678 }
679
680 j = 0;
681 last_ts = -1;
Jens Axboe197574e2007-03-08 15:35:11 +0100682 idx = 0;
Jens Axboe756867b2007-03-06 15:19:24 +0100683 for_each_td(td, i) {
Jens Axboe7abd0e32007-03-12 15:24:43 +0100684 if (idx && (!td->group_reporting ||
685 (td->group_reporting && last_ts != td->groupid))) {
686 idx = 0;
687 j++;
688 }
689
690 last_ts = td->groupid;
691
Jens Axboe756867b2007-03-06 15:19:24 +0100692 ts = &threadstats[j];
693
Jens Axboe197574e2007-03-08 15:35:11 +0100694 idx++;
Jens Axboe6586ee82007-03-06 19:46:09 +0100695 ts->members++;
Jens Axboe756867b2007-03-06 15:19:24 +0100696
Jens Axboe7abd0e32007-03-12 15:24:43 +0100697 if (ts->groupid == -1) {
Jens Axboe2dc84ba2007-03-06 15:46:33 +0100698 /*
699 * These are per-group shared already
700 */
Jens Axboe756867b2007-03-06 15:19:24 +0100701 ts->name = td->name;
702 ts->description = td->description;
Jens Axboe756867b2007-03-06 15:19:24 +0100703 ts->groupid = td->groupid;
Jens Axboe2dc84ba2007-03-06 15:46:33 +0100704
705 /*
706 * first pid in group, not very useful...
707 */
Jens Axboe756867b2007-03-06 15:19:24 +0100708 ts->pid = td->pid;
Jens Axboe2dc84ba2007-03-06 15:46:33 +0100709 }
710
711 if (td->error && !ts->error) {
712 ts->error = td->error;
Jens Axboe756867b2007-03-06 15:19:24 +0100713 ts->verror = td->verror;
714 }
715
Jens Axboede64df02007-03-08 19:09:49 +0100716 for (l = 0; l <= DDIR_WRITE; l++) {
Jens Axboe197574e2007-03-08 15:35:11 +0100717 sum_stat(&ts->clat_stat[l], &td->ts.clat_stat[l], idx);
718 sum_stat(&ts->slat_stat[l], &td->ts.slat_stat[l], idx);
719 sum_stat(&ts->bw_stat[l], &td->ts.bw_stat[l], idx);
Jens Axboe756867b2007-03-06 15:19:24 +0100720
Jens Axboe197574e2007-03-08 15:35:11 +0100721 ts->stat_io_bytes[l] += td->ts.stat_io_bytes[l];
722 ts->io_bytes[l] += td->ts.io_bytes[l];
723
724 if (ts->runtime[l] < td->ts.runtime[l])
725 ts->runtime[l] = td->ts.runtime[l];
726 }
Jens Axboe756867b2007-03-06 15:19:24 +0100727
728 ts->usr_time += td->ts.usr_time;
729 ts->sys_time += td->ts.sys_time;
730 ts->ctx += td->ts.ctx;
731
732 for (k = 0; k < FIO_IO_U_MAP_NR; k++)
733 ts->io_u_map[k] += td->ts.io_u_map[k];
734 for (k = 0; k < FIO_IO_U_LAT_NR; k++)
735 ts->io_u_lat[k] += td->ts.io_u_lat[k];
736
Jens Axboeb3605062007-03-12 14:19:47 +0100737 for (k = 0; k <= DDIR_WRITE; k++)
738 ts->total_io_u[k] += td->ts.total_io_u[k];
Jens Axboe756867b2007-03-06 15:19:24 +0100739
740 ts->total_run_time += td->ts.total_run_time;
Jens Axboe756867b2007-03-06 15:19:24 +0100741 }
742
743 for (i = 0; i < nr_ts; i++) {
Jens Axboe94370ac2007-03-08 15:28:10 +0100744 unsigned long long bw;
Jens Axboe3c39a372006-06-06 20:56:12 +0200745
Jens Axboe756867b2007-03-06 15:19:24 +0100746 ts = &threadstats[i];
747 rs = &runstats[ts->groupid];
Jens Axboe3c39a372006-06-06 20:56:12 +0200748
Jens Axboede64df02007-03-08 19:09:49 +0100749 for (j = 0; j <= DDIR_WRITE; j++) {
Jens Axboe94370ac2007-03-08 15:28:10 +0100750 if (!ts->runtime[j])
751 continue;
752 if (ts->runtime[j] < rs->min_run[j] || !rs->min_run[j])
753 rs->min_run[j] = ts->runtime[j];
754 if (ts->runtime[j] > rs->max_run[j])
755 rs->max_run[j] = ts->runtime[j];
Jens Axboe3c39a372006-06-06 20:56:12 +0200756
Jens Axboe94370ac2007-03-08 15:28:10 +0100757 bw = 0;
758 if (ts->runtime[j])
759 bw = ts->io_bytes[j] / (unsigned long long) ts->runtime[j];
760 if (bw < rs->min_bw[j])
761 rs->min_bw[j] = bw;
762 if (bw > rs->max_bw[j])
763 rs->max_bw[j] = bw;
Jens Axboe3c39a372006-06-06 20:56:12 +0200764
Jens Axboe94370ac2007-03-08 15:28:10 +0100765 rs->io_kb[j] += ts->io_bytes[j] >> 10;
766 }
Jens Axboe3c39a372006-06-06 20:56:12 +0200767 }
768
769 for (i = 0; i < groupid + 1; i++) {
770 rs = &runstats[i];
771
772 if (rs->max_run[0])
773 rs->agg[0] = (rs->io_kb[0]*1024) / rs->max_run[0];
774 if (rs->max_run[1])
775 rs->agg[1] = (rs->io_kb[1]*1024) / rs->max_run[1];
776 }
777
778 /*
779 * don't overwrite last signal output
780 */
Jens Axboec6ae0a52006-06-12 11:04:44 +0200781 if (!terse_output)
782 printf("\n");
Jens Axboe3c39a372006-06-06 20:56:12 +0200783
Jens Axboe756867b2007-03-06 15:19:24 +0100784 for (i = 0; i < nr_ts; i++) {
785 ts = &threadstats[i];
786 rs = &runstats[ts->groupid];
Jens Axboe3c39a372006-06-06 20:56:12 +0200787
Jens Axboec6ae0a52006-06-12 11:04:44 +0200788 if (terse_output)
Jens Axboe756867b2007-03-06 15:19:24 +0100789 show_thread_status_terse(ts, rs);
Jens Axboec6ae0a52006-06-12 11:04:44 +0200790 else
Jens Axboe756867b2007-03-06 15:19:24 +0100791 show_thread_status(ts, rs);
Jens Axboe3c39a372006-06-06 20:56:12 +0200792 }
793
Jens Axboec6ae0a52006-06-12 11:04:44 +0200794 if (!terse_output) {
795 for (i = 0; i < groupid + 1; i++)
796 show_group_stats(&runstats[i], i);
Jens Axboe3c39a372006-06-06 20:56:12 +0200797
Jens Axboec6ae0a52006-06-12 11:04:44 +0200798 show_disk_util();
799 }
Jens Axboeeecf2722006-10-20 14:00:36 +0200800
801 free(runstats);
Jens Axboe756867b2007-03-06 15:19:24 +0100802 free(threadstats);
Jens Axboe3c39a372006-06-06 20:56:12 +0200803}
804
Jens Axboe68704082007-01-10 19:56:37 +0100805static inline void add_stat_sample(struct io_stat *is, unsigned long data)
Jens Axboe3c39a372006-06-06 20:56:12 +0200806{
Jens Axboe68704082007-01-10 19:56:37 +0100807 double val = data;
Jens Axboe6660cc62007-03-06 15:48:38 +0100808 double delta;
Jens Axboe3c39a372006-06-06 20:56:12 +0200809
Jens Axboe68704082007-01-10 19:56:37 +0100810 if (data > is->max_val)
811 is->max_val = data;
812 if (data < is->min_val)
813 is->min_val = data;
814
815 delta = val - is->mean;
Jens Axboe6660cc62007-03-06 15:48:38 +0100816 is->mean += delta / (is->samples + 1.0);
Jens Axboe68704082007-01-10 19:56:37 +0100817 is->S += delta * (val - is->mean);
818
Jens Axboe3c39a372006-06-06 20:56:12 +0200819 is->samples++;
820}
821
Jens Axboebb3884d2007-01-17 17:23:11 +1100822static void __add_log_sample(struct io_log *iolog, unsigned long val,
823 enum fio_ddir ddir, unsigned long time)
Jens Axboe3c39a372006-06-06 20:56:12 +0200824{
825 if (iolog->nr_samples == iolog->max_samples) {
826 int new_size = sizeof(struct io_sample) * iolog->max_samples*2;
827
828 iolog->log = realloc(iolog->log, new_size);
829 iolog->max_samples <<= 1;
830 }
831
832 iolog->log[iolog->nr_samples].val = val;
Jens Axboebb3884d2007-01-17 17:23:11 +1100833 iolog->log[iolog->nr_samples].time = time;
Jens Axboe3c39a372006-06-06 20:56:12 +0200834 iolog->log[iolog->nr_samples].ddir = ddir;
835 iolog->nr_samples++;
836}
837
Jens Axboebb3884d2007-01-17 17:23:11 +1100838static void add_log_sample(struct thread_data *td, struct io_log *iolog,
839 unsigned long val, enum fio_ddir ddir)
840{
841 __add_log_sample(iolog, val, ddir, mtime_since_now(&td->epoch));
842}
843
844void add_agg_sample(unsigned long val, enum fio_ddir ddir)
845{
846 struct io_log *iolog = agg_io_log[ddir];
847
848 __add_log_sample(iolog, val, ddir, mtime_since_genesis());
849}
850
Jens Axboe1e97cce2006-12-05 11:44:16 +0100851void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
852 unsigned long msec)
Jens Axboe3c39a372006-06-06 20:56:12 +0200853{
Jens Axboe756867b2007-03-06 15:19:24 +0100854 struct thread_stat *ts = &td->ts;
Jens Axboe3c39a372006-06-06 20:56:12 +0200855
Jens Axboe079ad092007-02-20 13:58:20 +0100856 add_stat_sample(&ts->clat_stat[ddir], msec);
857
858 if (ts->clat_log)
859 add_log_sample(td, ts->clat_log, msec, ddir);
Jens Axboe3c39a372006-06-06 20:56:12 +0200860}
861
Jens Axboe1e97cce2006-12-05 11:44:16 +0100862void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
863 unsigned long msec)
Jens Axboe3c39a372006-06-06 20:56:12 +0200864{
Jens Axboe756867b2007-03-06 15:19:24 +0100865 struct thread_stat *ts = &td->ts;
Jens Axboe3c39a372006-06-06 20:56:12 +0200866
Jens Axboe079ad092007-02-20 13:58:20 +0100867 add_stat_sample(&ts->slat_stat[ddir], msec);
868
869 if (ts->slat_log)
870 add_log_sample(td, ts->slat_log, msec, ddir);
Jens Axboe3c39a372006-06-06 20:56:12 +0200871}
872
Jens Axboe1e97cce2006-12-05 11:44:16 +0100873void add_bw_sample(struct thread_data *td, enum fio_ddir ddir,
874 struct timeval *t)
Jens Axboe3c39a372006-06-06 20:56:12 +0200875{
Jens Axboe756867b2007-03-06 15:19:24 +0100876 struct thread_stat *ts = &td->ts;
Jens Axboe079ad092007-02-20 13:58:20 +0100877 unsigned long spent = mtime_since(&ts->stat_sample_time[ddir], t);
Jens Axboe3c39a372006-06-06 20:56:12 +0200878 unsigned long rate;
879
880 if (spent < td->bw_avg_time)
881 return;
882
Jens Axboe079ad092007-02-20 13:58:20 +0100883 rate = (td->this_io_bytes[ddir] - ts->stat_io_bytes[ddir]) / spent;
884 add_stat_sample(&ts->bw_stat[ddir], rate);
Jens Axboe3c39a372006-06-06 20:56:12 +0200885
Jens Axboe079ad092007-02-20 13:58:20 +0100886 if (ts->bw_log)
887 add_log_sample(td, ts->bw_log, rate, ddir);
Jens Axboe3c39a372006-06-06 20:56:12 +0200888
Jens Axboe079ad092007-02-20 13:58:20 +0100889 fio_gettime(&ts->stat_sample_time[ddir], NULL);
890 ts->stat_io_bytes[ddir] = td->this_io_bytes[ddir];
Jens Axboe3c39a372006-06-06 20:56:12 +0200891}