[xiph-commits] r15186 - in trunk/cdparanoia: . interface
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Aug 15 00:20:40 PDT 2008
Author: xiphmont
Date: 2008-08-15 00:20:39 -0700 (Fri, 15 Aug 2008)
New Revision: 15186
Modified:
trunk/cdparanoia/cdparanoia.1
trunk/cdparanoia/interface/cdda_interface.h
trunk/cdparanoia/interface/common_interface.c
trunk/cdparanoia/interface/interface.c
trunk/cdparanoia/interface/low_interface.h
trunk/cdparanoia/main.c
Log:
cache analysis debuging output option
Modified: trunk/cdparanoia/cdparanoia.1
===================================================================
--- trunk/cdparanoia/cdparanoia.1 2008-08-15 04:10:54 UTC (rev 15185)
+++ trunk/cdparanoia/cdparanoia.1 2008-08-15 07:20:39 UTC (rev 15186)
@@ -27,6 +27,13 @@
for setup and debugging.
.TP
+.B \-vv --verbose-debug
+In addition to verbose output, enable additional testing and debugging
+output for various analysis heuristics. This option is intended to
+assist developers in remotely refining heuristics for problematic
+hardware.
+
+.TP
.B \-q --quiet
Do not print any progress or error information during the reading process.
Modified: trunk/cdparanoia/interface/cdda_interface.h
===================================================================
--- trunk/cdparanoia/interface/cdda_interface.h 2008-08-15 04:10:54 UTC (rev 15185)
+++ trunk/cdparanoia/interface/cdda_interface.h 2008-08-15 07:20:39 UTC (rev 15186)
@@ -124,6 +124,7 @@
extern int cdda_cache_sectors(cdrom_drive *d);
extern int cdda_speed_set(cdrom_drive *d, int speed);
extern void cdda_verbose_set(cdrom_drive *d,int err_action, int mes_action);
+extern void cdda_debug_set(cdrom_drive *d,int active);
extern char *cdda_messages(cdrom_drive *d);
extern char *cdda_errors(cdrom_drive *d);
Modified: trunk/cdparanoia/interface/common_interface.c
===================================================================
--- trunk/cdparanoia/interface/common_interface.c 2008-08-15 04:10:54 UTC (rev 15185)
+++ trunk/cdparanoia/interface/common_interface.c 2008-08-15 07:20:39 UTC (rev 15186)
@@ -212,6 +212,7 @@
int max_retries=20;
float median;
int offset;
+ int debug = d->private->cache_debug;
/* set up a default pessimal take on drive behavior */
d->private->cache_backseekflush=0;
@@ -263,20 +264,27 @@
memset(histogram,0,sizeof(histogram));
if((ret=d->read_audio(d,NULL,offset+current+1,1))<0){
/* media error! grr! retry elsewhere */
- cdmessage(d,"\n\tWARNING: unrecoverable media error while performing test"
- "\n\treads; picking new location and trying again.");
+ cdmessage(d,"\n\tWARNING: media error; picking new location and trying again.");
continue;
}
+
+ if(debug)
+ cdmessage(d,"\n\tSector timings (ms):\n\t");
+
for(i=0;i<current;i++){
if(d->read_audio(d,NULL,offset+i,1)<0){
/* media error! grr! retry elsewhere */
- cdmessage(d,"\n\tWARNING: unrecoverable media error while performing test"
- "\n\treads; picking new location and trying again.");
+ cdmessage(d,"\n\tWARNING: media error; picking new location and trying again.");
break;
}
x = d->private->last_milliseconds;
if(x>9999)x=9999;
if(x<0)x=0;
+ if(debug){
+ snprintf(buffer,80,"%d ",x);
+ cdmessage(d,buffer);
+ }
+
histogram[x]++;
latency[i]=x;
}
@@ -288,21 +296,40 @@
for(i=0;i<10000;i++){
prev=acc;
acc+=histogram[i];
- if(acc>current/2) break;
+ if(acc>current/2){
+ if(debug){
+ cdmessage(d,"\n\tSurrounding histogram: ");
+ if(i){
+ snprintf(buffer,80,"%dms:%d ",i-1,acc-histogram[i]);
+ cdmessage(d,buffer);
+ }
+ snprintf(buffer,80,"%dms:%d ",i,acc);
+ cdmessage(d,buffer);
+ if(i<999){
+ snprintf(buffer,80,"%dms:%d ",i+1,acc+histogram[i+1]);
+ cdmessage(d,buffer);
+ }
+ cdmessage(d,"\n");
+ }
+ break;
+ }
}
-
+
median = (i*(acc-prev) + (i-1)*prev)/(float)acc;
- snprintf(buffer,80,"\n\tsmall seek latency (%d sectors): %d ms",current,latency[0]);
- cdmessage(d,buffer);
- snprintf(buffer,80,"\n\tmedian read latency per sector: %.1f ms",median);
- cdmessage(d,buffer);
+ if(debug){
+ snprintf(buffer,80,"\n\tsmall seek latency (%d sectors): %d ms",current,latency[0]);
+ cdmessage(d,buffer);
+ snprintf(buffer,80,"\n\tmedian read latency per sector: %.1f ms",median);
+ cdmessage(d,buffer);
+ }
/* verify slow spinup did not compromise median */
for(i=1;i<current;i++)
if(latency[i]>latency[i-1] || latency[i]<=(median+1.))break;
if(i>5){
- cdmessage(d,"\n\tDrive appears to spin up slowly... retrying...");
+ if(debug)
+ cdmessage(d,"\n\tDrive appears to spin up slowly... retrying...");
offset-=current+1;
continue;
}
@@ -364,14 +391,13 @@
/* bisection search on cache size */
- int lo=10;
+ int lo=1;
int hi=15000;
int current=lo;
int under=1;
- float ms_per_sector = 1./75.*1000./100.;
d->nsectors=1;
while(current <= hi && under){
- int offset = (lastsector - firstsector - current)/2+firstsector;
+ int offset = (lastsector - firstsector - (current+1))/2+firstsector;
int i,j;
under=0;
Modified: trunk/cdparanoia/interface/interface.c
===================================================================
--- trunk/cdparanoia/interface/interface.c 2008-08-15 04:10:54 UTC (rev 15185)
+++ trunk/cdparanoia/interface/interface.c 2008-08-15 07:20:39 UTC (rev 15186)
@@ -134,6 +134,10 @@
d->errordest=err_action;
}
+void cdda_debug_set(cdrom_drive *d,int active){
+ d->private->cache_debug=active;
+}
+
extern char *cdda_messages(cdrom_drive *d){
char *ret=d->messagebuf;
d->messagebuf=NULL;
Modified: trunk/cdparanoia/interface/low_interface.h
===================================================================
--- trunk/cdparanoia/interface/low_interface.h 2008-08-15 04:10:54 UTC (rev 15185)
+++ trunk/cdparanoia/interface/low_interface.h 2008-08-15 07:20:39 UTC (rev 15186)
@@ -103,6 +103,7 @@
int last_milliseconds;
int cache_backseekflush;
int cache_sectors;
+ int cache_debug;
};
#define MAX_RETRIES 8
Modified: trunk/cdparanoia/main.c
===================================================================
--- trunk/cdparanoia/main.c 2008-08-15 04:10:54 UTC (rev 15185)
+++ trunk/cdparanoia/main.c 2008-08-15 07:20:39 UTC (rev 15186)
@@ -38,6 +38,7 @@
#include "version.h"
#include "header.h"
+static int verbosedebug;
extern int verbose;
extern int quiet;
@@ -215,6 +216,8 @@
"OPTIONS:\n"
" -v --verbose : extra verbose operation\n"
+" -vv --verbose-debug : enable additional analysis debugging\n"
+" and testing output for developers\n"
" -q --quiet : quiet operation\n"
" -e --stderr-progress : force output of progress information to\n"
" stderr (for wrapper scripts)\n"
@@ -606,6 +609,7 @@
{"output-aifc",no_argument,NULL,'a'},
{"batch",no_argument,NULL,'B'},
{"verbose",no_argument,NULL,'v'},
+ {"verbose-debug",no_argument,NULL,'*'},
{"quiet",no_argument,NULL,'q'},
{"version",no_argument,NULL,'V'},
{"query",no_argument,NULL,'Q'},
@@ -739,14 +743,22 @@
output_endian=1;
break;
case 'v':
+ if(verbose==CDDA_MESSAGE_PRINTIT)
+ verbosedebug=1;
verbose=CDDA_MESSAGE_PRINTIT;
quiet=0;
break;
+ case '*':
+ verbosedebug=1;
+ verbose=CDDA_MESSAGE_PRINTIT;
+ quiet=0;
+ break;
case 's':
search=1;
break;
case 'q':
verbose=CDDA_MESSAGE_FORGETIT;
+ verbosedebug=0;
quiet=1;
break;
case 'e':
@@ -894,6 +906,8 @@
else
cdda_verbose_set(d,CDDA_MESSAGE_PRINTIT,CDDA_MESSAGE_FORGETIT);
+ cdda_debug_set(d,verbosedebug);
+
/* possibly force hand on endianness of drive, sector request size */
if(force_cdrom_endian!=-1){
d->bigendianp=force_cdrom_endian;
More information about the commits
mailing list