Changeset 1067:23989d6c8390 in freeDiameter
- Timestamp:
- Apr 30, 2013, 10:51:09 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
include/freeDiameter/libfdcore.h
r1063 r1067 1026 1026 * max : (out) The max number of items the queue accepts before becoming blocking -- 0 means no max. 1027 1027 * highest_count : (out) The highest count the queue has reached since startup 1028 * total_count : (out) Total number of items that this queue has processed (always growing, use deltas for monitoring) 1028 1029 * total : (out) Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring) 1029 1030 * blocking : (out) Cumulated time threads trying to post new items were blocked (queue full). … … 1039 1040 */ 1040 1041 int fd_stat_getstats(enum fd_stat_type stat, struct peer_hdr * peer, 1041 int * len, int * max, int * highest_count, 1042 int * len, int * max, int * highest_count, long long * total_count, 1042 1043 struct timespec * total, struct timespec * blocking, struct timespec * last); 1043 1044 -
include/freeDiameter/libfdproto.h
r1060 r1067 3054 3054 * PARAMETERS: 3055 3055 * queue : The queue from which to retrieve the timings information. 3056 * items : the total number of items that went through the queue (already pop'd). Always increasing. 3056 3057 * total : Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring) 3057 3058 * blocking : Cumulated time threads trying to post new items were blocked (queue full). … … 3065 3066 * EINVAL : A parameter is invalid. 3066 3067 */ 3067 int fd_fifo_getstats( struct fifo * queue, struct timespec * total, struct timespec * blocking, struct timespec * last);3068 int fd_fifo_getstats( struct fifo * queue, long long *items, struct timespec * total, struct timespec * blocking, struct timespec * last); 3068 3069 3069 3070 -
libfdproto/fifo.c
r1060 r1067 71 71 int highest_ever; /* The max count value this queue has reached (for tweaking) */ 72 72 73 long long total_items; /* Cumulated number of items that went through this fifo (excluding current count), always increasing. */ 73 74 struct timespec total_time; /* Cumulated time all items spent in this queue, including blocking time (always growing, use deltas for monitoring) */ 74 75 struct timespec blocking_time; /* Cumulated time threads trying to post new items were blocked (queue full). */ … … 140 141 queue->h_cb, queue->l_cb, queue->data, 141 142 queue->highest_ever); 142 fd_log_debug(" timings: total:%ld.%06ld, blocking:%ld.%06ld, last:%ld.%06ld", 143 (long)queue->total_time.tv_sec,(long)(queue->total_time.tv_nsec/1000), 143 fd_log_debug(" stats: total:%lld in %ld.%06ld, blocking:%ld.%06ld, last:%ld.%06ld", 144 queue->total_items, 145 (long)queue->total_time.tv_sec,(long)(queue->total_time.tv_nsec/1000), 144 146 (long)queue->blocking_time.tv_sec,(long)(queue->blocking_time.tv_nsec/1000), 145 147 (long)queue->last_time.tv_sec,(long)(queue->last_time.tv_nsec/1000) ); … … 259 261 old->eyec = FIFO_EYEC; 260 262 263 /* Merge the stats in the new queue */ 264 new->total_items += old->total_items; 265 old->total_items = 0; 266 267 new->total_time.tv_nsec += old->total_time.tv_nsec; 268 new->total_time.tv_sec += old->total_time.tv_sec + (new->total_time.tv_nsec / 1000000000); 269 new->total_time.tv_nsec %= 1000000000; 270 old->total_time.tv_nsec = 0; 271 old->total_time.tv_sec = 0; 272 273 new->blocking_time.tv_nsec += old->blocking_time.tv_nsec; 274 new->blocking_time.tv_sec += old->blocking_time.tv_sec + (new->blocking_time.tv_nsec / 1000000000); 275 new->blocking_time.tv_nsec %= 1000000000; 276 old->blocking_time.tv_nsec = 0; 277 old->blocking_time.tv_sec = 0; 278 261 279 /* Unlock, we're done */ 262 280 CHECK_POSIX( pthread_mutex_unlock( &new->mtx ) ); … … 291 309 292 310 /* Get the timings */ 293 int fd_fifo_getstats( struct fifo * queue, struct timespec * total, struct timespec * blocking, struct timespec * last)294 { 295 TRACE_ENTRY( "%p %p %p %p ", queue, total, blocking, last);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); 296 314 297 315 /* Check the parameters */ … … 300 318 /* lock the queue */ 301 319 CHECK_POSIX( pthread_mutex_lock( &queue->mtx ) ); 320 321 if (items) 322 *items = queue->total_items; 302 323 303 324 if (total) … … 467 488 fd_list_unlink(&fi->item); 468 489 queue->count--; 490 queue->total_items++; 469 491 ret = fi->item.o; 470 492
Note: See TracChangeset
for help on using the changeset viewer.