* Benchmark duration (seconds)
* Target operations per second (aggregate across all threads)
* Interval count (how many times to report results during the run)
+ * Directory size (number of files per numbered subdirectory)
*/
#include <errno.h>
#include <unistd.h>
#include <math.h>
-int opt_filesize, opt_filecount, opt_threads, opt_duration, opt_intervals;
+int opt_filesize, opt_filecount, opt_threads, opt_duration, opt_intervals, opt_dirsize;
double opt_writeratio, opt_ops;
struct thread_state {
start = now_hires();
- char filename[64];
- sprintf(filename, "t%d/%d", ts->thread_num, get_random(opt_filecount));
+ char filename[256];
+ int n = get_random(opt_filecount);
+ int n1 = n / opt_dirsize, n2 = n % opt_dirsize;
+ sprintf(filename, "t%d/%d/%d", ts->thread_num, n1, n2);
double r = get_random(1000000) / 1e6;
int main(int argc, char *argv[])
{
- if (argc != 8) {
+ if (argc != 9) {
fprintf(stderr, "Usage: TODO\n");
return 1;
}
opt_duration = atoi(argv[5]);
opt_ops = atof(argv[6]);
opt_intervals = atoi(argv[7]);
+ opt_dirsize = atoi(argv[7]);
srandom(time(NULL));