Changeset 1071:6ca6cadf209c in freeDiameter for libfdproto
- Timestamp:
- May 2, 2013, 12:22:31 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/fifo.c
r1067 r1071 284 284 } 285 285 286 /* Get the length of the queue */ 287 int fd_fifo_length ( struct fifo * queue, int * length, int * max ) 288 { 289 TRACE_ENTRY( "%p %p %p", queue, length, max ); 286 /* Get the information on the queue */ 287 int fd_fifo_getstats( struct fifo * queue, int * current_count, int * limit_count, int * highest_count, long long * total_count, 288 struct timespec * total, struct timespec * blocking, struct timespec * last) 289 { 290 TRACE_ENTRY( "%p %p %p %p %p %p %p %p", queue, current_count, limit_count, highest_count, total_count, total, blocking, last); 290 291 291 292 /* Check the parameters */ 292 CHECK_PARAMS( CHECK_FIFO( queue ) && length);293 CHECK_PARAMS( CHECK_FIFO( queue ) ); 293 294 294 295 /* lock the queue */ 295 296 CHECK_POSIX( pthread_mutex_lock( &queue->mtx ) ); 296 297 297 /* Retrieve the count */ 298 *length = queue->count; 299 300 if (max) 301 *max = queue->max; 298 if (current_count) 299 *current_count = queue->count; 300 301 if (limit_count) 302 *limit_count = queue->max; 303 304 if (highest_count) 305 *highest_count = queue->highest_ever; 306 307 if (total_count) 308 *total_count = queue->total_items; 309 310 if (total) 311 memcpy(total, &queue->total_time, sizeof(struct timespec)); 312 313 if (blocking) 314 memcpy(blocking, &queue->blocking_time, sizeof(struct timespec)); 315 316 if (last) 317 memcpy(last, &queue->last_time, sizeof(struct timespec)); 302 318 303 319 /* Unlock */ … … 308 324 } 309 325 310 /* Get the timings */311 int fd_fifo_getstats( struct fifo * queue, long long *items, struct timespec * total, struct timespec * blocking, struct timespec * last)312 {313 TRACE_ENTRY( "%p %p %p %p %p", queue, items, total, blocking, last);314 315 /* Check the parameters */316 CHECK_PARAMS( CHECK_FIFO( queue ) );317 318 /* lock the queue */319 CHECK_POSIX( pthread_mutex_lock( &queue->mtx ) );320 321 if (items)322 *items = queue->total_items;323 324 if (total)325 memcpy(total, &queue->total_time, sizeof(struct timespec));326 327 if (blocking)328 memcpy(blocking, &queue->blocking_time, sizeof(struct timespec));329 330 if (last)331 memcpy(last, &queue->last_time, sizeof(struct timespec));332 333 /* Unlock */334 CHECK_POSIX( pthread_mutex_unlock( &queue->mtx ) );335 336 /* Done */337 return 0;338 }339 340 326 341 327 /* alternate version with no error checking */ 342 int fd_fifo_length _noerr( struct fifo * queue )328 int fd_fifo_length ( struct fifo * queue ) 343 329 { 344 330 if ( !CHECK_FIFO( queue ) )
Note: See TracChangeset
for help on using the changeset viewer.