Changeset 575:66f188b3ca84 in freeDiameter
- Timestamp:
- Oct 8, 2010, 4:02:48 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/test_app.conf.sample
r572 r575 42 42 # - server is silent on message reception, only the activity summary is displayed every 30 seconds 43 43 # - 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 45 49 46 50 ####################### -
extensions/test_app/ta_bench.c
r572 r575 39 39 40 40 #include <semaphore.h> 41 42 /* The number of messages that can be sent before waiting for a corresponding answer */43 #define NB_CONCURRENT_MESSAGES 10044 45 41 #include <stdio.h> 46 42 … … 50 46 }; 51 47 52 static sem_t ta_sem; 48 static sem_t ta_sem; /* To handle the concurrency */ 53 49 54 50 /* Cb called when an answer is received */ … … 221 217 CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), ); 222 218 223 /* We will run for 10seconds */219 /* We will run for ta_conf->bench_duration seconds */ 224 220 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &end_time), ); 225 end_time.tv_sec += 10;221 end_time.tv_sec += ta_conf->bench_duration; 226 222 227 223 /* Now loop until timeout is reached */ … … 254 250 if (now.tv_nsec >= end_time.tv_nsec) { 255 251 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), 257 253 (long)(now.tv_nsec - end_time.tv_nsec) / 1000); 258 254 } else { 259 255 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), 261 257 (long)(now.tv_nsec + 1000000000 - end_time.tv_nsec) / 1000); 262 258 } 263 259 fd_log_debug( " %llu messages sent\n", end.nb_sent - start.nb_sent); 264 fd_log_debug( " %llu error sreceived\n", end.nb_errs - start.nb_errs);265 fd_log_debug( " %llu answer sreceived\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); 266 262 fd_log_debug( " Overall:\n"); 267 263 fd_log_debug( " fastest: %ld.%06ld sec.\n", end.shortest / 1000000, end.shortest % 1000000); 268 264 fd_log_debug( " slowest: %ld.%06ld sec.\n", end.longest / 1000000, end.longest % 1000000); 269 265 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))); 273 267 fd_log_debug( "-------------------------------------\n"); 274 268 … … 278 272 int ta_bench_init(void) 279 273 { 280 CHECK_SYS( sem_init( &ta_sem, 0, NB_CONCURRENT_MESSAGES) );274 CHECK_SYS( sem_init( &ta_sem, 0, ta_conf->bench_concur) ); 281 275 282 276 CHECK_FCT( fd_sig_register(ta_conf->signal, "test_app.bench", ta_bench_start ) ); -
extensions/test_app/ta_conf.y
r572 r575 188 188 ta_conf->mode |= MODE_BENCH; 189 189 } 190 | BENCH INTEGER INTEGER ';' 191 { 192 ta_conf->mode |= MODE_BENCH; 193 ta_conf->bench_duration = $2; 194 ta_conf->bench_concur = $3; 195 } 190 196 ; 191 197 -
extensions/test_app/ta_serv.c
r572 r575 101 101 CHECK_FCT( fd_msg_send( msg, NULL, NULL ) ); 102 102 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 103 108 return 0; 104 109 } -
extensions/test_app/test_app.c
r572 r575 59 59 ta_conf->dest_host = NULL; 60 60 ta_conf->signal = TEST_APP_DEFAULT_SIGNAL; 61 ta_conf->bench_concur = 100; 62 ta_conf->bench_duration = 10; 61 63 62 64 /* Initialize the mutex */ … … 82 84 } 83 85 84 /* Function to display statistics every 10 seconds*/86 /* Function to display statistics periodically */ 85 87 static void * ta_stats(void * arg) { 86 88 … … 93 95 /* Now, loop until canceled */ 94 96 while (1) { 95 /* Display statistics every 30seconds */96 sleep( 30);97 /* Display statistics every XX seconds */ 98 sleep(ta_conf->bench_duration * 3); 97 99 98 100 /* Now, get the current stats */ … … 117 119 118 120 if (ta_conf->mode & MODE_SERV) { 119 fd_log_debug( " Server: %llu message sechoed\n", copy.nb_echoed);121 fd_log_debug( " Server: %llu message(s) echoed\n", copy.nb_echoed); 120 122 } 121 123 if (ta_conf->mode & MODE_CLI) { 122 124 fd_log_debug( " Client:\n"); 123 fd_log_debug( " %llu message ssent\n", copy.nb_sent);124 fd_log_debug( " %llu error sreceived\n", copy.nb_errs);125 fd_log_debug( " %llu answer sreceived\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); 126 128 fd_log_debug( " fastest: %ld.%06ld sec.\n", copy.shortest / 1000000, copy.shortest % 1000000); 127 129 fd_log_debug( " slowest: %ld.%06ld sec.\n", copy.longest / 1000000, copy.longest % 1000000); -
extensions/test_app/test_app.h
r572 r575 65 65 char * user_name; /* default NULL */ 66 66 int signal; /* default TEST_APP_DEFAULT_SIGNAL */ 67 int bench_concur; /* default 100 */ 68 int bench_duration; /* default 10 */ 67 69 struct ta_stats { 68 70 unsigned long long nb_echoed; /* server */
Note: See TracChangeset
for help on using the changeset viewer.