Navigation


Changeset 1060:13fc3fc9c789 in freeDiameter for tests/testfifo.c


Ignore:
Timestamp:
Apr 29, 2013, 6:15:34 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

New feature in fd_fifo to get timing statistics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/testfifo.c

    r972 r1060  
    217217        {
    218218                struct fifo * queue = NULL;
    219                 int count;
     219                int count, max;
    220220                struct msg * msg  = NULL;
    221221               
     
    224224               
    225225                /* Check the count is 0 */
    226                 CHECK( 0, fd_fifo_length(queue, &count) );
     226                CHECK( 0, fd_fifo_length(queue, &count, &max) );
    227227                CHECK( 0, count);
     228                CHECK( 0, max);
    228229               
    229230                /* Now enqueue */
     
    236237               
    237238                /* Check the count is 3 */
    238                 CHECK( 0, fd_fifo_length(queue, &count) );
     239                CHECK( 0, fd_fifo_length(queue, &count, &max) );
    239240                CHECK( 3, count);
     241                CHECK( 0, max);
    240242               
    241243                /* Retrieve the first message using fd_fifo_get */
    242244                CHECK( 0, fd_fifo_get(queue, &msg) );
    243245                CHECK( msg1, msg);
    244                 CHECK( 0, fd_fifo_length(queue, &count) );
     246                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
    245247                CHECK( 2, count);
    246248               
     
    250252                CHECK( 0, fd_fifo_timedget(queue, &msg, &ts) );
    251253                CHECK( msg2, msg);
    252                 CHECK( 0, fd_fifo_length(queue, &count) );
     254                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
    253255                CHECK( 1, count);
    254256               
     
    256258                CHECK( 0, fd_fifo_tryget(queue, &msg) );
    257259                CHECK( msg3, msg);
    258                 CHECK( 0, fd_fifo_length(queue, &count) );
     260                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
    259261                CHECK( 0, count);
    260262               
    261263                /* Check that another meq_tryget does not block */
    262264                CHECK( EWOULDBLOCK, fd_fifo_tryget(queue, &msg) );
    263                 CHECK( 0, fd_fifo_length(queue, &count) );
     265                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
    264266                CHECK( 0, count);
    265267               
     
    272274                }
    273275                CHECK( ETIMEDOUT, fd_fifo_timedget(queue, &msg, &ts) );
    274                 CHECK( 0, fd_fifo_length(queue, &count) );
     276                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
    275277                CHECK( 0, count);
    276278               
     
    361363               
    362364                /* Check the count of the queue is back to 0 */
    363                 CHECK( 0, fd_fifo_length(queue, &count) );
     365                CHECK( 0, fd_fifo_length(queue, &count, NULL) );
    364366                CHECK( 0, count);
    365367               
Note: See TracChangeset for help on using the changeset viewer.