---- ---
P Thread setup, but not started.
C Thread created.
-I Thread initialized, waiting.
+I Thread initialized, waiting or generating necessary data.
p Thread running pre-reading file(s).
R Running, doing sequential reads.
r Running, doing random reads.
c = 'C';
break;
case TD_INITIALIZED:
+ case TD_SETTING_UP:
c = 'I';
break;
case TD_NOT_CREATED:
} else if (td->runstate == TD_RAMP) {
je->nr_running++;
je->nr_ramp++;
- } else if (td->runstate < TD_RUNNING)
+ } else if (td->runstate == TD_SETTING_UP)
+ je->nr_running++;
+ else if (td->runstate < TD_RUNNING)
je->nr_pending++;
if (je->elapsed_sec >= 3)
#include "compiler/compiler.h"
#include "io_ddir.h"
#include "flist.h"
+#include "lib/zipf.h"
/*
* The type of object we are working on
unsigned long last_free_lookup;
unsigned failed_rands;
+ /*
+ * Used for zipf random distribution
+ */
+ struct zipf_state zipf;
+
int references;
enum fio_file_flags flags;
return 1;
}
+static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)
+{
+ unsigned int range_size;
+ unsigned long nranges;
+
+ range_size = min(td->o.min_bs[DDIR_READ], td->o.min_bs[DDIR_WRITE]);
+
+ nranges = (f->real_file_size + range_size - 1) / range_size;
+
+ if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
+ zipf_init(&f->zipf, nranges, td->o.zipf_theta);
+ else
+ pareto_init(&f->zipf, nranges, td->o.pareto_h);
+
+ return 1;
+}
+
+static int init_rand_distribution(struct thread_data *td)
+{
+ struct fio_file *f;
+ unsigned int i;
+ int state;
+
+ if (td->o.random_distribution == FIO_RAND_DIST_RANDOM)
+ return 0;
+
+ state = td->runstate;
+ td_set_runstate(td, TD_SETTING_UP);
+ for_each_file(td, f, i)
+ __init_rand_distribution(td, f);
+ td_set_runstate(td, state);
+
+ return 1;
+}
+
int init_random_map(struct thread_data *td)
{
unsigned long long blocks, num_maps;
struct fio_file *f;
unsigned int i;
+ if (init_rand_distribution(td))
+ return 0;
if (td->o.norandommap || !td_random(td))
return 0;
#include "server.h"
#include "stat.h"
#include "flow.h"
-#include "lib/zipf.h"
#ifdef FIO_HAVE_GUASI
#include <guasi.h>
struct frand_state __random_state;
};
- /*
- * Used for zipf random distribution
- */
- struct zipf_state zipf;
-
struct timeval start; /* start of this loop */
struct timeval epoch; /* time job was started */
struct timeval last_issue;
TD_NOT_CREATED = 0,
TD_CREATED,
TD_INITIALIZED,
+ TD_SETTING_UP,
TD_RAMP,
TD_RUNNING,
TD_PRE_READING,
o->min_bs[DDIR_READ] == o->min_bs[DDIR_TRIM];
}
-static void init_rand_distribution(struct thread_data *td)
-{
- unsigned int range_size;
- unsigned long nranges;
-
- if (td->o.random_distribution == FIO_RAND_DIST_RANDOM)
- return;
-
- range_size = min(td->o.min_bs[DDIR_READ], td->o.min_bs[DDIR_WRITE]);
-
- nranges = (td->o.size + range_size - 1) / range_size;
-
- if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
- zipf_init(&td->zipf, nranges, td->o.zipf_theta);
- else
- pareto_init(&td->zipf, nranges, td->o.pareto_h);
-}
-
/*
* Lazy way of fixing up options that depend on each other. We could also
* define option callback handlers, but this is easier.
td->o.compress_percentage = 0;
}
- init_rand_distribution(td);
-
return ret;
}
struct fio_file *f, enum fio_ddir ddir,
unsigned long long *b)
{
- *b = zipf_next(&td->zipf);
+ *b = zipf_next(&f->zipf);
return 0;
}
struct fio_file *f, enum fio_ddir ddir,
unsigned long long *b)
{
- *b = pareto_next(&td->zipf);
+ *b = pareto_next(&f->zipf);
return 0;
}