Small printf changes. Also reworked PrintThreadPoolStats() so that we can
remove a few #ifdef DEBUG from the main code. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@231 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
c85537df11
commit
4f960c4e34
@ -1523,6 +1523,9 @@ void ThreadPoolPrintStats(ThreadPoolStats * stats)
|
|||||||
#else /* __FreeBSD__ */
|
#else /* __FreeBSD__ */
|
||||||
printf("ThreadPoolStats at Time: %ld\n", time(NULL));
|
printf("ThreadPoolStats at Time: %ld\n", time(NULL));
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
|
printf("High Jobs pending: %d\n", stats->currentJobsHQ);
|
||||||
|
printf("Med Jobs Pending: %d\n", stats->currentJobsMQ);
|
||||||
|
printf("Low Jobs Pending: %d\n", stats->currentJobsLQ);
|
||||||
printf("Average Wait in High Priority Q in milliseconds: %f\n", stats->avgWaitHQ);
|
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("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("Averate Wait in Low Priority Q in milliseconds: %f\n", stats->avgWaitLQ);
|
||||||
|
@ -323,27 +323,54 @@ int UpnpInit( IN const char *HostIP,
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void
|
static void
|
||||||
PrintThreadPoolStats (const char* DbgFileName, int DbgLineNo,
|
PrintThreadPoolStats(
|
||||||
const char* msg, const ThreadPoolStats* const stats)
|
ThreadPool *tp,
|
||||||
|
const char *DbgFileName,
|
||||||
|
int DbgLineNo,
|
||||||
|
const char *msg)
|
||||||
{
|
{
|
||||||
UpnpPrintf (UPNP_INFO, API, DbgFileName, DbgLineNo,
|
ThreadPoolStats stats;
|
||||||
"%s \n High Jobs pending = %d \nMed Jobs Pending = %d\n"
|
ThreadPoolGetStats(tp, &stats);
|
||||||
" Low Jobs Pending = %d \nWorker Threads = %d\n"
|
UpnpPrintf(UPNP_INFO, API, DbgFileName, DbgLineNo,
|
||||||
"Idle Threads = %d\nPersistent Threads = %d\n"
|
"%s \n"
|
||||||
"Average Time spent in High Q = %lf\n"
|
"High Jobs pending: %d\n"
|
||||||
"Average Time spent in Med Q = %lf\n"
|
"Med Jobs Pending: %d\n"
|
||||||
"Average Time spent in Low Q = %lf\n"
|
"Low Jobs Pending: %d\n"
|
||||||
"Max Threads Used: %d\nTotal Work Time= %lf\n"
|
"Average wait in High Q in milliseconds: %lf\n"
|
||||||
"Total Idle Time = %lf\n",
|
"Average wait in Med Q in milliseconds: %lf\n"
|
||||||
msg,
|
"Average wait in Low Q in milliseconds: %lf\n"
|
||||||
stats->currentJobsHQ, stats->currentJobsMQ,
|
"Max Threads Used: %d\n"
|
||||||
stats->currentJobsLQ, stats->workerThreads,
|
"Worker Threads: %d\n"
|
||||||
stats->idleThreads, stats->persistentThreads,
|
"Persistent Threads: %d\n"
|
||||||
stats->avgWaitHQ, stats->avgWaitMQ, stats->avgWaitLQ,
|
"Idle Threads: %d\n"
|
||||||
stats->maxThreads, stats->totalWorkTime,
|
"Total Threads: %d\n"
|
||||||
stats->totalIdleTime );
|
"Total Work Time: %lf\n"
|
||||||
|
"Total Idle Time: %lf\n",
|
||||||
|
msg,
|
||||||
|
stats.currentJobsHQ,
|
||||||
|
stats.currentJobsMQ,
|
||||||
|
stats.currentJobsLQ,
|
||||||
|
stats.avgWaitHQ,
|
||||||
|
stats.avgWaitMQ,
|
||||||
|
stats.avgWaitLQ,
|
||||||
|
stats.maxThreads,
|
||||||
|
stats.workerThreads,
|
||||||
|
stats.persistentThreads,
|
||||||
|
stats.idleThreads,
|
||||||
|
stats.totalThreads,
|
||||||
|
stats.totalWorkTime,
|
||||||
|
stats.totalIdleTime);
|
||||||
}
|
}
|
||||||
#endif
|
#else /* DEBUG */
|
||||||
|
static UPNP_INLINE void
|
||||||
|
PrintThreadPoolStats(
|
||||||
|
ThreadPool *tp,
|
||||||
|
const char *DbgFileName,
|
||||||
|
int DbgLineNo,
|
||||||
|
const char *msg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -374,10 +401,6 @@ UpnpFinish()
|
|||||||
#endif
|
#endif
|
||||||
struct Handle_Info *temp;
|
struct Handle_Info *temp;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
ThreadPoolStats stats;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// WSACleanup( );
|
// WSACleanup( );
|
||||||
#endif
|
#endif
|
||||||
@ -393,14 +416,8 @@ UpnpFinish()
|
|||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"UpnpFinish : UpnpSdkInit is ONE\n" );
|
"UpnpFinish : UpnpSdkInit is ONE\n" );
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
PrintThreadPoolStats(&gRecvThreadPool, __FILE__, __LINE__, "Recv Thread Pool");
|
||||||
ThreadPoolGetStats( &gRecvThreadPool, &stats );
|
PrintThreadPoolStats(&gSendThreadPool, __FILE__, __LINE__, "Send Thread Pool");
|
||||||
PrintThreadPoolStats (__FILE__, __LINE__,
|
|
||||||
"Recv Thread Pool", &stats);
|
|
||||||
ThreadPoolGetStats( &gSendThreadPool, &stats );
|
|
||||||
PrintThreadPoolStats (__FILE__, __LINE__,
|
|
||||||
"Send Thread Pool", &stats);
|
|
||||||
#endif
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
if( GetDeviceHandleInfo( &device_handle, &temp ) == HND_DEVICE )
|
if( GetDeviceHandleInfo( &device_handle, &temp ) == HND_DEVICE )
|
||||||
UpnpUnRegisterRootDevice( device_handle );
|
UpnpUnRegisterRootDevice( device_handle );
|
||||||
@ -419,44 +436,38 @@ UpnpFinish()
|
|||||||
web_server_destroy();
|
web_server_destroy();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ThreadPoolShutdown( &gSendThreadPool );
|
ThreadPoolShutdown(&gSendThreadPool);
|
||||||
ThreadPoolShutdown( &gRecvThreadPool );
|
ThreadPoolShutdown(&gRecvThreadPool);
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Exiting UpnpFinish : UpnpSdkInit is :%d:\n",
|
"Exiting UpnpFinish : UpnpSdkInit is :%d:\n", UpnpSdkInit);
|
||||||
UpnpSdkInit );
|
PrintThreadPoolStats(&gRecvThreadPool, __FILE__, __LINE__, "Recv Thread Pool");
|
||||||
#ifdef DEBUG
|
PrintThreadPoolStats(&gSendThreadPool, __FILE__, __LINE__, "Send Thread Pool");
|
||||||
ThreadPoolGetStats( &gRecvThreadPool, &stats );
|
|
||||||
PrintThreadPoolStats( __FILE__, __LINE__,
|
|
||||||
"Recv Thread Pool", &stats);
|
|
||||||
ThreadPoolGetStats( &gSendThreadPool, &stats );
|
|
||||||
PrintThreadPoolStats(__FILE__, __LINE__,
|
|
||||||
"Send Thread Pool", &stats);
|
|
||||||
#endif
|
|
||||||
UpnpCloseLog();
|
UpnpCloseLog();
|
||||||
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
ithread_mutex_destroy( &GlobalClientSubscribeMutex );
|
ithread_mutex_destroy(&GlobalClientSubscribeMutex);
|
||||||
#endif
|
#endif
|
||||||
ithread_mutex_destroy( &GlobalHndMutex );
|
ithread_mutex_destroy(&GlobalHndMutex);
|
||||||
ithread_mutex_destroy( &gUUIDMutex );
|
ithread_mutex_destroy(&gUUIDMutex);
|
||||||
|
|
||||||
// remove all virtual dirs
|
// remove all virtual dirs
|
||||||
UpnpRemoveAllVirtualDirs();
|
UpnpRemoveAllVirtualDirs();
|
||||||
// leuk_he allow static linking:
|
|
||||||
|
// allow static linking
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifdef PTW32_STATIC_LIB
|
#ifdef PTW32_STATIC_LIB
|
||||||
pthread_win32_thread_detach_np ();
|
pthread_win32_thread_detach_np ();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
UpnpSdkInit = 0;
|
UpnpSdkInit = 0;
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
|
||||||
} /********************* End of UpnpFinish *************************/
|
}
|
||||||
|
/*************************** End of UpnpFinish *****************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/******************************************************************************
|
||||||
* Function: UpnpGetServerPort
|
* Function: UpnpGetServerPort
|
||||||
*
|
*
|
||||||
* Parameters: NONE
|
* Parameters: NONE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user