Better finish time estimation with -pacifier mkisofs

This commit is contained in:
Thomas Schmitt 2008-08-01 10:13:10 +00:00
parent afd2dd9636
commit 2c1c66a179
2 changed files with 16 additions and 5 deletions

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.07.26.075027" #define Xorriso_timestamP "2008.08.01.101355"

View File

@ -1108,7 +1108,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
struct burn_progress progress; struct burn_progress progress;
char *status_text, date_text[80]; char *status_text, date_text[80];
enum burn_drive_status drive_status; enum burn_drive_status drive_status;
double start_time, current_time, last_time; double start_time, current_time, last_time, base_time= 0, base_count;
double measured_speed, speed_factor= 1385000, quot; double measured_speed, speed_factor= 1385000, quot;
time_t time_prediction; time_t time_prediction;
@ -1170,9 +1170,20 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
quot= ((double) progress.sector) / ((double) progress.sectors); quot= ((double) progress.sector) / ((double) progress.sectors);
sprintf(xorriso->info_text, " %2.2f%% done", quot*100.0); sprintf(xorriso->info_text, " %2.2f%% done", quot*100.0);
if(current_time - start_time >= 2 && quot >= 0.02) { if(current_time - start_time >= 2 && quot > 0.0 &&
time_prediction= current_time + (quot >= 0.02 || progress.sector >= 5*1024)) {
(1.0 - quot) / quot * (current_time-start_time) + 1; if(base_time == 0.0) {
base_time= current_time;
base_count= progress.sector;
}
if(current_time - base_time > 0.001 && progress.sectors > base_count){
quot= ((double) progress.sector - base_count )
/ ((double) progress.sectors - base_count);
time_prediction= (1.0 - quot) / quot * (current_time - base_time)
+ current_time + 1;
} else
time_prediction= (1.0 - quot) / quot * (current_time - start_time)
+ current_time + 1;
Ftimetxt(time_prediction, date_text, 4); Ftimetxt(time_prediction, date_text, 4);
sprintf(xorriso->info_text+strlen(xorriso->info_text), sprintf(xorriso->info_text+strlen(xorriso->info_text),
", estimate finish %s", date_text); ", estimate finish %s", date_text);