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 int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
||||||
|
|
||||||
EXPORT void ThreadPoolPrintStats(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
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1511,36 +1511,30 @@ static void SetSeed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STATS
|
#ifdef STATS
|
||||||
void ThreadPoolPrintStats( ThreadPoolStats * stats ) {
|
void ThreadPoolPrintStats(ThreadPoolStats * stats)
|
||||||
assert( stats != NULL ); if( stats == NULL ) {
|
{
|
||||||
return;}
|
assert( stats != NULL );
|
||||||
|
if (stats == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
printf( "ThreadPoolStats at Time: %d\n", time( NULL ) );
|
printf("ThreadPoolStats at Time: %d\n", time(NULL));
|
||||||
#else
|
#else /* __FreeBSD__ */
|
||||||
printf( "ThreadPoolStats at Time: %ld\n", time( NULL ) );
|
printf("ThreadPoolStats at Time: %ld\n", time(NULL));
|
||||||
#endif
|
#endif /* __FreeBSD__ */
|
||||||
printf
|
printf("Average Wait in High Priority Q in milliseconds: %f\n", stats->avgWaitHQ);
|
||||||
( "Average Wait in High Priority Q in milliseconds: %f\n",
|
printf("Average Wait in Med Priority Q in milliseconds: %f\n", stats->avgWaitMQ);
|
||||||
stats->avgWaitHQ );
|
printf("Averate Wait in Low Priority Q in milliseconds: %f\n", stats->avgWaitLQ);
|
||||||
printf
|
printf("Max Threads Active: %d\n", stats->maxThreads);
|
||||||
( "Average Wait in Med Priority Q in milliseconds: %f\n",
|
printf("Current Worker Threads: %d\n", stats->workerThreads);
|
||||||
stats->avgWaitMQ );
|
printf("Current Persistent Threads: %d\n", stats->persistentThreads);
|
||||||
printf
|
printf("Current Idle Threads: %d\n", stats->idleThreads);
|
||||||
( "Averate Wait in Low Priority Q in milliseconds: %f\n",
|
printf("Total Threads : %d\n", stats->totalThreads);
|
||||||
stats->avgWaitLQ );
|
printf("Total Time spent Working in seconds: %f\n", stats->totalWorkTime);
|
||||||
printf( "Max Threads Active: %d\n", stats->maxThreads );
|
printf("Total Time spent Idle in seconds : %f\n", stats->totalIdleTime);
|
||||||
printf( "Current Worker Threads: %d\n",
|
}
|
||||||
stats->workerThreads );
|
#endif /* STATS */
|
||||||
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
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetMaxJobsTotal
|
* Function: TPAttrSetMaxJobsTotal
|
||||||
@ -1580,40 +1574,54 @@ static void SetSeed() {
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef STATS
|
#ifdef STATS
|
||||||
int
|
int
|
||||||
ThreadPoolGetStats( ThreadPool * tp,
|
ThreadPoolGetStats(
|
||||||
ThreadPoolStats * stats ) {
|
ThreadPool *tp,
|
||||||
|
ThreadPoolStats *stats)
|
||||||
|
{
|
||||||
|
assert(tp != NULL);
|
||||||
|
assert(stats != NULL);
|
||||||
|
|
||||||
assert( tp != NULL );
|
if (tp == NULL || stats == NULL) {
|
||||||
assert( stats != NULL );
|
return EINVAL;
|
||||||
if( ( tp == NULL ) || ( stats == NULL ) ) {
|
}
|
||||||
return EINVAL;}
|
|
||||||
|
|
||||||
//if not shutdown then acquire mutex
|
//if not shutdown then acquire mutex
|
||||||
if( !tp->shutdown ) {
|
if (!tp->shutdown) {
|
||||||
ithread_mutex_lock( &tp->mutex );}
|
ithread_mutex_lock(&tp->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
( *stats ) = tp->stats; if( stats->totalJobsHQ > 0 )
|
*stats = tp->stats;
|
||||||
stats->avgWaitHQ =
|
if (stats->totalJobsHQ > 0) {
|
||||||
stats->totalTimeHQ / stats->totalJobsHQ;
|
stats->avgWaitHQ = stats->totalTimeHQ / stats->totalJobsHQ;
|
||||||
else
|
} else {
|
||||||
stats->avgWaitHQ = 0; if( stats->totalJobsMQ > 0 )
|
stats->avgWaitHQ = 0;
|
||||||
stats->avgWaitMQ =
|
}
|
||||||
stats->totalTimeMQ / stats->totalJobsMQ;
|
|
||||||
else
|
if( stats->totalJobsMQ > 0 ) {
|
||||||
stats->avgWaitMQ = 0; if( stats->totalJobsLQ > 0 )
|
stats->avgWaitMQ = stats->totalTimeMQ / stats->totalJobsMQ;
|
||||||
stats->avgWaitLQ =
|
} else {
|
||||||
stats->totalTimeLQ / stats->totalJobsLQ;
|
stats->avgWaitMQ = 0;
|
||||||
else
|
}
|
||||||
stats->avgWaitLQ = 0;
|
|
||||||
stats->totalThreads = tp->totalThreads;
|
if( stats->totalJobsLQ > 0 ) {
|
||||||
stats->persistentThreads = tp->persistentThreads;
|
stats->avgWaitLQ = stats->totalTimeLQ / stats->totalJobsLQ;
|
||||||
stats->currentJobsHQ = ListSize( &tp->highJobQ );
|
} else {
|
||||||
stats->currentJobsLQ = ListSize( &tp->lowJobQ );
|
stats->avgWaitLQ = 0;
|
||||||
stats->currentJobsMQ = ListSize( &tp->medJobQ );
|
}
|
||||||
//if not shutdown then release mutex
|
|
||||||
if( !tp->shutdown ) {
|
|
||||||
ithread_mutex_unlock( &tp->mutex );}
|
|
||||||
|
|
||||||
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)))
|
__attribute__((format (__printf__, 5, 6)))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
#else
|
#else /* DEBUG */
|
||||||
static UPNP_INLINE void UpnpPrintf(
|
static UPNP_INLINE void UpnpPrintf(
|
||||||
Upnp_LogLevel DLevel,
|
Upnp_LogLevel DLevel,
|
||||||
Dbg_Module Module,
|
Dbg_Module Module,
|
||||||
@ -266,7 +266,7 @@ static UPNP_INLINE void UpnpPrintf(
|
|||||||
int DbgLineNo,
|
int DbgLineNo,
|
||||||
const char* FmtStr,
|
const char* FmtStr,
|
||||||
...) {}
|
...) {}
|
||||||
#endif
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user