White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@229 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
5b744169d5
commit
20905cb7a7
@ -547,6 +547,10 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
||||
EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
||||
|
||||
EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
||||
#else
|
||||
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
||||
|
||||
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1511,36 +1511,30 @@ static void SetSeed() {
|
||||
}
|
||||
|
||||
#ifdef STATS
|
||||
void ThreadPoolPrintStats( ThreadPoolStats * stats ) {
|
||||
assert( stats != NULL ); if( stats == NULL ) {
|
||||
return;}
|
||||
void ThreadPoolPrintStats(ThreadPoolStats * stats)
|
||||
{
|
||||
assert( stats != NULL );
|
||||
if (stats == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
printf( "ThreadPoolStats at Time: %d\n", time( NULL ) );
|
||||
#else
|
||||
printf( "ThreadPoolStats at Time: %ld\n", time( NULL ) );
|
||||
#endif
|
||||
printf
|
||||
( "Average Wait in High Priority Q in milliseconds: %f\n",
|
||||
stats->avgWaitHQ );
|
||||
printf
|
||||
( "Average Wait in Med Priority Q in milliseconds: %f\n",
|
||||
stats->avgWaitMQ );
|
||||
printf
|
||||
( "Averate Wait in Low Priority Q in milliseconds: %f\n",
|
||||
stats->avgWaitLQ );
|
||||
printf( "Max Threads Active: %d\n", stats->maxThreads );
|
||||
printf( "Current Worker Threads: %d\n",
|
||||
stats->workerThreads );
|
||||
printf( "Current Persistent Threads: %d\n",
|
||||
stats->persistentThreads );
|
||||
printf( "Current Idle Threads: %d\n", stats->idleThreads );
|
||||
printf( "Total Threads : %d\n", stats->totalThreads );
|
||||
printf( "Total Time spent Working in seconds: %f\n",
|
||||
stats->totalWorkTime );
|
||||
printf( "Total Time spent Idle in seconds : %f\n",
|
||||
stats->totalIdleTime );}
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
printf("ThreadPoolStats at Time: %d\n", time(NULL));
|
||||
#else /* __FreeBSD__ */
|
||||
printf("ThreadPoolStats at Time: %ld\n", time(NULL));
|
||||
#endif /* __FreeBSD__ */
|
||||
printf("Average Wait in High Priority Q in milliseconds: %f\n", stats->avgWaitHQ);
|
||||
printf("Average Wait in Med Priority Q in milliseconds: %f\n", stats->avgWaitMQ);
|
||||
printf("Averate Wait in Low Priority Q in milliseconds: %f\n", stats->avgWaitLQ);
|
||||
printf("Max Threads Active: %d\n", stats->maxThreads);
|
||||
printf("Current Worker Threads: %d\n", stats->workerThreads);
|
||||
printf("Current Persistent Threads: %d\n", stats->persistentThreads);
|
||||
printf("Current Idle Threads: %d\n", stats->idleThreads);
|
||||
printf("Total Threads : %d\n", stats->totalThreads);
|
||||
printf("Total Time spent Working in seconds: %f\n", stats->totalWorkTime);
|
||||
printf("Total Time spent Idle in seconds : %f\n", stats->totalIdleTime);
|
||||
}
|
||||
#endif /* STATS */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetMaxJobsTotal
|
||||
@ -1580,40 +1574,54 @@ static void SetSeed() {
|
||||
*****************************************************************************/
|
||||
#ifdef STATS
|
||||
int
|
||||
ThreadPoolGetStats( ThreadPool * tp,
|
||||
ThreadPoolStats * stats ) {
|
||||
ThreadPoolGetStats(
|
||||
ThreadPool *tp,
|
||||
ThreadPoolStats *stats)
|
||||
{
|
||||
assert(tp != NULL);
|
||||
assert(stats != NULL);
|
||||
|
||||
assert( tp != NULL );
|
||||
assert( stats != NULL );
|
||||
if( ( tp == NULL ) || ( stats == NULL ) ) {
|
||||
return EINVAL;}
|
||||
if (tp == NULL || stats == NULL) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
//if not shutdown then acquire mutex
|
||||
if( !tp->shutdown ) {
|
||||
ithread_mutex_lock( &tp->mutex );}
|
||||
//if not shutdown then acquire mutex
|
||||
if (!tp->shutdown) {
|
||||
ithread_mutex_lock(&tp->mutex);
|
||||
}
|
||||
|
||||
( *stats ) = tp->stats; if( stats->totalJobsHQ > 0 )
|
||||
stats->avgWaitHQ =
|
||||
stats->totalTimeHQ / stats->totalJobsHQ;
|
||||
else
|
||||
stats->avgWaitHQ = 0; if( stats->totalJobsMQ > 0 )
|
||||
stats->avgWaitMQ =
|
||||
stats->totalTimeMQ / stats->totalJobsMQ;
|
||||
else
|
||||
stats->avgWaitMQ = 0; if( stats->totalJobsLQ > 0 )
|
||||
stats->avgWaitLQ =
|
||||
stats->totalTimeLQ / stats->totalJobsLQ;
|
||||
else
|
||||
stats->avgWaitLQ = 0;
|
||||
stats->totalThreads = tp->totalThreads;
|
||||
stats->persistentThreads = tp->persistentThreads;
|
||||
stats->currentJobsHQ = ListSize( &tp->highJobQ );
|
||||
stats->currentJobsLQ = ListSize( &tp->lowJobQ );
|
||||
stats->currentJobsMQ = ListSize( &tp->medJobQ );
|
||||
//if not shutdown then release mutex
|
||||
if( !tp->shutdown ) {
|
||||
ithread_mutex_unlock( &tp->mutex );}
|
||||
*stats = tp->stats;
|
||||
if (stats->totalJobsHQ > 0) {
|
||||
stats->avgWaitHQ = stats->totalTimeHQ / stats->totalJobsHQ;
|
||||
} else {
|
||||
stats->avgWaitHQ = 0;
|
||||
}
|
||||
|
||||
if( stats->totalJobsMQ > 0 ) {
|
||||
stats->avgWaitMQ = stats->totalTimeMQ / stats->totalJobsMQ;
|
||||
} else {
|
||||
stats->avgWaitMQ = 0;
|
||||
}
|
||||
|
||||
if( stats->totalJobsLQ > 0 ) {
|
||||
stats->avgWaitLQ = stats->totalTimeLQ / stats->totalJobsLQ;
|
||||
} else {
|
||||
stats->avgWaitLQ = 0;
|
||||
}
|
||||
|
||||
return 0;}
|
||||
stats->totalThreads = tp->totalThreads;
|
||||
stats->persistentThreads = tp->persistentThreads;
|
||||
stats->currentJobsHQ = ListSize( &tp->highJobQ );
|
||||
stats->currentJobsLQ = ListSize( &tp->lowJobQ );
|
||||
stats->currentJobsMQ = ListSize( &tp->medJobQ );
|
||||
|
||||
//if not shutdown then release mutex
|
||||
if( !tp->shutdown ) {
|
||||
ithread_mutex_unlock( &tp->mutex );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* STATS */
|
||||
|
||||
#endif
|
||||
|
@ -258,7 +258,7 @@ void UpnpPrintf(
|
||||
__attribute__((format (__printf__, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
#else
|
||||
#else /* DEBUG */
|
||||
static UPNP_INLINE void UpnpPrintf(
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module,
|
||||
@ -266,7 +266,7 @@ static UPNP_INLINE void UpnpPrintf(
|
||||
int DbgLineNo,
|
||||
const char* FmtStr,
|
||||
...) {}
|
||||
#endif
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user