+static void get_act_ref(void)
+{
+ fio_sem_down(act_run_data->sem);
+ act_run_data->pending++;
+ fio_sem_up(act_run_data->sem);
+}
+
+static int show_slice(struct act_slice *slice, unsigned int slice_num)
+{
+ unsigned int i, failed = 0;
+
+ log_info(" %2u", slice_num);
+
+ for (i = 0; i < ACT_MAX_CRIT; i++) {
+ double perc = 0.0;
+
+ if (slice->total_ios)
+ perc = 100.0 * (double) slice->lat_buckets[i] / (double) slice->total_ios;
+ if ((perc * 10.0) >= act_pass[i].max_perm)
+ failed++;
+ log_info("\t%2.2f", perc);
+ }
+ for (i = 0; i < ACT_MAX_CRIT; i++) {
+ double perc = 0.0;
+
+ if (slice->total_ios)
+ perc = 100.0 * (double) slice->lat_buckets[i] / (double) slice->total_ios;
+ log_info("\t%2.2f", perc);
+ }
+ log_info("\n");
+
+ return failed;
+}
+
+static void act_show_all_stats(void)
+{
+ unsigned int i, fails = 0;
+
+ log_info(" trans device\n");
+ log_info(" %%>(ms) %%>(ms)\n");
+ log_info(" slice");
+
+ for (i = 0; i < ACT_MAX_CRIT; i++)
+ log_info("\t %2u", act_pass[i].max_usec / 1000);
+ for (i = 0; i < ACT_MAX_CRIT; i++)
+ log_info("\t %2u", act_pass[i].max_usec / 1000);
+
+ log_info("\n");
+ log_info(" ----- ----- ----- ------ ----- ----- ------\n");
+
+ for (i = 0; i < act_run_data->nr_slices; i++)
+ fails += show_slice(&act_run_data->slices[i], i + 1);
+
+ log_info("\nact: test complete, device(s): %s\n", fails ? "FAILED" : "PASSED");
+}
+
+static void put_act_ref(struct thread_data *td)
+{
+ struct act_prof_data *apd = td->prof_data;
+ unsigned int i, slice;
+
+ fio_sem_down(act_run_data->sem);
+
+ if (!act_run_data->slices) {
+ act_run_data->slices = calloc(apd->nr_slices, sizeof(struct act_slice));
+ act_run_data->nr_slices = apd->nr_slices;
+ }
+
+ for (slice = 0; slice < apd->nr_slices; slice++) {
+ struct act_slice *dst = &act_run_data->slices[slice];
+ struct act_slice *src = &apd->slices[slice];
+
+ dst->total_ios += src->total_ios;
+
+ for (i = 0; i < ACT_MAX_CRIT; i++)
+ dst->lat_buckets[i] += src->lat_buckets[i];
+ }
+
+ if (!--act_run_data->pending)
+ act_show_all_stats();
+
+ fio_sem_up(act_run_data->sem);
+}
+