Lines Matching refs:td
80 static void reset_io_counters(struct thread_data *td) in reset_io_counters() argument
85 td->stat_io_bytes[ddir] = 0; in reset_io_counters()
86 td->this_io_bytes[ddir] = 0; in reset_io_counters()
87 td->stat_io_blocks[ddir] = 0; in reset_io_counters()
88 td->this_io_blocks[ddir] = 0; in reset_io_counters()
89 td->rate_bytes[ddir] = 0; in reset_io_counters()
90 td->rate_blocks[ddir] = 0; in reset_io_counters()
92 td->zone_bytes = 0; in reset_io_counters()
94 td->last_was_sync = 0; in reset_io_counters()
95 td->rwmix_issues = 0; in reset_io_counters()
100 if (td->o.time_based || td->o.loops || td->o.do_verify) in reset_io_counters()
101 td->nr_done_files = 0; in reset_io_counters()
104 void clear_io_state(struct thread_data *td) in clear_io_state() argument
109 reset_io_counters(td); in clear_io_state()
111 close_files(td); in clear_io_state()
112 for_each_file(td, f, i) { in clear_io_state()
114 f->file_offset = get_start_offset(td, f); in clear_io_state()
120 td_fill_rand_seeds(td); in clear_io_state()
123 void reset_all_stats(struct thread_data *td) in reset_all_stats() argument
128 reset_io_counters(td); in reset_all_stats()
131 td->io_bytes[i] = 0; in reset_all_stats()
132 td->io_blocks[i] = 0; in reset_all_stats()
133 td->io_issues[i] = 0; in reset_all_stats()
134 td->ts.total_io_u[i] = 0; in reset_all_stats()
135 td->ts.runtime[i] = 0; in reset_all_stats()
136 td->rwmix_issues = 0; in reset_all_stats()
140 memcpy(&td->epoch, &tv, sizeof(tv)); in reset_all_stats()
141 memcpy(&td->start, &tv, sizeof(tv)); in reset_all_stats()
143 lat_target_reset(td); in reset_all_stats()
170 void td_set_runstate(struct thread_data *td, int runstate) in td_set_runstate() argument
172 if (td->runstate == runstate) in td_set_runstate()
175 dprint(FD_PROCESS, "pid=%d: runstate %d -> %d\n", (int) td->pid, in td_set_runstate()
176 td->runstate, runstate); in td_set_runstate()
177 td->runstate = runstate; in td_set_runstate()
180 int td_bump_runstate(struct thread_data *td, int new_state) in td_bump_runstate() argument
182 int old_state = td->runstate; in td_bump_runstate()
184 td_set_runstate(td, new_state); in td_bump_runstate()
188 void td_restore_runstate(struct thread_data *td, int old_state) in td_restore_runstate() argument
190 td_set_runstate(td, old_state); in td_restore_runstate()
193 void fio_mark_td_terminate(struct thread_data *td) in fio_mark_td_terminate() argument
195 fio_gettime(&td->terminate_time, NULL); in fio_mark_td_terminate()
197 td->terminate = 1; in fio_mark_td_terminate()
202 struct thread_data *td; in fio_terminate_threads() local
208 for_each_td(td, i) { in fio_terminate_threads()
209 if (group_id == TERMINATE_ALL || groupid == td->groupid) { in fio_terminate_threads()
211 td->o.name, (int) td->pid); in fio_terminate_threads()
213 if (td->terminate) in fio_terminate_threads()
216 fio_mark_td_terminate(td); in fio_terminate_threads()
217 td->o.start_delay = 0; in fio_terminate_threads()
222 if (!td->pid || pid == td->pid) in fio_terminate_threads()
224 else if (td->runstate < TD_RAMP) in fio_terminate_threads()
225 kill(td->pid, SIGTERM); in fio_terminate_threads()
227 struct ioengine_ops *ops = td->io_ops; in fio_terminate_threads()
230 ops->terminate(td); in fio_terminate_threads()
238 struct thread_data *td; in fio_running_or_pending_io_threads() local
241 for_each_td(td, i) { in fio_running_or_pending_io_threads()
242 if (td->flags & TD_F_NOIO) in fio_running_or_pending_io_threads()
244 if (td->runstate < TD_EXITED) in fio_running_or_pending_io_threads()