Commit bf1723b9 authored by sletz's avatar sletz
Browse files

Improve generated gnuplot files for adapting code.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3365 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 71f010e1
......@@ -23,9 +23,13 @@ Michael Voigt
Jackdmp changes log
---------------------------
2009-02-27 Stephane Letz <letz@grame.fr>
* Improve generated gnuplot files for adapting code.
2009-02-25 Stephane Letz <letz@grame.fr>
* Major cleanup in adapter code.
* Major cleanup in adapter code.
2009-02-25 Stephane Letz <letz@grame.fr>
......
......@@ -38,7 +38,7 @@ namespace Jack
fTable[pos].pos2 = pos2;
}
void MeasureTable::Save()
void MeasureTable::Save(unsigned int fHostBufferSize, unsigned int fHostSampleRate, unsigned int fAdaptedSampleRate, unsigned int fAdaptedBufferSize)
{
char buffer[1024];
FILE* file = fopen("JackAudioAdapter.log", "w");
......@@ -55,6 +55,22 @@ namespace Jack
// Adapter timing 1
file = fopen("AdapterTiming1.plot", "w");
fprintf(file, "set multiplot\n");
fprintf(file, "set grid\n");
fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
fprintf(file, "set xlabel \"audio cycles\"\n");
fprintf(file, "set ylabel \"frames\"\n");
fprintf(file, "plot ");
sprintf(buffer, "\"JackAudioAdapter.log\" using 2 title \"Consumer interrupt period\" with lines,");
fprintf(file, buffer);
sprintf(buffer, "\"JackAudioAdapter.log\" using 3 title \"Producer interrupt period\" with lines");
fprintf(file, buffer);
fprintf(file, "\n unset multiplot\n");
fprintf(file, "set output 'AdapterTiming1.pdf\n");
fprintf(file, "set terminal pdf\n");
fprintf(file, "set multiplot\n");
fprintf(file, "set grid\n");
fprintf(file, "set title \"Audio adapter timing\"\n");
......@@ -65,10 +81,27 @@ namespace Jack
fprintf(file, buffer);
sprintf(buffer, "\"JackAudioAdapter.log\" using 3 title \"Producer interrupt period\" with lines");
fprintf(file, buffer);
fclose(file);
// Adapter timing 2
file = fopen("AdapterTiming2.plot", "w");
fprintf(file, "set multiplot\n");
fprintf(file, "set grid\n");
fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
fprintf(file, "set xlabel \"audio cycles\"\n");
fprintf(file, "set ylabel \"resampling ratio\"\n");
fprintf(file, "plot ");
sprintf(buffer, "\"JackAudioAdapter.log\" using 4 title \"Ratio 1\" with lines,");
fprintf(file, buffer);
sprintf(buffer, "\"JackAudioAdapter.log\" using 5 title \"Ratio 2\" with lines");
fprintf(file, buffer);
fprintf(file, "\n unset multiplot\n");
fprintf(file, "set output 'AdapterTiming2.pdf\n");
fprintf(file, "set terminal pdf\n");
fprintf(file, "set multiplot\n");
fprintf(file, "set grid\n");
fprintf(file, "set title \"Audio adapter timing\"\n");
......@@ -79,10 +112,27 @@ namespace Jack
fprintf(file, buffer);
sprintf(buffer, "\"JackAudioAdapter.log\" using 5 title \"Ratio 2\" with lines");
fprintf(file, buffer);
fclose(file);
// Adapter timing 3
file = fopen("AdapterTiming3.plot", "w");
fprintf(file, "set multiplot\n");
fprintf(file, "set grid\n");
fprintf(file, "set title \"Audio adapter timing: host [rate = %.1f kHz buffer = %d frames] adapter [rate = %.1f kHz buffer = %d frames] \"\n"
,float(fHostSampleRate)/1000.f, fHostBufferSize, float(fAdaptedSampleRate)/1000.f, fAdaptedBufferSize);
fprintf(file, "set xlabel \"audio cycles\"\n");
fprintf(file, "set ylabel \"frames\"\n");
fprintf(file, "plot ");
sprintf(buffer, "\"JackAudioAdapter.log\" using 6 title \"Frames position in consumer ringbuffer\" with lines,");
fprintf(file, buffer);
sprintf(buffer, "\"JackAudioAdapter.log\" using 7 title \"Frames position in producer ringbuffer\" with lines");
fprintf(file, buffer);
fprintf(file, "\n unset multiplot\n");
fprintf(file, "set output 'AdapterTiming3.pdf\n");
fprintf(file, "set terminal pdf\n");
fprintf(file, "set multiplot\n");
fprintf(file, "set grid\n");
fprintf(file, "set title \"Audio adapter timing\"\n");
......@@ -93,6 +143,7 @@ namespace Jack
fprintf(file, buffer);
sprintf(buffer, "\"JackAudioAdapter.log\" using 7 title \"Frames position in producer ringbuffer\" with lines");
fprintf(file, buffer);
fclose(file);
}
......
......@@ -51,8 +51,8 @@ namespace Jack
MeasureTable() :fCount ( 0 )
{}
void Write ( int time1, int time2, float r1, float r2, int pos1, int pos2 );
void Save();
void Write(int time1, int time2, float r1, float r2, int pos1, int pos2);
void Save(unsigned int fHostBufferSize, unsigned int fHostSampleRate, unsigned int fAdaptedSampleRate, unsigned int fAdaptedBufferSize);
};
......
......@@ -111,7 +111,7 @@ namespace Jack
int JackAlsaAdapter::Close()
{
#ifdef JACK_MONITOR
fTable.Save();
fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
#endif
switch ( fThread.GetStatus() )
{
......
......@@ -948,7 +948,7 @@ int JackCoreAudioAdapter::Open()
int JackCoreAudioAdapter::Close()
{
#ifdef JACK_MONITOR
fTable.Save();
fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
#endif
AudioOutputUnitStop(fAUHAL);
DisposeBuffers();
......
......@@ -507,9 +507,8 @@ error:
int JackOSSAdapter::Close()
{
#ifdef JACK_MONITOR
fTable.Save();
fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
#endif
fThread.Stop();
CloseAux();
return 0;
......
......@@ -178,7 +178,7 @@ namespace Jack
int JackPortAudioAdapter::Close()
{
#ifdef JACK_MONITOR
fTable.Save();
fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
#endif
jack_log ( "JackPortAudioAdapter::Close" );
Pa_StopStream ( fStream );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment