28 #define RANDOM_BUFSIZE 4096
34 #define NO_PROCESSES 50
39 static const short int cpuAttrList[] = {
79 #define NO_CPU_ATTRS ( sizeof( cpuAttrList ) / sizeof( short int ) )
84 static const short int procAttrList[] = {
131 #define NO_PROC_ATTRS ( sizeof( procAttrList ) / sizeof( short int ) )
135 static int getProcessList(
const short int cpuNo,
short int *pidBuffer,
136 const short int pidBufSize )
138 const static short int retAttrList[] = { 38 };
139 const static short int srchAttrList[] = { 9 };
140 const static short int srchValList[] = { 0 };
141 short int error, pin = 0, noAttrs;
148 error = PROCESS_GETINFOLIST_( cpuNo
153 ,(
short int * ) retAttrList
161 ,(
short int * ) srchAttrList
164 ,(
short int * ) srchValList
168 return( ( error == 0 || error == 7 ) ? noAttrs : 0 );
177 long long totalTime, busyTime, intTime, idleTime;
179 short int value, error;
192 if( _status_eq( cc ) )
194 addRandomData( randomState, &totalTime,
sizeof(
long long ) );
195 addRandomData( randomState, &busyTime,
sizeof(
long long ) );
196 addRandomData( randomState, &intTime,
sizeof(
long long ) );
197 addRandomData( randomState, &idleTime,
sizeof(
long long ) );
202 error = MESSAGESYSTEMINFO( 4
210 error = MESSAGESYSTEMINFO( 5
220 totalTime = MYPROCESSTIME();
221 addRandomData( randomState, &totalTime,
sizeof(
long long ) );
225 printf(
"fastPoll: quality = %d.\n", quality );
227 endRandomData( randomState, quality );
237 const long cpuStatus = PROCESSORSTATUS() & 0xFFFFUL;
247 for( cpuStatusMask = 0x8000, cpuNo = 0; \
249 cpuStatusMask >>= 1, cpuNo++ )
252 short int noAttrs, error;
256 if( !( cpuStatusMask & cpuStatus ) )
260 printf(
"Getting info for CPU #%d.\n", cpuNo );
263 error = PROCESSOR_GETINFOLIST_(
266 ,(
short int * ) cpuAttrList
269 ,(
short int * ) buffer
278 printf(
"PROCESSOR_GETINFOLIST returned %d attributes.\n",
281 addRandomData( randomState, buffer,
282 noAttrs *
sizeof(
short int ) );
283 attrCount += noAttrs / 2;
288 noProcesses = getProcessList( cpuNo, pidBuffer,
NO_PROCESSES );
289 if( noProcesses <= 0 )
298 for( i = 0; i < noProcesses; i++ )
300 short int pin = pidBuffer[ i ];
302 error = PROCESS_GETINFOLIST_( cpuNo
307 ,(
short int * ) procAttrList
310 ,(
short int * ) buffer
319 printf(
"PROCESS_GETINFOLIST returned %d attributes for "
320 "process %d.\n", noAttrs, pin );
322 addRandomData( randomState, buffer,
323 noAttrs *
sizeof(
short int ) );
324 attrCount +=
max( noAttrs / 5, 10 );
330 endRandomData( randomState,
min( attrCount, 100 ) );