uint exec_pos;
double exec_ms[EXEC_CACHE];
- // this is "average" speed, we'll use this for benchmark and final status screen
-
- u64 speed_cnt_total;
- double speed_ms_total;
-
// this is "current" speed
uint speed_pos;
u64 speed_cnt[SPEED_CACHE];
double speed_ms[SPEED_CACHE];
- // speed_rec is what additionally limits the "current" speed in time, not array elements
-
- hc_timer_t speed_rec[SPEED_CACHE];
-
hc_timer_t timer_speed;
// device specific attributes starting
for (int i = 0; i < SPEED_CACHE; i++)
{
- double rec_ms;
-
- hc_timer_get (device_param->speed_rec[i], rec_ms);
-
- if (rec_ms > SPEED_MAXAGE) continue;
-
speed_cnt += device_param->speed_cnt[i];
speed_ms += device_param->speed_ms[i];
}
if (device_param->skipped) continue;
- // we need to clear values (set to 0) because in case the device does
- // not get new candidates it idles around but speed display would
- // show it as working.
- // if we instantly set it to 0 after reading it happens that the
- // speed can be shown as zero if the users refreshes too fast.
- // therefore, we add a timestamp when a stat was recorded and if its
- // too old we will not use it
-
speed_cnt[device_id] = 0;
speed_ms[device_id] = 0;
for (int i = 0; i < SPEED_CACHE; i++)
{
- double rec_ms;
-
- hc_timer_get (device_param->speed_rec[i], rec_ms);
-
- if (rec_ms > SPEED_MAXAGE) continue;
-
speed_cnt[device_id] += device_param->speed_cnt[i];
speed_ms[device_id] += device_param->speed_ms[i];
}
if (data.devices_status == STATUS_CRACKED) break;
if (data.devices_status == STATUS_ABORTED) break;
if (data.devices_status == STATUS_QUIT) break;
+
+ /**
+ * speed
+ */
+
+ const float iter_part = (float) (loop_pos + loop_left) / iter;
+
+ const u64 perf_sum_all = pws_cnt * iter_part;
+
+ double speed_ms;
+
+ hc_timer_get (device_param->timer_speed, speed_ms);
+
+ const u32 speed_pos = device_param->speed_pos;
+
+ device_param->speed_cnt[speed_pos] = perf_sum_all;
+
+ device_param->speed_ms[speed_pos] = speed_ms;
}
if (opts_type & OPTS_TYPE_HOOK23)
device_param->speed_ms[speed_pos] = speed_ms;
- device_param->speed_rec[speed_pos] = device_param->timer_speed;
-
hc_thread_mutex_unlock (mux_display);
speed_pos++;
speed_pos = 0;
}
- // average speed
-
- device_param->speed_cnt_total += perf_sum_all;
-
- device_param->speed_ms_total += speed_ms;
-
/**
* benchmark
*/
memset (device_param->speed_cnt, 0, SPEED_CACHE * sizeof (u64));
memset (device_param->speed_ms, 0, SPEED_CACHE * sizeof (double));
- memset (device_param->speed_rec, 0, SPEED_CACHE * sizeof (hc_timer_t));
-
- device_param->speed_cnt_total = 0;
- device_param->speed_ms_total = 0;
device_param->exec_pos = 0;