aboutsummaryrefslogtreecommitdiff
path: root/src/examples/mhd2spdy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/mhd2spdy.c')
-rw-r--r--src/examples/mhd2spdy.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/examples/mhd2spdy.c b/src/examples/mhd2spdy.c
index a642d936..01a8c7a3 100644
--- a/src/examples/mhd2spdy.c
+++ b/src/examples/mhd2spdy.c
@@ -45,6 +45,22 @@ catch_signal(int signal)
45} 45}
46 46
47 47
48void
49print_stat()
50{
51 if(!glob_opt.statistics)
52 return;
53
54 printf("--------------------------\n");
55 printf("Statistics (TLS overhead is ignored when used):\n");
56 //printf("HTTP bytes received: %lld\n", glob_stat.http_bytes_received);
57 //printf("HTTP bytes sent: %lld\n", glob_stat.http_bytes_sent);
58 printf("SPDY bytes sent: %lld\n", glob_stat.spdy_bytes_sent);
59 printf("SPDY bytes received: %lld\n", glob_stat.spdy_bytes_received);
60 printf("SPDY bytes received and dropped: %lld\n", glob_stat.spdy_bytes_received_and_dropped);
61}
62
63
48int 64int
49run_everything () 65run_everything ()
50{ 66{
@@ -201,6 +217,8 @@ run_everything ()
201 217
202 PRINT_INFO2("spdy streams: %i; http requests: %i", glob_opt.streams_opened, glob_opt.responses_pending); 218 PRINT_INFO2("spdy streams: %i; http requests: %i", glob_opt.streams_opened, glob_opt.responses_pending);
203 PRINT_INFO2("memory allocated %zu bytes", glob_opt.global_memory); 219 PRINT_INFO2("memory allocated %zu bytes", glob_opt.global_memory);
220
221 print_stat();
204 222
205 return 0; 223 return 0;
206} 224}
@@ -210,7 +228,7 @@ void
210display_usage() 228display_usage()
211{ 229{
212 printf( 230 printf(
213 "Usage: http2spdy [-vo] [-b <SPDY2HTTP-PROXY>] -p <PORT>\n" 231 "Usage: mhd2spdy [-vos] [-b <SPDY2HTTP-PROXY>] -p <PORT>\n"
214 "TODO\n" 232 "TODO\n"
215 ); 233 );
216} 234}
@@ -227,12 +245,13 @@ main (int argc,
227 {"backend-proxy", required_argument, 0, 'b'}, 245 {"backend-proxy", required_argument, 0, 'b'},
228 {"verbose", no_argument, 0, 'v'}, 246 {"verbose", no_argument, 0, 'v'},
229 {"only-proxy", no_argument, 0, 'o'}, 247 {"only-proxy", no_argument, 0, 'o'},
248 {"statistics", no_argument, 0, 's'},
230 {0, 0, 0, 0} 249 {0, 0, 0, 0}
231 }; 250 };
232 251
233 while (1) 252 while (1)
234 { 253 {
235 getopt_ret = getopt_long( argc, argv, "p:b:vo", long_options, &option_index); 254 getopt_ret = getopt_long( argc, argv, "p:b:vos", long_options, &option_index);
236 if (getopt_ret == -1) 255 if (getopt_ret == -1)
237 break; 256 break;
238 257
@@ -256,6 +275,10 @@ main (int argc,
256 glob_opt.only_proxy = true; 275 glob_opt.only_proxy = true;
257 break; 276 break;
258 277
278 case 's':
279 glob_opt.statistics = true;
280 break;
281
259 case 0: 282 case 0:
260 PRINT_INFO("0 from getopt"); 283 PRINT_INFO("0 from getopt");
261 break; 284 break;