Fix issues reported by Siva Chandran P

Replace function wide STSONLY macros with ifdef STATS.
Remove %lf format modifiers


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@70 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Nektarios K. Papadopoulos 2006-07-26 13:43:23 +00:00
parent 7c49b3b8a4
commit d5449dc948

View File

@ -289,7 +289,8 @@ SetRelTimeout( struct timespec *time,
* Parameters: * Parameters:
* ThreadPoolStats *stats must be valid non null stats structure * ThreadPoolStats *stats must be valid non null stats structure
*****************************************************************************/ *****************************************************************************/
STATSONLY( static void StatsInit( ThreadPoolStats * stats ) { #ifdef STATS
static void StatsInit( ThreadPoolStats * stats ) {
assert( stats != NULL ); stats->totalIdleTime = 0; stats->totalJobsHQ = 0; stats->totalJobsLQ = 0; stats->totalJobsMQ = 0; stats->totalTimeHQ = 0; stats->totalTimeMQ = 0; stats->totalTimeLQ = 0; stats->totalWorkTime = 0; stats->totalIdleTime = 0; stats->avgWaitHQ = 0; //average wait in HQ assert( stats != NULL ); stats->totalIdleTime = 0; stats->totalJobsHQ = 0; stats->totalJobsLQ = 0; stats->totalJobsMQ = 0; stats->totalTimeHQ = 0; stats->totalTimeMQ = 0; stats->totalTimeLQ = 0; stats->totalWorkTime = 0; stats->totalIdleTime = 0; stats->avgWaitHQ = 0; //average wait in HQ
stats->avgWaitMQ = 0; //average wait in MQ stats->avgWaitMQ = 0; //average wait in MQ
stats->avgWaitLQ = 0; stats->avgWaitLQ = 0;
@ -297,7 +298,7 @@ STATSONLY( static void StatsInit( ThreadPoolStats * stats ) {
stats->idleThreads = 0; stats->idleThreads = 0;
stats->persistentThreads = 0; stats->persistentThreads = 0;
stats->maxThreads = 0; stats->totalThreads = 0;} stats->maxThreads = 0; stats->totalThreads = 0;}
) #endif
/**************************************************************************** /****************************************************************************
* Function: CalcWaitTime * Function: CalcWaitTime
@ -313,7 +314,8 @@ STATSONLY( static void StatsInit( ThreadPoolStats * stats ) {
* ThreadPriority p * ThreadPriority p
* ThreadPoolJob *job * ThreadPoolJob *job
*****************************************************************************/ *****************************************************************************/
STATSONLY( static void CalcWaitTime( ThreadPool * tp, #ifdef STATS
static void CalcWaitTime( ThreadPool * tp,
ThreadPriority p, ThreadPriority p,
ThreadPoolJob * job ) { ThreadPoolJob * job ) {
struct timeb now; struct timeb now;
@ -329,7 +331,7 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
assert( 0 );} assert( 0 );}
} }
) #endif
/**************************************************************************** /****************************************************************************
* Function: SetSeed * Function: SetSeed
@ -1461,7 +1463,8 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
return 0; return 0;
} }
STATSONLY( void ThreadPoolPrintStats( ThreadPoolStats * stats ) { #ifdef STATS
void ThreadPoolPrintStats( ThreadPoolStats * stats ) {
assert( stats != NULL ); if( stats == NULL ) { assert( stats != NULL ); if( stats == NULL ) {
return;} return;}
@ -1471,13 +1474,13 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
printf( "ThreadPoolStats at Time: %ld\n", time( NULL ) ); printf( "ThreadPoolStats at Time: %ld\n", time( NULL ) );
#endif #endif
printf printf
( "Average Wait in High Priority Q in milliseconds: %lf\n", ( "Average Wait in High Priority Q in milliseconds: %f\n",
stats->avgWaitHQ ); stats->avgWaitHQ );
printf printf
( "Average Wait in Med Priority Q in milliseconds: %lf\n", ( "Average Wait in Med Priority Q in milliseconds: %f\n",
stats->avgWaitMQ ); stats->avgWaitMQ );
printf printf
( "Averate Wait in Low Priority Q in milliseconds: %lf\n", ( "Averate Wait in Low Priority Q in milliseconds: %f\n",
stats->avgWaitLQ ); stats->avgWaitLQ );
printf( "Max Threads Active: %d\n", stats->maxThreads ); printf( "Max Threads Active: %d\n", stats->maxThreads );
printf( "Current Worker Threads: %d\n", printf( "Current Worker Threads: %d\n",
@ -1486,11 +1489,11 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
stats->persistentThreads ); stats->persistentThreads );
printf( "Current Idle Threads: %d\n", stats->idleThreads ); printf( "Current Idle Threads: %d\n", stats->idleThreads );
printf( "Total Threads : %d\n", stats->totalThreads ); printf( "Total Threads : %d\n", stats->totalThreads );
printf( "Total Time spent Working in seconds: %lf\n", printf( "Total Time spent Working in seconds: %f\n",
stats->totalWorkTime ); stats->totalWorkTime );
printf( "Total Time spent Idle in seconds : %lf\n", printf( "Total Time spent Idle in seconds : %f\n",
stats->totalIdleTime );} stats->totalIdleTime );}
) #endif
/**************************************************************************** /****************************************************************************
* Function: ThreadPoolGetStats * Function: ThreadPoolGetStats
@ -1505,7 +1508,8 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
* Returns: * Returns:
* Always returns 0. * Always returns 0.
*****************************************************************************/ *****************************************************************************/
STATSONLY( int #ifdef STATS
int
ThreadPoolGetStats( ThreadPool * tp, ThreadPoolGetStats( ThreadPool * tp,
ThreadPoolStats * stats ) { ThreadPoolStats * stats ) {
@ -1542,4 +1546,4 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
return 0;} return 0;}
) #endif