New -pacifier behavior code "interval="
This commit is contained in:
@ -1218,7 +1218,8 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
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, now_time, fract_offset= 0.0;
|
||||
double measured_speed, speed_factor= 1385000, quot;
|
||||
double measured_speed, speed_factor= 1385000, quot, speed_min_time;
|
||||
double tdiff, now_fract;
|
||||
time_t time_prediction;
|
||||
IsoImage *image= NULL;
|
||||
|
||||
@ -1229,9 +1230,10 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
usleep(100002);
|
||||
|
||||
emul= flag&15;
|
||||
fract_offset= 0.2 * (double) emul - ((int) (0.2 * (double) emul));
|
||||
if(emul==0)
|
||||
emul= xorriso->pacifier_style;
|
||||
fract_offset= 1.0 / 3.0 * (double) emul - ((int) (1.0 / 3.0 * (double) emul));
|
||||
speed_min_time= 0.2 * xorriso->pacifier_interval;
|
||||
speed_unit= "D";
|
||||
if(flag&16) {
|
||||
speed_factor= 150.0*1024;
|
||||
@ -1266,7 +1268,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
}
|
||||
current_time= Sfile_microtime(0);
|
||||
if(drive_status == BURN_DRIVE_WRITING && progress.sectors > 0) {
|
||||
if(current_time-last_time>0.2)
|
||||
if(current_time-last_time > speed_min_time)
|
||||
measured_speed= (progress.sector - last_sector) * 2048.0 /
|
||||
(current_time - last_time);
|
||||
buffer_fill= 50;
|
||||
@ -1295,7 +1297,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
sprintf(xorriso->info_text+strlen(xorriso->info_text), " [buf %3d%%]",
|
||||
buffer_fill);
|
||||
|
||||
if(current_time-last_time>0.2)
|
||||
if(current_time-last_time > speed_min_time)
|
||||
sprintf(xorriso->info_text+strlen(xorriso->info_text), " %4.1fx.",
|
||||
measured_speed/speed_factor);
|
||||
|
||||
@ -1367,7 +1369,7 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
" fifo %3d%% buf %3d%%",
|
||||
(int) (100.0-100.0*((double) free_bytes)/(double) size),
|
||||
buffer_fill);
|
||||
if(current_time-last_time>0.2)
|
||||
if(current_time - last_time > speed_min_time)
|
||||
sprintf(xorriso->info_text+strlen(xorriso->info_text), " %5.1fx%s ",
|
||||
measured_speed/speed_factor, speed_unit);
|
||||
}
|
||||
@ -1385,14 +1387,22 @@ int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive,
|
||||
current_time-start_time);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
|
||||
|
||||
for(i= 0; i<12; i++) { /* 2 usleeps more than supposed to be needed */
|
||||
for(i= 0; i < 20; i++) { /* 10 usleeps more than supposed to be needed */
|
||||
Xorriso_process_msg_queues(xorriso, 0);
|
||||
if(aborting<=0)
|
||||
aborting= Xorriso_check_burn_abort(xorriso, 0);
|
||||
usleep(100000);
|
||||
usleep((unsigned long) (100000.0 * xorriso->pacifier_interval));
|
||||
now_time= Sfile_microtime(0);
|
||||
if(((time_t) now_time) - ((time_t) current_time) >= 1 &&
|
||||
now_time - ((time_t) now_time) >= fract_offset)
|
||||
tdiff= ((off_t)(now_time / xorriso->pacifier_interval)) -
|
||||
(off_t)(current_time / xorriso->pacifier_interval);
|
||||
now_fract= (now_time / xorriso->pacifier_interval -
|
||||
(off_t)(now_time / xorriso->pacifier_interval));
|
||||
if(tdiff < 1.0)
|
||||
continue;
|
||||
if(fract_offset <= 0.0) /* "xorriso" pacifier shall not wait for slot */
|
||||
break;
|
||||
if((now_fract >= fract_offset && now_fract < fract_offset + 0.3) ||
|
||||
tdiff >= 2.0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user