Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Status and ETA code |
| 3 | */ |
| 4 | #include <unistd.h> |
| 5 | #include <fcntl.h> |
| 6 | #include <string.h> |
| 7 | |
| 8 | #include "fio.h" |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 9 | |
Jens Axboe | fca7035 | 2011-07-06 20:12:54 +0200 | [diff] [blame] | 10 | static char run_str[REAL_MAX_JOBS + 1]; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 11 | |
| 12 | /* |
| 13 | * Sets the status of the 'td' in the printed status map. |
| 14 | */ |
| 15 | static void check_str_update(struct thread_data *td) |
| 16 | { |
| 17 | char c = run_str[td->thread_number - 1]; |
| 18 | |
| 19 | switch (td->runstate) { |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 20 | case TD_REAPED: |
Jens Axboe | 4f7e57a | 2012-03-30 21:21:20 +0200 | [diff] [blame] | 21 | if (td->error) |
| 22 | c = 'X'; |
Jens Axboe | a5e371a | 2012-04-02 09:47:09 -0700 | [diff] [blame] | 23 | else if (td->sig) |
| 24 | c = 'K'; |
Jens Axboe | 4f7e57a | 2012-03-30 21:21:20 +0200 | [diff] [blame] | 25 | else |
| 26 | c = '_'; |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 27 | break; |
| 28 | case TD_EXITED: |
| 29 | c = 'E'; |
| 30 | break; |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 31 | case TD_RAMP: |
| 32 | c = '/'; |
| 33 | break; |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 34 | case TD_RUNNING: |
| 35 | if (td_rw(td)) { |
Jens Axboe | e3b3f81 | 2011-09-01 09:58:11 -0600 | [diff] [blame] | 36 | if (td_random(td)) { |
| 37 | if (td->o.rwmix[DDIR_READ] == 100) |
| 38 | c = 'r'; |
| 39 | else if (td->o.rwmix[DDIR_WRITE] == 100) |
| 40 | c = 'w'; |
| 41 | else |
| 42 | c = 'm'; |
| 43 | } else { |
| 44 | if (td->o.rwmix[DDIR_READ] == 100) |
| 45 | c = 'R'; |
| 46 | else if (td->o.rwmix[DDIR_WRITE] == 100) |
| 47 | c = 'W'; |
| 48 | else |
| 49 | c = 'M'; |
| 50 | } |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 51 | } else if (td_read(td)) { |
| 52 | if (td_random(td)) |
| 53 | c = 'r'; |
| 54 | else |
| 55 | c = 'R'; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 56 | } else if (td_write(td)) { |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 57 | if (td_random(td)) |
| 58 | c = 'w'; |
| 59 | else |
| 60 | c = 'W'; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 61 | } else { |
| 62 | if (td_random(td)) |
| 63 | c = 'd'; |
| 64 | else |
| 65 | c = 'D'; |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 66 | } |
| 67 | break; |
Jens Axboe | b0f6586 | 2009-05-20 11:52:15 +0200 | [diff] [blame] | 68 | case TD_PRE_READING: |
| 69 | c = 'p'; |
| 70 | break; |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 71 | case TD_VERIFYING: |
| 72 | c = 'V'; |
| 73 | break; |
| 74 | case TD_FSYNCING: |
| 75 | c = 'F'; |
| 76 | break; |
| 77 | case TD_CREATED: |
| 78 | c = 'C'; |
| 79 | break; |
| 80 | case TD_INITIALIZED: |
Jens Axboe | 9c6f631 | 2012-11-07 09:15:45 +0100 | [diff] [blame] | 81 | case TD_SETTING_UP: |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 82 | c = 'I'; |
| 83 | break; |
| 84 | case TD_NOT_CREATED: |
| 85 | c = 'P'; |
| 86 | break; |
| 87 | default: |
| 88 | log_err("state %d\n", td->runstate); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | run_str[td->thread_number - 1] = c; |
| 92 | } |
| 93 | |
| 94 | /* |
| 95 | * Convert seconds to a printable string. |
| 96 | */ |
Jens Axboe | 3e47bd2 | 2012-02-29 13:45:02 +0100 | [diff] [blame] | 97 | void eta_to_str(char *str, unsigned long eta_sec) |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 98 | { |
| 99 | unsigned int d, h, m, s; |
Jens Axboe | 165faf1 | 2007-02-07 11:30:37 +0100 | [diff] [blame] | 100 | int disp_hour = 0; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 101 | |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 102 | s = eta_sec % 60; |
| 103 | eta_sec /= 60; |
| 104 | m = eta_sec % 60; |
| 105 | eta_sec /= 60; |
| 106 | h = eta_sec % 24; |
| 107 | eta_sec /= 24; |
| 108 | d = eta_sec; |
| 109 | |
Jens Axboe | 165faf1 | 2007-02-07 11:30:37 +0100 | [diff] [blame] | 110 | if (d) { |
| 111 | disp_hour = 1; |
Jens Axboe | 1e97cce | 2006-12-05 11:44:16 +0100 | [diff] [blame] | 112 | str += sprintf(str, "%02ud:", d); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 113 | } |
Jens Axboe | 165faf1 | 2007-02-07 11:30:37 +0100 | [diff] [blame] | 114 | |
| 115 | if (h || disp_hour) |
Jens Axboe | 1e97cce | 2006-12-05 11:44:16 +0100 | [diff] [blame] | 116 | str += sprintf(str, "%02uh:", h); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 117 | |
Jens Axboe | 1e97cce | 2006-12-05 11:44:16 +0100 | [diff] [blame] | 118 | str += sprintf(str, "%02um:", m); |
| 119 | str += sprintf(str, "%02us", s); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | /* |
| 123 | * Best effort calculation of the estimated pending runtime of a job. |
| 124 | */ |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 125 | static int thread_eta(struct thread_data *td) |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 126 | { |
| 127 | unsigned long long bytes_total, bytes_done; |
Jens Axboe | 1e97cce | 2006-12-05 11:44:16 +0100 | [diff] [blame] | 128 | unsigned long eta_sec = 0; |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 129 | unsigned long elapsed; |
| 130 | |
| 131 | elapsed = (mtime_since_now(&td->epoch) + 999) / 1000; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 132 | |
| 133 | bytes_total = td->total_io_size; |
| 134 | |
Jens Axboe | 2e3bd4c | 2010-05-17 12:29:57 +0200 | [diff] [blame] | 135 | if (td->o.fill_device && td->o.size == -1ULL) { |
| 136 | if (!td->fill_device_size || td->fill_device_size == -1ULL) |
| 137 | return 0; |
| 138 | |
| 139 | bytes_total = td->fill_device_size; |
| 140 | } |
| 141 | |
Jens Axboe | 0d73a2f | 2013-02-07 12:54:10 +0100 | [diff] [blame] | 142 | if (td->o.zone_size && td->o.zone_skip && bytes_total) { |
| 143 | unsigned int nr_zones; |
| 144 | uint64_t zone_bytes; |
| 145 | |
| 146 | zone_bytes = bytes_total + td->o.zone_size + td->o.zone_skip; |
| 147 | nr_zones = (zone_bytes - 1) / (td->o.zone_size + td->o.zone_skip); |
| 148 | bytes_total -= nr_zones * td->o.zone_skip; |
| 149 | } |
| 150 | |
Jens Axboe | 74939e3 | 2006-10-19 20:37:12 +0200 | [diff] [blame] | 151 | /* |
Jens Axboe | 165eb05 | 2013-01-23 08:40:11 -0700 | [diff] [blame] | 152 | * if writing and verifying afterwards, bytes_total will be twice the |
| 153 | * size. In a mixed workload, verify phase will be the size of the |
| 154 | * first stage writes. |
Jens Axboe | 74939e3 | 2006-10-19 20:37:12 +0200 | [diff] [blame] | 155 | */ |
Jens Axboe | 0dd8377 | 2007-09-04 12:38:28 +0200 | [diff] [blame] | 156 | if (td->o.do_verify && td->o.verify && td_write(td)) { |
Jens Axboe | 165eb05 | 2013-01-23 08:40:11 -0700 | [diff] [blame] | 157 | if (td_rw(td)) { |
| 158 | unsigned int perc = 50; |
| 159 | |
| 160 | if (td->o.rwmix[DDIR_WRITE]) |
| 161 | perc = td->o.rwmix[DDIR_WRITE]; |
| 162 | |
| 163 | bytes_total += (bytes_total * perc) / 100; |
| 164 | } else |
Jens Axboe | 74939e3 | 2006-10-19 20:37:12 +0200 | [diff] [blame] | 165 | bytes_total <<= 1; |
| 166 | } |
| 167 | |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 168 | if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING) { |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 169 | double perc, perc_t; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 170 | |
Jens Axboe | 342f4be | 2012-09-14 08:59:20 +0200 | [diff] [blame] | 171 | bytes_done = ddir_rw_sum(td->io_bytes); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 172 | perc = (double) bytes_done / (double) bytes_total; |
| 173 | if (perc > 1.0) |
| 174 | perc = 1.0; |
| 175 | |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 176 | if (td->o.time_based) { |
Christian Ehrhardt | 74454ce | 2014-02-20 14:20:01 +0100 | [diff] [blame] | 177 | perc_t = (double) elapsed / |
| 178 | (double) (td->o.timeout / 1000); |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 179 | if (perc_t < perc) |
| 180 | perc = perc_t; |
| 181 | } |
| 182 | |
Jens Axboe | 1e97cce | 2006-12-05 11:44:16 +0100 | [diff] [blame] | 183 | eta_sec = (unsigned long) (elapsed * (1.0 / perc)) - elapsed; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 184 | |
Jens Axboe | d3eeeab | 2008-04-06 12:19:05 +0200 | [diff] [blame] | 185 | if (td->o.timeout && |
Christian Ehrhardt | 74454ce | 2014-02-20 14:20:01 +0100 | [diff] [blame] | 186 | eta_sec > ( (td->o.timeout / 1000) + done_secs - elapsed)) |
| 187 | eta_sec = (td->o.timeout / 1000) + done_secs |
| 188 | - elapsed; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 189 | } else if (td->runstate == TD_NOT_CREATED || td->runstate == TD_CREATED |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 190 | || td->runstate == TD_INITIALIZED |
Jens Axboe | 714e85f | 2013-04-15 10:21:56 +0200 | [diff] [blame] | 191 | || td->runstate == TD_SETTING_UP |
Jens Axboe | b0f6586 | 2009-05-20 11:52:15 +0200 | [diff] [blame] | 192 | || td->runstate == TD_RAMP |
| 193 | || td->runstate == TD_PRE_READING) { |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 194 | int t_eta = 0, r_eta = 0; |
Jens Axboe | 342f4be | 2012-09-14 08:59:20 +0200 | [diff] [blame] | 195 | unsigned long long rate_bytes; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 196 | |
| 197 | /* |
| 198 | * We can only guess - assume it'll run the full timeout |
| 199 | * if given, otherwise assume it'll run at the specified rate. |
| 200 | */ |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 201 | if (td->o.timeout) { |
Christian Ehrhardt | 74454ce | 2014-02-20 14:20:01 +0100 | [diff] [blame] | 202 | t_eta = (td->o.timeout + td->o.start_delay + |
| 203 | td->o.ramp_time ) / 1000; |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 204 | |
| 205 | if (in_ramp_time(td)) { |
| 206 | unsigned long ramp_left; |
| 207 | |
Signed-off-by Steven Pratt | cda99fa | 2010-12-14 08:31:36 +0100 | [diff] [blame] | 208 | ramp_left = mtime_since_now(&td->epoch); |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 209 | ramp_left = (ramp_left + 999) / 1000; |
| 210 | if (ramp_left <= t_eta) |
| 211 | t_eta -= ramp_left; |
| 212 | } |
| 213 | } |
Jens Axboe | 342f4be | 2012-09-14 08:59:20 +0200 | [diff] [blame] | 214 | rate_bytes = ddir_rw_sum(td->o.rate); |
| 215 | if (rate_bytes) { |
| 216 | r_eta = (bytes_total / 1024) / rate_bytes; |
Christian Ehrhardt | 74454ce | 2014-02-20 14:20:01 +0100 | [diff] [blame] | 217 | r_eta += td->o.start_delay / 1000; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | if (r_eta && t_eta) |
| 221 | eta_sec = min(r_eta, t_eta); |
| 222 | else if (r_eta) |
| 223 | eta_sec = r_eta; |
| 224 | else if (t_eta) |
| 225 | eta_sec = t_eta; |
| 226 | else |
| 227 | eta_sec = 0; |
| 228 | } else { |
| 229 | /* |
| 230 | * thread is already done or waiting for fsync |
| 231 | */ |
| 232 | eta_sec = 0; |
| 233 | } |
| 234 | |
| 235 | return eta_sec; |
| 236 | } |
| 237 | |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 238 | static void calc_rate(int unified_rw_rep, unsigned long mtime, |
| 239 | unsigned long long *io_bytes, |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 240 | unsigned long long *prev_io_bytes, unsigned int *rate) |
| 241 | { |
Jens Axboe | b7f05eb | 2012-05-11 20:33:02 +0200 | [diff] [blame] | 242 | int i; |
| 243 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 244 | for (i = 0; i < DDIR_RWDIR_CNT; i++) { |
Jens Axboe | b7f05eb | 2012-05-11 20:33:02 +0200 | [diff] [blame] | 245 | unsigned long long diff; |
| 246 | |
| 247 | diff = io_bytes[i] - prev_io_bytes[i]; |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 248 | if (unified_rw_rep) { |
| 249 | rate[i] = 0; |
| 250 | rate[0] += ((1000 * diff) / mtime) / 1024; |
| 251 | } else |
| 252 | rate[i] = ((1000 * diff) / mtime) / 1024; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 253 | |
| 254 | prev_io_bytes[i] = io_bytes[i]; |
Jens Axboe | b7f05eb | 2012-05-11 20:33:02 +0200 | [diff] [blame] | 255 | } |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 256 | } |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 257 | |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 258 | static void calc_iops(int unified_rw_rep, unsigned long mtime, |
| 259 | unsigned long long *io_iops, |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 260 | unsigned long long *prev_io_iops, unsigned int *iops) |
| 261 | { |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 262 | int i; |
| 263 | |
| 264 | for (i = 0; i < DDIR_RWDIR_CNT; i++) { |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 265 | unsigned long long diff; |
| 266 | |
| 267 | diff = io_iops[i] - prev_io_iops[i]; |
| 268 | if (unified_rw_rep) { |
| 269 | iops[i] = 0; |
| 270 | iops[0] += (diff * 1000) / mtime; |
| 271 | } else |
| 272 | iops[i] = (diff * 1000) / mtime; |
| 273 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 274 | prev_io_iops[i] = io_iops[i]; |
| 275 | } |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 276 | } |
| 277 | |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 278 | /* |
| 279 | * Print status of the jobs we know about. This includes rate estimates, |
| 280 | * ETA, thread state, etc. |
| 281 | */ |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 282 | int calc_thread_status(struct jobs_eta *je, int force) |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 283 | { |
Jens Axboe | 34572e2 | 2006-10-20 09:33:18 +0200 | [diff] [blame] | 284 | struct thread_data *td; |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 285 | int i, unified_rw_rep; |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 286 | unsigned long rate_time, disp_time, bw_avg_time, *eta_secs; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 287 | unsigned long long io_bytes[DDIR_RWDIR_CNT]; |
| 288 | unsigned long long io_iops[DDIR_RWDIR_CNT]; |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 289 | struct timeval now; |
| 290 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 291 | static unsigned long long rate_io_bytes[DDIR_RWDIR_CNT]; |
| 292 | static unsigned long long disp_io_bytes[DDIR_RWDIR_CNT]; |
| 293 | static unsigned long long disp_io_iops[DDIR_RWDIR_CNT]; |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 294 | static struct timeval rate_prev_time, disp_prev_time; |
Jens Axboe | 6043c57 | 2006-11-03 11:37:47 +0100 | [diff] [blame] | 295 | |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 296 | if (!force) { |
Jens Axboe | fc47559 | 2013-01-31 15:24:34 +0100 | [diff] [blame] | 297 | if (output_format != FIO_OUTPUT_NORMAL && |
| 298 | f_out == stdout) |
Jens Axboe | f3afa57 | 2012-09-17 13:34:16 +0200 | [diff] [blame] | 299 | return 0; |
| 300 | if (temp_stall_ts || eta_print == FIO_ETA_NEVER) |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 301 | return 0; |
Aaron Carroll | e592a06 | 2007-09-14 09:49:41 +0200 | [diff] [blame] | 302 | |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 303 | if (!isatty(STDOUT_FILENO) && (eta_print != FIO_ETA_ALWAYS)) |
| 304 | return 0; |
| 305 | } |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 306 | |
Jens Axboe | 342f4be | 2012-09-14 08:59:20 +0200 | [diff] [blame] | 307 | if (!ddir_rw_sum(rate_io_bytes)) |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 308 | fill_start_time(&rate_prev_time); |
Jens Axboe | 342f4be | 2012-09-14 08:59:20 +0200 | [diff] [blame] | 309 | if (!ddir_rw_sum(disp_io_bytes)) |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 310 | fill_start_time(&disp_prev_time); |
Jens Axboe | 6043c57 | 2006-11-03 11:37:47 +0100 | [diff] [blame] | 311 | |
Jens Axboe | d3eeeab | 2008-04-06 12:19:05 +0200 | [diff] [blame] | 312 | eta_secs = malloc(thread_number * sizeof(unsigned long)); |
| 313 | memset(eta_secs, 0, thread_number * sizeof(unsigned long)); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 314 | |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 315 | je->elapsed_sec = (mtime_since_genesis() + 999) / 1000; |
| 316 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 317 | io_bytes[DDIR_READ] = io_bytes[DDIR_WRITE] = io_bytes[DDIR_TRIM] = 0; |
| 318 | io_iops[DDIR_READ] = io_iops[DDIR_WRITE] = io_iops[DDIR_TRIM] = 0; |
Jens Axboe | bb3884d | 2007-01-17 17:23:11 +1100 | [diff] [blame] | 319 | bw_avg_time = ULONG_MAX; |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 320 | unified_rw_rep = 0; |
Jens Axboe | 34572e2 | 2006-10-20 09:33:18 +0200 | [diff] [blame] | 321 | for_each_td(td, i) { |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 322 | unified_rw_rep += td->o.unified_rw_rep; |
Jens Axboe | b7f05eb | 2012-05-11 20:33:02 +0200 | [diff] [blame] | 323 | if (is_power_of_2(td->o.kb_base)) |
| 324 | je->is_pow2 = 1; |
Steven Noonan | ad705bc | 2013-04-08 15:05:25 -0700 | [diff] [blame] | 325 | je->unit_base = td->o.unit_base; |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 326 | if (td->o.bw_avg_time < bw_avg_time) |
| 327 | bw_avg_time = td->o.bw_avg_time; |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 328 | if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING |
Jens Axboe | b0f6586 | 2009-05-20 11:52:15 +0200 | [diff] [blame] | 329 | || td->runstate == TD_FSYNCING |
| 330 | || td->runstate == TD_PRE_READING) { |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 331 | je->nr_running++; |
Jens Axboe | 242c38d | 2012-08-20 14:44:22 +0200 | [diff] [blame] | 332 | if (td_read(td)) { |
Jens Axboe | c2e9cc4 | 2012-08-21 15:34:13 +0200 | [diff] [blame] | 333 | je->t_rate[0] += td->o.rate[DDIR_READ]; |
| 334 | je->t_iops[0] += td->o.rate_iops[DDIR_READ]; |
| 335 | je->m_rate[0] += td->o.ratemin[DDIR_READ]; |
| 336 | je->m_iops[0] += td->o.rate_iops_min[DDIR_READ]; |
Jens Axboe | 242c38d | 2012-08-20 14:44:22 +0200 | [diff] [blame] | 337 | } |
| 338 | if (td_write(td)) { |
Jens Axboe | c2e9cc4 | 2012-08-21 15:34:13 +0200 | [diff] [blame] | 339 | je->t_rate[1] += td->o.rate[DDIR_WRITE]; |
| 340 | je->t_iops[1] += td->o.rate_iops[DDIR_WRITE]; |
| 341 | je->m_rate[1] += td->o.ratemin[DDIR_WRITE]; |
| 342 | je->m_iops[1] += td->o.rate_iops_min[DDIR_WRITE]; |
Jens Axboe | 242c38d | 2012-08-20 14:44:22 +0200 | [diff] [blame] | 343 | } |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 344 | if (td_trim(td)) { |
Jens Axboe | d79db12 | 2012-09-24 08:51:24 +0200 | [diff] [blame] | 345 | je->t_rate[2] += td->o.rate[DDIR_TRIM]; |
| 346 | je->t_iops[2] += td->o.rate_iops[DDIR_TRIM]; |
| 347 | je->m_rate[2] += td->o.ratemin[DDIR_TRIM]; |
| 348 | je->m_iops[2] += td->o.rate_iops_min[DDIR_TRIM]; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 349 | } |
| 350 | |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 351 | je->files_open += td->nr_open_files; |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 352 | } else if (td->runstate == TD_RAMP) { |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 353 | je->nr_running++; |
| 354 | je->nr_ramp++; |
Jens Axboe | 714e85f | 2013-04-15 10:21:56 +0200 | [diff] [blame] | 355 | } else if (td->runstate == TD_SETTING_UP) { |
Jens Axboe | 9c6f631 | 2012-11-07 09:15:45 +0100 | [diff] [blame] | 356 | je->nr_running++; |
Jens Axboe | 714e85f | 2013-04-15 10:21:56 +0200 | [diff] [blame] | 357 | je->nr_setting_up++; |
| 358 | } else if (td->runstate < TD_RUNNING) |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 359 | je->nr_pending++; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 360 | |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 361 | if (je->elapsed_sec >= 3) |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 362 | eta_secs[i] = thread_eta(td); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 363 | else |
| 364 | eta_secs[i] = INT_MAX; |
| 365 | |
| 366 | check_str_update(td); |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 367 | |
Jens Axboe | 714e85f | 2013-04-15 10:21:56 +0200 | [diff] [blame] | 368 | if (td->runstate > TD_SETTING_UP) { |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 369 | int ddir; |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 370 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 371 | for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) { |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 372 | if (unified_rw_rep) { |
| 373 | io_bytes[0] += td->io_bytes[ddir]; |
| 374 | io_iops[0] += td->io_blocks[ddir]; |
| 375 | } else { |
| 376 | io_bytes[ddir] += td->io_bytes[ddir]; |
| 377 | io_iops[ddir] += td->io_blocks[ddir]; |
| 378 | } |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 379 | } |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 380 | } |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | if (exitall_on_terminate) |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 384 | je->eta_sec = INT_MAX; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 385 | else |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 386 | je->eta_sec = 0; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 387 | |
Jens Axboe | 34572e2 | 2006-10-20 09:33:18 +0200 | [diff] [blame] | 388 | for_each_td(td, i) { |
Shaozhi Shawn Ye | 9c5a385 | 2008-09-10 09:09:37 +0200 | [diff] [blame] | 389 | if (exitall_on_terminate) { |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 390 | if (eta_secs[i] < je->eta_sec) |
| 391 | je->eta_sec = eta_secs[i]; |
Shaozhi Shawn Ye | 9c5a385 | 2008-09-10 09:09:37 +0200 | [diff] [blame] | 392 | } else { |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 393 | if (eta_secs[i] > je->eta_sec) |
| 394 | je->eta_sec = eta_secs[i]; |
Shaozhi Shawn Ye | 9c5a385 | 2008-09-10 09:09:37 +0200 | [diff] [blame] | 395 | } |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 396 | } |
| 397 | |
Jens Axboe | eecf272 | 2006-10-20 14:00:36 +0200 | [diff] [blame] | 398 | free(eta_secs); |
| 399 | |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 400 | fio_gettime(&now, NULL); |
| 401 | rate_time = mtime_since(&rate_prev_time, &now); |
| 402 | |
Jens Axboe | b29ee5b | 2008-09-11 10:17:26 +0200 | [diff] [blame] | 403 | if (write_bw_log && rate_time > bw_avg_time && !in_ramp_time(td)) { |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 404 | calc_rate(unified_rw_rep, rate_time, io_bytes, rate_io_bytes, |
| 405 | je->rate); |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 406 | memcpy(&rate_prev_time, &now, sizeof(now)); |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 407 | add_agg_sample(je->rate[DDIR_READ], DDIR_READ, 0); |
| 408 | add_agg_sample(je->rate[DDIR_WRITE], DDIR_WRITE, 0); |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 409 | add_agg_sample(je->rate[DDIR_TRIM], DDIR_TRIM, 0); |
Jens Axboe | 6043c57 | 2006-11-03 11:37:47 +0100 | [diff] [blame] | 410 | } |
| 411 | |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 412 | disp_time = mtime_since(&disp_prev_time, &now); |
Jens Axboe | a5b01f1 | 2010-11-11 09:19:49 +0100 | [diff] [blame] | 413 | |
| 414 | /* |
| 415 | * Allow a little slack, the target is to print it every 1000 msecs |
| 416 | */ |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 417 | if (!force && disp_time < 900) |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 418 | return 0; |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 419 | |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame] | 420 | calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je->rate); |
| 421 | calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je->iops); |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 422 | |
Jens Axboe | 46fda8d | 2007-02-11 00:49:30 +0100 | [diff] [blame] | 423 | memcpy(&disp_prev_time, &now, sizeof(now)); |
| 424 | |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 425 | if (!force && !je->nr_running && !je->nr_pending) |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 426 | return 0; |
| 427 | |
Jens Axboe | 1d1f45a | 2011-10-03 19:44:41 +0200 | [diff] [blame] | 428 | je->nr_threads = thread_number; |
| 429 | memcpy(je->run_str, run_str, thread_number * sizeof(char)); |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 430 | return 1; |
| 431 | } |
| 432 | |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 433 | void display_thread_status(struct jobs_eta *je) |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 434 | { |
Jens Axboe | e382e66 | 2013-02-22 20:48:56 +0100 | [diff] [blame] | 435 | static struct timeval disp_eta_new_line; |
| 436 | static int eta_new_line_init, eta_new_line_pending; |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 437 | static int linelen_last; |
| 438 | static int eta_good; |
Jens Axboe | 79074e7 | 2012-04-18 20:39:48 +0200 | [diff] [blame] | 439 | char output[REAL_MAX_JOBS + 512], *p = output; |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 440 | char eta_str[128]; |
| 441 | double perc = 0.0; |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 442 | |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 443 | if (je->eta_sec != INT_MAX && je->elapsed_sec) { |
| 444 | perc = (double) je->elapsed_sec / (double) (je->elapsed_sec + je->eta_sec); |
| 445 | eta_to_str(eta_str, je->eta_sec); |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 446 | } |
| 447 | |
Jens Axboe | e382e66 | 2013-02-22 20:48:56 +0100 | [diff] [blame] | 448 | if (eta_new_line_pending) { |
| 449 | eta_new_line_pending = 0; |
| 450 | p += sprintf(p, "\n"); |
| 451 | } |
| 452 | |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 453 | p += sprintf(p, "Jobs: %d (f=%d)", je->nr_running, je->files_open); |
Jens Axboe | 3e47bd2 | 2012-02-29 13:45:02 +0100 | [diff] [blame] | 454 | if (je->m_rate[0] || je->m_rate[1] || je->t_rate[0] || je->t_rate[1]) { |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 455 | char *tr, *mr; |
| 456 | |
Jens Axboe | 22f8045 | 2013-04-09 20:29:16 +0200 | [diff] [blame] | 457 | mr = num2str(je->m_rate[0] + je->m_rate[1], 4, 0, je->is_pow2, 8); |
| 458 | tr = num2str(je->t_rate[0] + je->t_rate[1], 4, 0, je->is_pow2, 8); |
Jens Axboe | 37db14f | 2011-09-30 17:00:42 -0600 | [diff] [blame] | 459 | p += sprintf(p, ", CR=%s/%s KB/s", tr, mr); |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 460 | free(tr); |
| 461 | free(mr); |
Jens Axboe | 3e47bd2 | 2012-02-29 13:45:02 +0100 | [diff] [blame] | 462 | } else if (je->m_iops[0] || je->m_iops[1] || je->t_iops[0] || je->t_iops[1]) { |
| 463 | p += sprintf(p, ", CR=%d/%d IOPS", |
| 464 | je->t_iops[0] + je->t_iops[1], |
Jens Axboe | 88e4bea | 2012-08-21 15:34:36 +0200 | [diff] [blame] | 465 | je->m_iops[0] + je->m_iops[1]); |
Jens Axboe | 3e47bd2 | 2012-02-29 13:45:02 +0100 | [diff] [blame] | 466 | } |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 467 | if (je->eta_sec != INT_MAX && je->nr_running) { |
Jens Axboe | 0721d11 | 2008-06-05 09:03:05 +0200 | [diff] [blame] | 468 | char perc_str[32]; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 469 | char *iops_str[DDIR_RWDIR_CNT]; |
| 470 | char *rate_str[DDIR_RWDIR_CNT]; |
Jens Axboe | 79074e7 | 2012-04-18 20:39:48 +0200 | [diff] [blame] | 471 | size_t left; |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 472 | int l; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 473 | int ddir; |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 474 | |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 475 | if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running) |
Jens Axboe | cac58fd | 2008-06-06 01:17:03 +0200 | [diff] [blame] | 476 | strcpy(perc_str, "-.-% done"); |
| 477 | else { |
Jens Axboe | 714e85f | 2013-04-15 10:21:56 +0200 | [diff] [blame] | 478 | double mult = 100.0; |
| 479 | |
| 480 | if (je->nr_setting_up && je->nr_running) |
| 481 | mult *= (1.0 - (double) je->nr_setting_up / (double) je->nr_running); |
| 482 | |
Jens Axboe | cac58fd | 2008-06-06 01:17:03 +0200 | [diff] [blame] | 483 | eta_good = 1; |
Jens Axboe | 714e85f | 2013-04-15 10:21:56 +0200 | [diff] [blame] | 484 | perc *= mult; |
Jens Axboe | 0721d11 | 2008-06-05 09:03:05 +0200 | [diff] [blame] | 485 | sprintf(perc_str, "%3.1f%% done", perc); |
Jens Axboe | cac58fd | 2008-06-06 01:17:03 +0200 | [diff] [blame] | 486 | } |
Jens Axboe | 0721d11 | 2008-06-05 09:03:05 +0200 | [diff] [blame] | 487 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 488 | for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) { |
| 489 | rate_str[ddir] = num2str(je->rate[ddir], 5, |
Steven Noonan | ad705bc | 2013-04-08 15:05:25 -0700 | [diff] [blame] | 490 | 1024, je->is_pow2, je->unit_base); |
Steven Noonan | 73798eb | 2013-04-05 16:57:38 -0700 | [diff] [blame] | 491 | iops_str[ddir] = num2str(je->iops[ddir], 4, 1, 0, 0); |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 492 | } |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 493 | |
Jens Axboe | 79074e7 | 2012-04-18 20:39:48 +0200 | [diff] [blame] | 494 | left = sizeof(output) - (p - output) - 1; |
| 495 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 496 | l = snprintf(p, left, ": [%s] [%s] [%s/%s/%s /s] [%s/%s/%s iops] [eta %s]", |
| 497 | je->run_str, perc_str, rate_str[DDIR_READ], |
| 498 | rate_str[DDIR_WRITE], rate_str[DDIR_TRIM], |
| 499 | iops_str[DDIR_READ], iops_str[DDIR_WRITE], |
| 500 | iops_str[DDIR_TRIM], eta_str); |
Jens Axboe | 37db14f | 2011-09-30 17:00:42 -0600 | [diff] [blame] | 501 | p += l; |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 502 | if (l >= 0 && l < linelen_last) |
Jens Axboe | 37db14f | 2011-09-30 17:00:42 -0600 | [diff] [blame] | 503 | p += sprintf(p, "%*s", linelen_last - l, ""); |
Jens Axboe | adb02ba | 2009-06-03 10:47:44 +0200 | [diff] [blame] | 504 | linelen_last = l; |
Jens Axboe | d1bd721 | 2009-06-03 10:53:45 +0200 | [diff] [blame] | 505 | |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 506 | for (ddir = DDIR_READ; ddir < DDIR_RWDIR_CNT; ddir++) { |
| 507 | free(rate_str[ddir]); |
| 508 | free(iops_str[ddir]); |
| 509 | } |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 510 | } |
Jens Axboe | 37db14f | 2011-09-30 17:00:42 -0600 | [diff] [blame] | 511 | p += sprintf(p, "\r"); |
| 512 | |
Jens Axboe | 3e47bd2 | 2012-02-29 13:45:02 +0100 | [diff] [blame] | 513 | printf("%s", output); |
Jens Axboe | e382e66 | 2013-02-22 20:48:56 +0100 | [diff] [blame] | 514 | |
| 515 | if (!eta_new_line_init) { |
| 516 | fio_gettime(&disp_eta_new_line, NULL); |
| 517 | eta_new_line_init = 1; |
| 518 | } else if (eta_new_line && |
| 519 | mtime_since_now(&disp_eta_new_line) > eta_new_line * 1000) { |
| 520 | fio_gettime(&disp_eta_new_line, NULL); |
| 521 | eta_new_line_pending = 1; |
| 522 | } |
| 523 | |
Jens Axboe | 3e47bd2 | 2012-02-29 13:45:02 +0100 | [diff] [blame] | 524 | fflush(stdout); |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 525 | } |
| 526 | |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 527 | void print_thread_status(void) |
| 528 | { |
Jens Axboe | 1d1f45a | 2011-10-03 19:44:41 +0200 | [diff] [blame] | 529 | struct jobs_eta *je; |
Jens Axboe | b814fb2 | 2011-10-12 09:20:34 +0200 | [diff] [blame] | 530 | size_t size; |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 531 | |
Jens Axboe | b814fb2 | 2011-10-12 09:20:34 +0200 | [diff] [blame] | 532 | if (!thread_number) |
| 533 | return; |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 534 | |
Jens Axboe | b814fb2 | 2011-10-12 09:20:34 +0200 | [diff] [blame] | 535 | size = sizeof(*je) + thread_number * sizeof(char) + 1; |
| 536 | je = malloc(size); |
| 537 | memset(je, 0, size); |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 538 | |
Jens Axboe | af9c9fb | 2011-10-09 21:54:10 +0200 | [diff] [blame] | 539 | if (calc_thread_status(je, 0)) |
Jens Axboe | 1d1f45a | 2011-10-03 19:44:41 +0200 | [diff] [blame] | 540 | display_thread_status(je); |
| 541 | |
| 542 | free(je); |
Jens Axboe | cf451d1 | 2011-10-03 16:48:30 +0200 | [diff] [blame] | 543 | } |
Jens Axboe | b75a394 | 2011-10-03 16:03:43 +0200 | [diff] [blame] | 544 | |
Jens Axboe | 2b13e71 | 2011-01-19 14:04:16 -0700 | [diff] [blame] | 545 | void print_status_init(int thr_number) |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 546 | { |
Jens Axboe | 2b13e71 | 2011-01-19 14:04:16 -0700 | [diff] [blame] | 547 | run_str[thr_number] = 'P'; |
Jens Axboe | 263e529 | 2006-10-18 15:37:01 +0200 | [diff] [blame] | 548 | } |