git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@87 119443c7-1b9e-41f8-b6fc-b9c35fce742c

This commit is contained in:
Oxy 2006-09-28 17:20:22 +00:00
parent 38a91fdaec
commit ae13c481a7

View File

@ -61,32 +61,32 @@ typedef enum priority {LOW_PRIORITY,
#define DEFAULT_JOBS_PER_THREAD 10 //default jobs per thread used by TPAttrInit #define DEFAULT_JOBS_PER_THREAD 10 //default jobs per thread used by TPAttrInit
#define DEFAULT_STARVATION_TIME 500 //default starvation time used by TPAttrInit #define DEFAULT_STARVATION_TIME 500 //default starvation time used by TPAttrInit
#define DEFAULT_IDLE_TIME 10 * 1000 //default idle time used by TPAttrInit #define DEFAULT_IDLE_TIME 10 * 1000 //default idle time used by TPAttrInit
#define DEFAULT_FREE_ROUTINE NULL //default free routine used TPJobInit #define DEFAULT_FREE_ROUTINE NULL //default free routine used TPJobInit
#define STATS 1 //always include stats because code change is minimal //#define STATS 1 //always include stats because code change is minimal
//Statistics //Statistics
#ifdef WIN32 // todo: check why STATSONLY fails during compilation #ifdef WIN32 // todo: check why STATSONLY fails during compilation
#undef STATS #undef STATS
#endif #endif
#ifdef STATS #ifdef STATS
#define STATSONLY(x) x #define STATSONLY(x) x
#else #else
#define STATSONLY(x) #define STATSONLY(x)
#endif #endif
#ifdef _DEBUG #ifdef _DEBUG
#define DEBUG 1 #define DEBUG 1
#endif #endif
//DEBUGGING //DEBUGGING
#ifndef WIN32 #ifndef WIN32
#ifdef DEBUG #ifdef DEBUG
#define DBGONLY(x) x #define DBGONLY(x) x
#else #else
#define DBGONLY(x) #define DBGONLY(x)
#endif #endif
#endif #endif
@ -97,7 +97,7 @@ typedef enum priority {LOW_PRIORITY,
#include "ithread.h" #include "ithread.h"
#include <errno.h> #include <errno.h>
#include <sys/timeb.h> #include <sys/timeb.h>
#define EXPORT #define EXPORT
typedef int PolicyType; typedef int PolicyType;
#define DEFAULT_POLICY SCHED_OTHER #define DEFAULT_POLICY SCHED_OTHER
#define DEFAULT_SCHED_PARAM 0 //default priority #define DEFAULT_SCHED_PARAM 0 //default priority
@ -114,27 +114,27 @@ typedef void (*free_routine)(void *arg);
* Name: ThreadPoolAttr * Name: ThreadPoolAttr
* *
* Description: * Description:
* Attributes for thread pool. Used to set and change parameters of * Attributes for thread pool. Used to set and change parameters of
* thread pool * thread pool
*****************************************************************************/ *****************************************************************************/
typedef struct THREADPOOLATTR typedef struct THREADPOOLATTR
{ {
int minThreads; //minThreads, ThreadPool will always maintain at least int minThreads; //minThreads, ThreadPool will always maintain at least
//this many threads //this many threads
int maxThreads; //maxThreads, ThreadPool will never have more than this int maxThreads; //maxThreads, ThreadPool will never have more than this
//number of threads //number of threads
int maxIdleTime; //maxIdleTime (in milliseconds) int maxIdleTime; //maxIdleTime (in milliseconds)
// this is the maximum time a thread will remain idle // this is the maximum time a thread will remain idle
// before dying // before dying
int jobsPerThread; //jobs per thread to maintain int jobsPerThread; //jobs per thread to maintain
int starvationTime; //the time a low priority or med priority int starvationTime; //the time a low priority or med priority
//job waits before getting bumped //job waits before getting bumped
//up a priority (in milliseconds) //up a priority (in milliseconds)
PolicyType schedPolicy; //scheduling policy to use PolicyType schedPolicy; //scheduling policy to use
} ThreadPoolAttr; } ThreadPoolAttr;
@ -152,7 +152,7 @@ typedef struct THREADPOOLJOB
free_routine free_func; //free function free_routine free_func; //free function
struct timeb requestTime; //time of request struct timeb requestTime; //time of request
int priority; //priority of request int priority; //priority of request
int jobId; //id int jobId; //id
} ThreadPoolJob; } ThreadPoolJob;
/**************************************************************************** /****************************************************************************
@ -168,20 +168,20 @@ typedef struct TPOOLSTATS
{ {
double totalTimeHQ; //total time spent by all jobs in high priority Q double totalTimeHQ; //total time spent by all jobs in high priority Q
int totalJobsHQ; //total jobs in HQ run so far int totalJobsHQ; //total jobs in HQ run so far
double avgWaitHQ; //average wait in HQ double avgWaitHQ; //average wait in HQ
double totalTimeMQ; //total time spent by all jobs in med priority Q double totalTimeMQ; //total time spent by all jobs in med priority Q
int totalJobsMQ; //total jobs in MQ run so far int totalJobsMQ; //total jobs in MQ run so far
double avgWaitMQ; //average wait in MQ double avgWaitMQ; //average wait in MQ
double totalTimeLQ; //total time spent by all jobs in low priority Q double totalTimeLQ; //total time spent by all jobs in low priority Q
int totalJobsLQ; //total jobs in LQ run so far int totalJobsLQ; //total jobs in LQ run so far
double avgWaitLQ; //average wait in LQ double avgWaitLQ; //average wait in LQ
double totalWorkTime; //total time spent working for all threads double totalWorkTime; //total time spent working for all threads
double totalIdleTime; //total time spent idle for all threads double totalIdleTime; //total time spent idle for all threads
int workerThreads; //number of current workerThreads int workerThreads; //number of current workerThreads
int idleThreads; //number of current idle threads int idleThreads; //number of current idle threads
int persistentThreads; //number of persistent threads int persistentThreads; //number of persistent threads
int totalThreads; //total number of current threads int totalThreads; //total number of current threads
int maxThreads; //max threads so far int maxThreads; //max threads so far
int currentJobsHQ; // current jobs in Q int currentJobsHQ; // current jobs in Q
int currentJobsLQ; //current jobs in Q int currentJobsLQ; //current jobs in Q
int currentJobsMQ; //current jobs in Q int currentJobsMQ; //current jobs in Q