Navigation


Changeset 575:66f188b3ca84 in freeDiameter


Ignore:
Timestamp:
Oct 8, 2010, 4:02:48 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Configurable parameters for the benchmark mode

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • doc/test_app.conf.sample

    r572 r575  
    4242#  - server is silent on message reception, only the activity summary is displayed every 30 seconds
    4343#  - client attempts to send as many messages as possible during 10 seconds and counts them.
    44 # benchmark;
     44# The benchmark keyword can be followed optionaly by two integers:
     45#   duration is the time for the measurement, in seconds (default 10).
     46#   concurrency is the number of messages that can be on the wire before waiting for an answer (default 100).
     47# benchmark [duration concurrency];
     48
    4549
    4650#######################
  • extensions/test_app/ta_bench.c

    r572 r575  
    3939
    4040#include <semaphore.h>
    41 
    42 /* The number of messages that can be sent before waiting for a corresponding answer */
    43 #define NB_CONCURRENT_MESSAGES  100
    44 
    4541#include <stdio.h>
    4642
     
    5046};
    5147
    52 static sem_t ta_sem;
     48static sem_t ta_sem; /* To handle the concurrency */
    5349
    5450/* Cb called when an answer is received */
     
    221217        CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), );
    222218       
    223         /* We will run for 10 seconds */
     219        /* We will run for ta_conf->bench_duration seconds */
    224220        CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &end_time), );
    225         end_time.tv_sec += 10;
     221        end_time.tv_sec += ta_conf->bench_duration;
    226222       
    227223        /* Now loop until timeout is reached */
     
    254250        if (now.tv_nsec >= end_time.tv_nsec) {
    255251                fd_log_debug( " Executing for: %d.%06ld sec\n",
    256                                 (int)(now.tv_sec + 10 - end_time.tv_sec),
     252                                (int)(now.tv_sec + ta_conf->bench_duration - end_time.tv_sec),
    257253                                (long)(now.tv_nsec - end_time.tv_nsec) / 1000);
    258254        } else {
    259255                fd_log_debug( " Executing for: %d.%06ld sec\n",
    260                                 (int)(now.tv_sec + 9 - end_time.tv_sec),
     256                                (int)(now.tv_sec + ta_conf->bench_duration - 1 - end_time.tv_sec),
    261257                                (long)(now.tv_nsec + 1000000000 - end_time.tv_nsec) / 1000);
    262258        }
    263259        fd_log_debug( "   %llu messages sent\n", end.nb_sent - start.nb_sent);
    264         fd_log_debug( "   %llu errors received\n", end.nb_errs - start.nb_errs);
    265         fd_log_debug( "   %llu answers received\n", end.nb_recv - start.nb_recv);
     260        fd_log_debug( "   %llu error(s) received\n", end.nb_errs - start.nb_errs);
     261        fd_log_debug( "   %llu answer(s) received\n", end.nb_recv - start.nb_recv);
    266262        fd_log_debug( "   Overall:\n");
    267263        fd_log_debug( "     fastest: %ld.%06ld sec.\n", end.shortest / 1000000, end.shortest % 1000000);
    268264        fd_log_debug( "     slowest: %ld.%06ld sec.\n", end.longest / 1000000, end.longest % 1000000);
    269265        fd_log_debug( "     Average: %ld.%06ld sec.\n", end.avg / 1000000, end.avg % 1000000);
    270         fd_log_debug( "   Throughput: %llu message / sec\n", (end.nb_recv - start.nb_recv) / (( now.tv_sec + 10 - end_time.tv_sec ) + ((now.tv_nsec - end_time.tv_nsec) / 1000000000)));
    271        
    272 
     266        fd_log_debug( "   Throughput: %llu messages / sec\n", (end.nb_recv - start.nb_recv) / (( now.tv_sec + ta_conf->bench_duration - end_time.tv_sec ) + ((now.tv_nsec - end_time.tv_nsec) / 1000000000)));
    273267        fd_log_debug( "-------------------------------------\n");
    274268
     
    278272int ta_bench_init(void)
    279273{
    280         CHECK_SYS( sem_init( &ta_sem, 0, NB_CONCURRENT_MESSAGES) );
     274        CHECK_SYS( sem_init( &ta_sem, 0, ta_conf->bench_concur) );
    281275
    282276        CHECK_FCT( fd_sig_register(ta_conf->signal, "test_app.bench", ta_bench_start ) );
  • extensions/test_app/ta_conf.y

    r572 r575  
    188188                                ta_conf->mode |= MODE_BENCH;
    189189                        }
     190                        | BENCH INTEGER INTEGER ';'
     191                        {
     192                                ta_conf->mode |= MODE_BENCH;
     193                                ta_conf->bench_duration = $2;
     194                                ta_conf->bench_concur   = $3;
     195                        }
    190196                        ;
    191197
  • extensions/test_app/ta_serv.c

    r572 r575  
    101101        CHECK_FCT( fd_msg_send( msg, NULL, NULL ) );
    102102       
     103        /* Add this value to the stats */
     104        CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), );
     105        ta_conf->stats.nb_echoed++;
     106        CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), );
     107       
    103108        return 0;
    104109}
  • extensions/test_app/test_app.c

    r572 r575  
    5959        ta_conf->dest_host  = NULL;
    6060        ta_conf->signal     = TEST_APP_DEFAULT_SIGNAL;
     61        ta_conf->bench_concur   = 100;
     62        ta_conf->bench_duration = 10;
    6163       
    6264        /* Initialize the mutex */
     
    8284}
    8385
    84 /* Function to display statistics every 10 seconds */
     86/* Function to display statistics periodically */
    8587static void * ta_stats(void * arg) {
    8688
     
    9395        /* Now, loop until canceled */
    9496        while (1) {
    95                 /* Display statistics every 30 seconds */
    96                 sleep(30);
     97                /* Display statistics every XX seconds */
     98                sleep(ta_conf->bench_duration * 3);
    9799               
    98100                /* Now, get the current stats */
     
    117119               
    118120                if (ta_conf->mode & MODE_SERV) {
    119                         fd_log_debug( " Server: %llu messages echoed\n", copy.nb_echoed);
     121                        fd_log_debug( " Server: %llu message(s) echoed\n", copy.nb_echoed);
    120122                }
    121123                if (ta_conf->mode & MODE_CLI) {
    122124                        fd_log_debug( " Client:\n");
    123                         fd_log_debug( "   %llu messages sent\n", copy.nb_sent);
    124                         fd_log_debug( "   %llu errors received\n", copy.nb_errs);
    125                         fd_log_debug( "   %llu answers received\n", copy.nb_recv);
     125                        fd_log_debug( "   %llu message(s) sent\n", copy.nb_sent);
     126                        fd_log_debug( "   %llu error(s) received\n", copy.nb_errs);
     127                        fd_log_debug( "   %llu answer(s) received\n", copy.nb_recv);
    126128                        fd_log_debug( "     fastest: %ld.%06ld sec.\n", copy.shortest / 1000000, copy.shortest % 1000000);
    127129                        fd_log_debug( "     slowest: %ld.%06ld sec.\n", copy.longest / 1000000, copy.longest % 1000000);
  • extensions/test_app/test_app.h

    r572 r575  
    6565        char    *       user_name;      /* default NULL */
    6666        int             signal;         /* default TEST_APP_DEFAULT_SIGNAL */
     67        int             bench_concur;   /* default 100 */
     68        int             bench_duration; /* default 10 */
    6769        struct ta_stats {
    6870                unsigned long long      nb_echoed; /* server */
Note: See TracChangeset for help on using the changeset viewer.