Fio 2.1.6
[fio.git] / options.c
index 625d3a25d51fb237dd89aefc6e3a742f8da0dca1..4ff4c9b42a7bd9af3a85251ac2b5a40f20b185d9 100644 (file)
--- a/options.c
+++ b/options.c
@@ -394,6 +394,28 @@ static int str_exitall_cb(void)
 }
 
 #ifdef FIO_HAVE_CPU_AFFINITY
+int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
+{
+       unsigned int i, index, cpus_in_mask;
+       const long max_cpu = cpus_online();
+
+       cpus_in_mask = fio_cpu_count(mask);
+       cpu_index = cpu_index % cpus_in_mask;
+
+       index = 0;
+       for (i = 0; i < max_cpu; i++) {
+               if (!fio_cpu_isset(mask, i))
+                       continue;
+
+               if (cpu_index != index)
+                       fio_cpu_clear(mask, i);
+
+               index++;
+       }
+
+       return fio_cpu_count(mask);
+}
+
 static int str_cpumask_cb(void *data, unsigned long long *val)
 {
        struct thread_data *td = data;
@@ -827,8 +849,7 @@ static int str_filename_cb(void *data, const char *input)
        while ((fname = get_next_name(&str)) != NULL) {
                if (!strlen(fname))
                        break;
-               add_file(td, fname, 0);
-               td->o.nr_files++;
+               add_file(td, fname, 0, 1);
        }
 
        free(p);
@@ -2876,6 +2897,27 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_CRED,
        },
+       {
+               .name   = "cpus_allowed_policy",
+               .lname  = "CPUs allowed distribution policy",
+               .type   = FIO_OPT_STR,
+               .off1   = td_var_offset(cpus_allowed_policy),
+               .help   = "Distribution policy for cpus_allowed",
+               .parent = "cpus_allowed",
+               .prio   = 1,
+               .posval = {
+                         { .ival = "shared",
+                           .oval = FIO_CPUS_SHARED,
+                           .help = "Mask shared between threads",
+                         },
+                         { .ival = "split",
+                           .oval = FIO_CPUS_SPLIT,
+                           .help = "Mask split between threads",
+                         },
+               },
+               .category = FIO_OPT_C_GENERAL,
+               .group  = FIO_OPT_G_CRED,
+       },
 #endif
 #ifdef CONFIG_LIBNUMA
        {