Log ETA in seconds. Also use empty fields if the value is not available.

This commit is contained in:
Andrea Mazzoleni 2026-02-08 14:40:06 +01:00
parent 025816d151
commit 4d39bd5adf
4 changed files with 62 additions and 15 deletions

View file

@ -4990,7 +4990,7 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
/* estimate the remaining time in minutes */
if (delta_pos != 0)
out_eta = muldiv(countmax - countpos, delta_time, 60 * delta_pos);
out_eta = muldiv(countmax - countpos, delta_time, delta_pos);
if (state->opt.force_stats) {
os_clear();
@ -5020,7 +5020,31 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
}
if (state->opt.gui) {
log_tag("run:pos:%u:%u:%" PRIu64 ":%u:%u:%u:%u:%" PRIu64 "\n", blockpos, countpos, countsize, out_perc, out_eta, out_size_speed, out_cpu, (uint64_t)elapsed);
char str_eta[32];
char str_size_speed[32];
char str_cpu[32];
char str_temp[32];
char str_steady[32];
if (out_computed) {
snprintf(str_eta, sizeof(str_eta), "%u", out_eta);
snprintf(str_size_speed, sizeof(str_size_speed), "%u", out_size_speed);
snprintf(str_cpu, sizeof(str_cpu), "%u", out_cpu);
} else {
str_eta[0] = 0;
str_size_speed[0] = 0;
str_cpu[0] = 0;
}
if (out_temperature) {
snprintf(str_temp, sizeof(str_eta), "%u", out_temperature);
} else {
str_temp[0] = 0;
}
if (out_steady) {
snprintf(str_steady, sizeof(str_steady), "%u", out_steady);
} else {
str_steady[0] = 0;
}
log_tag("run:pos:%u:%u:%" PRIu64 ":%u:%s:%s:%s:%" PRIu64 ":%s:%s\n", blockpos, countpos, countsize, out_perc, str_eta, str_size_speed, str_cpu, (uint64_t)elapsed, str_temp, str_steady);
log_flush();
} else {
msg_bar("%u%%, %u MB", out_perc, (unsigned)(countsize / MEGA));
@ -5034,7 +5058,8 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
else
msg_bar(", Tmax %u", out_temperature);
}
msg_bar(", %u:%02u ETA", out_eta / 60, out_eta % 60);
unsigned out_eta_minutes = out_eta / 60; /* minutes */
msg_bar(", %u:%02u ETA", out_eta_minutes / 60, out_eta_minutes % 60);
}
msg_bar("\r");
msg_flush();

View file

@ -516,7 +516,7 @@ are going to be skipped (uint).
.B run:end
A zero\-argument tag indicating the end of the command execution.
.TP
.B run:pos:<blockidx>:<blockdone>:<sizedone>:<perc>:<eta>:<speed_mbs>:<cpu>:<elapsed>
.B run:pos:<blockidx>:<blockdone>:<sizedone>:<perc>:<eta>:<speed_mbs>:<cpu>:<elapsed>:<temp>:<steady_temp>
Detailed progress information during command execution.
.RS 4
.PD 0
@ -534,16 +534,26 @@ Current size processed (uint).
Completion percentage (uint).
.HP 4
.I <eta>
Estimated time to completion in seconds (uint).
Estimated time to completion in seconds. Empty if not
available (uint).
.HP 4
.I <speed_mbs>
Data processing speed in MB/s (uint).
Data processing speed in MB/s. Empty if not
available (uint).
.HP 4
.I <cpu>
CPU usage percentage (uint).
CPU usage percentage. Empty if not available (uint).
.HP 4
.I <elapsed>
Elapsed time in seconds (uint).
.HP 4
.I <temp>
Current max temperature of the disks. Empty if not
available (uint).
.HP 4
.I <steady_temp>
Expected steady temperature of the disks.
Empty if not available (uint).
.PD
.RE
.TP

View file

@ -350,17 +350,23 @@ General Progress and Execution Tags
=run:end
A zero-argument tag indicating the end of the command execution.
=run:pos:<blockidx>:<blockdone>:<sizedone>:<perc>:<eta>:<speed_mbs>:<cpu>:<elapsed>
=run:pos:<blockidx>:<blockdone>:<sizedone>:<perc>:<eta>:<speed_mbs>:<cpu>:<elapsed>:<temp>:<steady_temp>
Detailed progress information during command execution.
<blockidx> - Current block index position processed (uint).
<blockdone> - Number of blocks processed (uint).
<sizedone> - Current size processed (uint).
<perc> - Completion percentage (uint).
<eta> - Estimated time to completion in seconds (uint).
<speed_mbs> - Data processing speed in MB/s (uint).
<cpu> - CPU usage percentage (uint).
<eta> - Estimated time to completion in seconds. Empty if not
available (uint).
<speed_mbs> - Data processing speed in MB/s. Empty if not
available (uint).
<cpu> - CPU usage percentage. Empty if not available (uint).
<elapsed> - Elapsed time in seconds (uint).
<temp> - Current max temperature of the disks. Empty if not
available (uint).
<steady_temp> - Expected steady temperature of the disks.
Empty if not available (uint).
=sigint:<blockidx>:<msg>
A user interruption (e.g., Ctrl+C) was signaled. The process

View file

@ -369,17 +369,23 @@ Only produced when `--gui` option is used.
run:end
A zero-argument tag indicating the end of the command execution.
run:pos:<blockidx>:<blockdone>:<sizedone>:<perc>:<eta>:<speed_mbs>:<cpu>:<elapsed>
run:pos:<blockidx>:<blockdone>:<sizedone>:<perc>:<eta>:<speed_mbs>:<cpu>:<elapsed>:<temp>:<steady_temp>
Detailed progress information during command execution.
<blockidx> - Current block index position processed (uint).
<blockdone> - Number of blocks processed (uint).
<sizedone> - Current size processed (uint).
<perc> - Completion percentage (uint).
<eta> - Estimated time to completion in seconds (uint).
<speed_mbs> - Data processing speed in MB/s (uint).
<cpu> - CPU usage percentage (uint).
<eta> - Estimated time to completion in seconds. Empty if not
available (uint).
<speed_mbs> - Data processing speed in MB/s. Empty if not
available (uint).
<cpu> - CPU usage percentage. Empty if not available (uint).
<elapsed> - Elapsed time in seconds (uint).
<temp> - Current max temperature of the disks. Empty if not
available (uint).
<steady_temp> - Expected steady temperature of the disks.
Empty if not available (uint).
sigint:<blockidx>:<msg>
A user interruption (e.g., Ctrl+C) was signaled. The process