Lines Matching refs:td
81 static void reset_io_counters(struct thread_data *td, int all) in reset_io_counters() argument
87 td->stat_io_bytes[ddir] = 0; in reset_io_counters()
88 td->this_io_bytes[ddir] = 0; in reset_io_counters()
89 td->stat_io_blocks[ddir] = 0; in reset_io_counters()
90 td->this_io_blocks[ddir] = 0; in reset_io_counters()
91 td->rate_bytes[ddir] = 0; in reset_io_counters()
92 td->rate_blocks[ddir] = 0; in reset_io_counters()
93 td->bytes_done[ddir] = 0; in reset_io_counters()
94 td->rate_io_issue_bytes[ddir] = 0; in reset_io_counters()
95 td->rate_next_io_time[ddir] = 0; in reset_io_counters()
99 td->zone_bytes = 0; in reset_io_counters()
101 td->last_was_sync = 0; in reset_io_counters()
102 td->rwmix_issues = 0; in reset_io_counters()
107 if (td->o.time_based || td->o.loops || td->o.do_verify) in reset_io_counters()
108 td->nr_done_files = 0; in reset_io_counters()
111 void clear_io_state(struct thread_data *td, int all) in clear_io_state() argument
116 reset_io_counters(td, all); in clear_io_state()
118 close_files(td); in clear_io_state()
119 for_each_file(td, f, i) { in clear_io_state()
121 f->file_offset = get_start_offset(td, f); in clear_io_state()
127 if (td->o.rand_repeatable) in clear_io_state()
128 td_fill_rand_seeds(td); in clear_io_state()
131 void reset_all_stats(struct thread_data *td) in reset_all_stats() argument
135 reset_io_counters(td, 1); in reset_all_stats()
138 td->io_bytes[i] = 0; in reset_all_stats()
139 td->io_blocks[i] = 0; in reset_all_stats()
140 td->io_issues[i] = 0; in reset_all_stats()
141 td->ts.total_io_u[i] = 0; in reset_all_stats()
142 td->ts.runtime[i] = 0; in reset_all_stats()
143 td->rwmix_issues = 0; in reset_all_stats()
146 set_epoch_time(td, td->o.log_unix_epoch); in reset_all_stats()
147 memcpy(&td->start, &td->epoch, sizeof(struct timeval)); in reset_all_stats()
148 memcpy(&td->iops_sample_time, &td->epoch, sizeof(struct timeval)); in reset_all_stats()
149 memcpy(&td->bw_sample_time, &td->epoch, sizeof(struct timeval)); in reset_all_stats()
150 memcpy(&td->ss.prev_time, &td->epoch, sizeof(struct timeval)); in reset_all_stats()
152 lat_target_reset(td); in reset_all_stats()
153 clear_rusage_stat(td); in reset_all_stats()
205 void td_set_runstate(struct thread_data *td, int runstate) in td_set_runstate() argument
207 if (td->runstate == runstate) in td_set_runstate()
210 dprint(FD_PROCESS, "pid=%d: runstate %s -> %s\n", (int) td->pid, in td_set_runstate()
211 runstate_to_name(td->runstate), in td_set_runstate()
213 td->runstate = runstate; in td_set_runstate()
216 int td_bump_runstate(struct thread_data *td, int new_state) in td_bump_runstate() argument
218 int old_state = td->runstate; in td_bump_runstate()
220 td_set_runstate(td, new_state); in td_bump_runstate()
224 void td_restore_runstate(struct thread_data *td, int old_state) in td_restore_runstate() argument
226 td_set_runstate(td, old_state); in td_restore_runstate()
229 void fio_mark_td_terminate(struct thread_data *td) in fio_mark_td_terminate() argument
231 fio_gettime(&td->terminate_time, NULL); in fio_mark_td_terminate()
233 td->terminate = 1; in fio_mark_td_terminate()
238 struct thread_data *td; in fio_terminate_threads() local
244 for_each_td(td, i) { in fio_terminate_threads()
245 if (group_id == TERMINATE_ALL || group_id == td->groupid) { in fio_terminate_threads()
247 td->o.name, (int) td->pid); in fio_terminate_threads()
249 if (td->terminate) in fio_terminate_threads()
252 fio_mark_td_terminate(td); in fio_terminate_threads()
253 td->o.start_delay = 0; in fio_terminate_threads()
258 if (!td->pid || pid == td->pid) in fio_terminate_threads()
260 else if (td->runstate < TD_RAMP) in fio_terminate_threads()
261 kill(td->pid, SIGTERM); in fio_terminate_threads()
263 struct ioengine_ops *ops = td->io_ops; in fio_terminate_threads()
266 ops->terminate(td); in fio_terminate_threads()
274 struct thread_data *td; in fio_running_or_pending_io_threads() local
278 for_each_td(td, i) { in fio_running_or_pending_io_threads()
279 if (td->io_ops_init && td_ioengine_flagged(td, FIO_NOIO)) in fio_running_or_pending_io_threads()
282 if (td->runstate < TD_EXITED) in fio_running_or_pending_io_threads()