1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 18:06:40 +00:00

nyx: check for errors in benchmark

This commit is contained in:
CTCaer 2021-04-11 09:28:28 +03:00
parent 160d6eacc0
commit 978e8344cf

View file

@ -1287,6 +1287,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
lv_mbox_set_text(mbox, "#FFDD00 Failed to init Storage!#");
else
{
int error = 0;
u32 iters = 3;
u32 offset_chunk_start = ALIGN_DOWN(storage->sec_cnt / 3, 0x8000); // Align to 16MB.
if (storage->sec_cnt < 0xC00000)
@ -1307,7 +1308,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
sdmmc_storage_read(storage, sector + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = !sdmmc_storage_read(storage, sector + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@ -1324,8 +1325,11 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
prevPct = pct;
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
break;
error = -1;
}
if (error)
goto error;
}
lv_bar_set_value(bar, 100);
@ -1348,7 +1352,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
sdmmc_storage_read(storage, sector + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = !sdmmc_storage_read(storage, sector + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@ -1365,8 +1369,11 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
prevPct = pct;
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
break;
error = -1;
}
if (error)
goto error;
}
lv_bar_set_value(bar, 100);
@ -1403,7 +1410,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
sdmmc_storage_read(storage, sector + random_offsets[lba_idx], sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = !sdmmc_storage_read(storage, sector + random_offsets[lba_idx], sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@ -1420,7 +1427,13 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
prevPct = pct;
if (btn_read_vol() == (BTN_VOL_UP | BTN_VOL_DOWN))
break;
error = -1;
}
if (error)
{
free(random_offsets);
goto error;
}
}
lv_bar_set_value(bar, 100);
@ -1431,6 +1444,8 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
s_printf(txt_buf + strlen(txt_buf),
" Random 4KiB - Rate: #C7EA46 %3d.%02d MiB/s#, IOPS: #C7EA46 %4d#\n",
rate_1k / 1000, (rate_1k % 1000) / 10, iops_1k);
if (iter_curr == iters - 1)
txt_buf[strlen(txt_buf) - 1] = 0; // Cut off last line change.
lv_label_set_text(lbl_status, txt_buf);
lv_obj_align(lbl_status, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
@ -1438,6 +1453,18 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
free(random_offsets);
}
error:
if (error)
{
if (error == -1)
s_printf(txt_buf + strlen(txt_buf), "\n#FFDD00 Aborted!#");
else
s_printf(txt_buf + strlen(txt_buf), "\n#FFDD00 IO Error occurred!#");
lv_label_set_text(lbl_status, txt_buf);
lv_obj_align(lbl_status, NULL, LV_ALIGN_CENTER, 0, 0);
}
lv_obj_del(bar);
if (sd_bench)