Better finish time estimation with -pacifier mkisofs

This commit is contained in:
Thomas Schmitt 2008-08-01 14:11:25 +00:00
parent 2c1c66a179
commit 017e115411
2 changed files with 39 additions and 15 deletions

View File

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

View File

@ -1108,7 +1108,9 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
struct burn_progress progress;
char *status_text, date_text[80];
enum burn_drive_status drive_status;
double start_time, current_time, last_time, base_time= 0, base_count;
double start_time, current_time, last_time, base_time= 0.0, base_count= 0.0;
double next_base_time= 0.0, next_base_count= 0.0, first_base_time= 0.0;
double first_base_count= 0.0, norm= 0.0;
double measured_speed, speed_factor= 1385000, quot;
time_t time_prediction;
@ -1172,21 +1174,43 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
sprintf(xorriso->info_text, " %2.2f%% done", quot*100.0);
if(current_time - start_time >= 2 && quot > 0.0 &&
(quot >= 0.02 || progress.sector >= 5*1024)) {
if(base_time == 0.0) {
base_time= current_time;
base_count= progress.sector;
if(base_time == 0.0 && progress.sector >= 16*1024) {
first_base_time= base_time= next_base_time= current_time;
first_base_count= next_base_count= progress.sector;
} else if(next_base_time > 0 && current_time - next_base_time >= 10) {
base_time= next_base_time;
base_count= next_base_count;
next_base_time= current_time;
next_base_count= progress.sector;
}
if(current_time - base_time > 0.001 && progress.sectors > base_count){
quot= ((double) progress.sector - base_count )
if(first_base_time > 0 &&
current_time - first_base_time >= 3 &&
progress.sectors > first_base_count) {
norm= (1.0 - quot);
if(norm < 0.0001)
norm= 0.0001;
quot= ((double) progress.sector - first_base_count)
/ ((double) progress.sectors - first_base_count);
time_prediction= norm * (1.0 - quot) / quot
* (current_time - first_base_time);
} else {
time_prediction= (1.0 - quot) / quot * (current_time - start_time);
norm= 1.0;
}
if(base_time > 0 &&
current_time - base_time >= 3 && 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);
sprintf(xorriso->info_text+strlen(xorriso->info_text),
", estimate finish %s", date_text);
time_prediction+= (1.0 - quot) / quot * (current_time - base_time);
norm+= 1.0;
}
time_prediction/= norm;
if(time_prediction < 30*86400) {
time_prediction+= current_time;
Ftimetxt(time_prediction, date_text, 4);
sprintf(xorriso->info_text+strlen(xorriso->info_text),
", estimate finish %s", date_text);
}
}
} else {
if(progress.sector<=progress.sectors)