Lines Matching +full:cpu +full:- +full:cfg

2  * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
26 #include "../util-internal.h"
67 static int cfg_min_share = -1;
70 static int cfg_connlimit_tolerance = -1;
71 static int cfg_grouplimit_tolerance = -1;
72 static int cfg_stddev_tolerance = -1;
93 * - cfg_connlimit_tolerance (--check-connlimit)
94 * - cfg_grouplimit_tolerance (--check-grouplimit)
95 * - cfg_stddev_tolerance (--check-stddev)
137 cs->queued += sizeof(buf); in loud_writecb()
148 cs->received += len; in discard_readcb()
184 --n_echo_conns_open; in echo_eventcb()
201 event_new(base, -1, EV_PERSIST, check_bucket_levels_cb, bev); in echo_listenercb()
282 struct event_config *cfg = NULL; in timer_bias_calculate() local
288 cfg = event_config_new(); in timer_bias_calculate()
289 if (!cfg) in timer_bias_calculate()
291 if (event_config_set_flag(cfg, EVENT_BASE_FLAG_PRECISE_TIMER)) in timer_bias_calculate()
293 base = event_base_new_with_config(cfg); in timer_bias_calculate()
297 timer = event_new(base, -1, EV_PERSIST, timer_bias_cb, event_self_cbarg()); in timer_bias_calculate()
307 if (cfg) in timer_bias_calculate()
308 event_config_free(cfg); in timer_bias_calculate()
317 fprintf(stderr, "Couldn't create event for CPU cycle counter bias\n"); in timer_bias_calculate()
318 return -1; in timer_bias_calculate()
338 double expected_total_persec = -1.0, expected_avg_persec = -1.0; in test_ratelimiting()
355 fprintf(stderr, "CPU is slow, timers bias is %f\n", timer_bias); in test_ratelimiting()
360 printf("CPU is fast enough, timers bias is %f\n", timer_bias); in test_ratelimiting()
382 LEV_OPT_CLOSE_ON_FREE|LEV_OPT_REUSEABLE, -1, in test_ratelimiting()
411 expected_total_persec = cfg_grouplimit - (cfg_group_drain / seconds_per_tick); in test_ratelimiting()
432 bevs[i] = bufferevent_socket_new(base, -1, in test_ratelimiting()
442 tv.tv_sec = cfg_duration - 1; in test_ratelimiting()
451 periodic_level_check = event_new(base, -1, EV_PERSIST, check_group_bucket_levels_cb, NULL); in test_ratelimiting()
455 group_drain_event = event_new(base, -1, EV_PERSIST, group_drain_cb, NULL); in test_ratelimiting()
495 printf("Average max-to-read: %f\n", in test_ratelimiting()
497 printf("Average max-to-write: %f\n", in test_ratelimiting()
521 double diff = expected_total_persec - in test_ratelimiting()
534 double diff = expected_avg_persec - (((double)total_received)/cfg_duration)/cfg_n_connections; in test_ratelimiting()
543 …variance = total_sq_persec/cfg_n_connections - total_persec*total_persec/(cfg_n_connections*cfg_n_… in test_ratelimiting()
562 { "-v", &cfg_verbose, 0, 1 },
563 { "-h", &cfg_help, 0, 1 },
564 { "-n", &cfg_n_connections, 1, 0 },
565 { "-d", &cfg_duration, 1, 0 },
566 { "-c", &cfg_connlimit, 0, 0 },
567 { "-g", &cfg_grouplimit, 0, 0 },
568 { "-G", &cfg_group_drain, -100000, 0 },
569 { "-t", &cfg_tick_msec, 10, 0 },
570 { "--min-share", &cfg_min_share, 0, 0 },
571 { "--check-connlimit", &cfg_connlimit_tolerance, 0, 0 },
572 { "--check-grouplimit", &cfg_grouplimit_tolerance, 0, 0 },
573 { "--check-stddev", &cfg_stddev_tolerance, 0, 0 },
575 { "--iocp", &cfg_enable_iocp, 0, 1 },
577 { NULL, NULL, -1, 0 },
585 if (opt->isbool) { in handle_option()
586 *opt->ptr = 1; in handle_option()
591 return -1; in handle_option()
597 return -1; in handle_option()
599 if (val < opt->min || val > 0x7fffffff) { in handle_option()
600 fprintf(stderr, "Value '%s' is out-of-range'\n", in handle_option()
602 return -1; in handle_option()
604 *opt->ptr = (int)val; in handle_option()
613 "test-ratelim [-v] [-n INT] [-d INT] [-c INT] [-g INT] [-t INT]\n\n" in usage()
614 "Pushes bytes through a number of possibly rate-limited connections, and\n" in usage()
616 " -n INT: Number of connections to open (default: 30)\n" in usage()
617 " -d INT: Duration of the test in seconds (default: 5 sec)\n"); in usage()
619 " -c INT: Connection-rate limit applied to each connection in bytes per second\n" in usage()
621 " -g INT: Group-rate limit applied to sum of all usage in bytes per second\n" in usage()
623 " -G INT: drain INT bytes from the group limit every tick. (default: 0)\n" in usage()
624 " -t INT: Granularity of timing, in milliseconds (default: 1000 msec)\n"); in usage()