Add runstate swap helpers
[fio.git] / libfio.c
index f7f13268ec3c5ad97ed80165acb1c8406dfb4a3c..8eddab80b345651f11533038963bb03e5bc0ff93 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -52,8 +52,10 @@ static const char *fio_os_strings[os_nr] = {
        "HP-UX",
        "OSX",
        "NetBSD",
+       "OpenBSD",
        "Solaris",
-       "Windows"
+       "Windows",
+       "Android",
 };
 
 static const char *fio_arch_strings[arch_nr] = {
@@ -83,7 +85,6 @@ static void reset_io_counters(struct thread_data *td)
                td->this_io_blocks[ddir] = 0;
                td->rate_bytes[ddir] = 0;
                td->rate_blocks[ddir] = 0;
-               td->io_issues[ddir] = 0;
        }
        td->zone_bytes = 0;
 
@@ -133,6 +134,8 @@ void reset_all_stats(struct thread_data *td)
        fio_gettime(&tv, NULL);
        memcpy(&td->epoch, &tv, sizeof(tv));
        memcpy(&td->start, &tv, sizeof(tv));
+
+       lat_target_reset(td);
 }
 
 void reset_fio_state(void)
@@ -140,8 +143,6 @@ void reset_fio_state(void)
        groupid = 0;
        thread_number = 0;
        stat_number = 0;
-       nr_process = 0;
-       nr_thread = 0;
        done_secs = 0;
 }
 
@@ -171,6 +172,19 @@ void td_set_runstate(struct thread_data *td, int runstate)
        td->runstate = runstate;
 }
 
+int td_bump_runstate(struct thread_data *td, int new_state)
+{
+       int old_state = td->runstate;
+
+       td_set_runstate(td, new_state);
+       return old_state;
+}
+
+void td_restore_runstate(struct thread_data *td, int old_state)
+{
+       td_set_runstate(td, old_state);
+}
+
 void fio_terminate_threads(int group_id)
 {
        struct thread_data *td;