New -pacifier behavior code "interval="
This commit is contained in:
parent
59606c4450
commit
2faa115fe3
@ -33,6 +33,10 @@
|
||||
/* Option -pacifier */
|
||||
int Xorriso_option_pacifier(struct XorrisO *xorriso, char *style, int flag)
|
||||
{
|
||||
|
||||
#define Xorriso_pacifier_min_intvL 0.1
|
||||
#define Xorriso_pacifier_max_intvL 60.0
|
||||
|
||||
if(strcmp(style, "xorriso")==0 || strcmp(style, "default")==0)
|
||||
xorriso->pacifier_style= 0;
|
||||
else if(strcmp(style, "mkisofs")==0 || strcmp(style, "genisofs")==0 ||
|
||||
@ -41,7 +45,24 @@ int Xorriso_option_pacifier(struct XorrisO *xorriso, char *style, int flag)
|
||||
else if(strcmp(style, "cdrecord")==0 || strcmp(style, "cdrskin")==0 ||
|
||||
strcmp(style, "wodim")==0 || strcmp(style, "xorrecord")==0)
|
||||
xorriso->pacifier_style= 2;
|
||||
else {
|
||||
|
||||
else if(strncmp(style, "interval=", 9) == 0) {
|
||||
sscanf(style + 9, "%lf", &(xorriso->pacifier_interval));
|
||||
if(xorriso->pacifier_interval < Xorriso_pacifier_min_intvL) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-pacifier: interval='%s' is too low. Min: %f",
|
||||
style, Xorriso_pacifier_min_intvL);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
xorriso->pacifier_interval= Xorriso_pacifier_min_intvL;
|
||||
} else if(xorriso->pacifier_interval > Xorriso_pacifier_max_intvL) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-pacifier: interval='%s' is too high. Max: %f",
|
||||
style, Xorriso_pacifier_max_intvL);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
xorriso->pacifier_interval= Xorriso_pacifier_max_intvL;
|
||||
}
|
||||
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "-pacifier: unknown behavior code '%s'", style);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
|
@ -3088,6 +3088,10 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
xorriso->pacifier_style==2 ? "cdrecord" : "xorriso");
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
is_default= (xorriso->pacifier_interval == 1.0);
|
||||
sprintf(line,"-pacifier interval=%f\n", xorriso->pacifier_interval);
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (strcmp(xorriso->return_with_text,"SORRY")==0 &&
|
||||
xorriso->return_with_value==32);
|
||||
@ -3418,7 +3422,7 @@ int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done,
|
||||
{
|
||||
double current_time, since, interval_time, speed, speed_factor;
|
||||
char count_text[80], byte_text[80], profile_name[80], *speed_unit;
|
||||
int ret, profile_number;
|
||||
int ret, profile_number, short_sec;
|
||||
off_t amount;
|
||||
|
||||
current_time= Sfile_microtime(0);
|
||||
@ -3428,8 +3432,10 @@ int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done,
|
||||
return(1);
|
||||
xorriso->last_update_time= Sfile_microtime(0);
|
||||
since= current_time - xorriso->start_time;
|
||||
if((flag&1)&&since<1.0)
|
||||
if((flag & 1) && since < 1.0 && xorriso->pacifier_interval >= 1.0)
|
||||
since= 1.0;
|
||||
if((flag & 1) && since < 0.1)
|
||||
since= 0.1;
|
||||
byte_text[0]= 0;
|
||||
if(flag&4) {
|
||||
strcat(byte_text, " (");
|
||||
@ -3437,24 +3443,35 @@ int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done,
|
||||
byte_text+strlen(byte_text), 7, 1e5, 0);
|
||||
strcat(byte_text, ")");
|
||||
}
|
||||
short_sec= 0;
|
||||
if(count<=0.0 && !(flag&2)) {
|
||||
if(since < 2)
|
||||
return(2);
|
||||
sprintf(xorriso->info_text,
|
||||
"Thank you for being patient for %.f seconds", since);
|
||||
"Thank you for being patient for");
|
||||
} else if(todo<=0.0) {
|
||||
if(count<10000000)
|
||||
sprintf(count_text, "%.f", (double) count);
|
||||
else
|
||||
Sfile_scale((double) count, count_text, 7, 1e5, 1);
|
||||
sprintf(xorriso->info_text, "%s %s%s in %.f %s",
|
||||
count_text, what_done, byte_text, since,
|
||||
(flag & 64) ? "s" : "seconds");
|
||||
sprintf(xorriso->info_text, "%s %s%s in",
|
||||
count_text, what_done, byte_text);
|
||||
short_sec= (flag & 64);
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "%.f of %.f %s%s in %.f %s",
|
||||
(double) count, (double) todo, what_done, byte_text, since,
|
||||
(flag & (8 | 64)) ? "s" : "seconds");
|
||||
sprintf(xorriso->info_text, "%.f of %.f %s%s in",
|
||||
(double) count, (double) todo, what_done, byte_text);
|
||||
short_sec= (flag & (8 | 64));
|
||||
}
|
||||
if(xorriso->pacifier_interval < 1.0) {
|
||||
sprintf(xorriso->info_text + strlen(xorriso->info_text),
|
||||
" %.1f", since);
|
||||
} else {
|
||||
sprintf(xorriso->info_text + strlen(xorriso->info_text),
|
||||
" %.f", since);
|
||||
}
|
||||
sprintf(xorriso->info_text + strlen(xorriso->info_text),
|
||||
" %s", short_sec ? "s" : "seconds");
|
||||
|
||||
speed= -1.0;
|
||||
if(flag & 4)
|
||||
amount= xorriso->pacifier_byte_count;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH XORRISO 1 "Version 1.3.1, Mai 29, 2013"
|
||||
.TH XORRISO 1 "Version 1.3.1, Jun 02, 2013"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -4323,6 +4323,13 @@ X of Y MB written (fifo nn%) [buf mmm%]
|
||||
"mkisofs"
|
||||
.br
|
||||
nn% done, estimate finish Tue Jul 15 20:13:28 2008
|
||||
.br
|
||||
The frequency of the messages can be adjusted by
|
||||
.br
|
||||
"interval=number"
|
||||
.br
|
||||
where number gives the seconds between two messages. Permissible settings
|
||||
are 0.1 to 60.0.
|
||||
.TP
|
||||
\fB\-scdbackup_tag\fR list_path record_name
|
||||
Set the parameter "name" for a scdbackup checksum record.
|
||||
|
@ -3790,6 +3790,10 @@ said programs trigger comparable actions.
|
||||
X of Y MB written (fifo nn%) [buf mmm%]
|
||||
"mkisofs"
|
||||
nn% done, estimate finish Tue Jul 15 20:13:28 2008
|
||||
The frequency of the messages can be adjusted by
|
||||
"interval=number"
|
||||
where number gives the seconds between two messages. Permissible
|
||||
settings are 0.1 to 60.0.
|
||||
|
||||
-scdbackup_tag list_path record_name
|
||||
Set the parameter "name" for a scdbackup checksum record. It will
|
||||
@ -4906,7 +4910,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top
|
||||
* -rom_toc_scan searches for sessions: Loading. (line 214)
|
||||
* -rr_reloc_dir sets name of relocation directory: SetWrite.
|
||||
(line 141)
|
||||
* -scdbackup_tag enables scdbackup checksum tag: Emulation. (line 173)
|
||||
* -scdbackup_tag enables scdbackup checksum tag: Emulation. (line 177)
|
||||
* -scsi_log reports SCSI commands: Scripting. (line 147)
|
||||
* -session_log logs written sessions: Scripting. (line 138)
|
||||
* -session_string composes session info line: Inquiry. (line 78)
|
||||
@ -4973,7 +4977,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top
|
||||
* Backslash Interpretation, _definition: Processing. (line 52)
|
||||
* Backup, enable fast incremental, -disk_dev_ino: Loading. (line 193)
|
||||
* Backup, enable features, -for_backup: Loading. (line 188)
|
||||
* Backup, scdbackup checksum tag, -scdbackup: Emulation. (line 173)
|
||||
* Backup, scdbackup checksum tag, -scdbackup: Emulation. (line 177)
|
||||
* Blank media, _definition: Media. (line 29)
|
||||
* Blind growing, _definition: Methods. (line 40)
|
||||
* Bootability, control, -boot_image: Bootable. (line 26)
|
||||
@ -5268,30 +5272,30 @@ Node: Navigate160915
|
||||
Node: Verify169213
|
||||
Node: Restore178245
|
||||
Node: Emulation185332
|
||||
Node: Scripting195456
|
||||
Node: Frontend202613
|
||||
Node: Examples210688
|
||||
Node: ExDevices211866
|
||||
Node: ExCreate212525
|
||||
Node: ExDialog213810
|
||||
Node: ExGrowing215075
|
||||
Node: ExModifying215880
|
||||
Node: ExBootable216384
|
||||
Node: ExCharset216936
|
||||
Node: ExPseudo217757
|
||||
Node: ExCdrecord218655
|
||||
Node: ExMkisofs218972
|
||||
Node: ExGrowisofs220312
|
||||
Node: ExException221447
|
||||
Node: ExTime221901
|
||||
Node: ExIncBackup222360
|
||||
Node: ExRestore226340
|
||||
Node: ExRecovery227273
|
||||
Node: Files227843
|
||||
Node: Seealso229142
|
||||
Node: Bugreport229865
|
||||
Node: Legal230446
|
||||
Node: CommandIdx231457
|
||||
Node: ConceptIdx247759
|
||||
Node: Scripting195634
|
||||
Node: Frontend202791
|
||||
Node: Examples210866
|
||||
Node: ExDevices212044
|
||||
Node: ExCreate212703
|
||||
Node: ExDialog213988
|
||||
Node: ExGrowing215253
|
||||
Node: ExModifying216058
|
||||
Node: ExBootable216562
|
||||
Node: ExCharset217114
|
||||
Node: ExPseudo217935
|
||||
Node: ExCdrecord218833
|
||||
Node: ExMkisofs219150
|
||||
Node: ExGrowisofs220490
|
||||
Node: ExException221625
|
||||
Node: ExTime222079
|
||||
Node: ExIncBackup222538
|
||||
Node: ExRestore226518
|
||||
Node: ExRecovery227451
|
||||
Node: Files228021
|
||||
Node: Seealso229320
|
||||
Node: Bugreport230043
|
||||
Node: Legal230624
|
||||
Node: CommandIdx231635
|
||||
Node: ConceptIdx247937
|
||||
|
||||
End Tag Table
|
||||
|
@ -50,7 +50,7 @@
|
||||
@c man .\" First parameter, NAME, should be all caps
|
||||
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
@c man .\" other parameters are allowed: see man(7), man(1)
|
||||
@c man .TH XORRISO 1 "Version 1.3.1, Mai 29, 2013"
|
||||
@c man .TH XORRISO 1 "Version 1.3.1, Jun 02, 2013"
|
||||
@c man .\" Please adjust this date whenever revising the manpage.
|
||||
@c man .\"
|
||||
@c man .\" Some roff macros, for reference:
|
||||
@ -5047,6 +5047,13 @@ X of Y MB written (fifo nn%) [buf mmm%]
|
||||
"mkisofs"
|
||||
@*
|
||||
nn% done, estimate finish Tue Jul 15 20:13:28 2008
|
||||
@*
|
||||
The frequency of the messages can be adjusted by
|
||||
@*
|
||||
"interval=number"
|
||||
@*
|
||||
where number gives the seconds between two messages. Permissible settings
|
||||
are 0.1 to 60.0.
|
||||
@c man .TP
|
||||
@item -scdbackup_tag list_path record_name
|
||||
@kindex -scdbackup_tag enables scdbackup checksum tag
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2013.05.30.192537"
|
||||
#define Xorriso_timestamP "2013.06.02.112441"
|
||||
|
Loading…
Reference in New Issue
Block a user