statistics cumulative option.

git-svn-id: file:///svn/unbound/trunk@1024 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-04-09 12:29:53 +00:00
parent 46e703c989
commit 7eeb7cc78c
11 changed files with 771 additions and 707 deletions

View file

@ -883,8 +883,10 @@ void worker_stat_timer_cb(void* arg)
server_stats_log(&worker->stats, worker->thread_num);
mesh_stats(worker->env.mesh, "mesh has");
worker_mem_report(worker, NULL);
server_stats_init(&worker->stats);
mesh_stats_clear(worker->env.mesh);
if(!worker->daemon->cfg->stat_cumulative) {
server_stats_init(&worker->stats);
mesh_stats_clear(worker->env.mesh);
}
/* start next timer */
worker_restart_timer(worker);
}

View file

@ -3,6 +3,7 @@
--with-libevent=/home/wouter/libev-3.2
libev-3.2 is a little faster than libevent-1.4.3-stable (about 5%).
- unused commpoints not listed in epoll list.
- statistics-cumulative option so that the values are not reset.
8 April 2008: Wouter
- unbound tries to set the ulimit fds when started as server.

View file

@ -18,6 +18,9 @@ server:
# print statistics to the log (for every thread) every N seconds.
# Set to "" or 0 to disable. Default is disabled.
# statistics-interval: 0
# enable cumulative statistics, without clearing them after printing.
# statistics-cumulative: no
# number of threads to create. 1 disables threading.
# num-threads: 1

View file

@ -88,6 +88,10 @@ see
The number of seconds between printing statistics to the log for every thread.
Disable with value 0 or "". Default is disabled.
.TP
.B statistics-cumulative: \fI<yes or no>
If enabled, statistics are cumulative since starting unbound, without clearing
the statistics counters after logging the statistics. Default is no.
.TP
.B num\-threads: \fI<number>
The number of threads to create to serve clients. Use 1 for no threading.
.TP

View file

@ -71,6 +71,7 @@ config_create()
/* the defaults if no config is present */
cfg->verbosity = 1;
cfg->stat_interval = 0;
cfg->stat_cumulative = 0;
cfg->num_threads = 1;
cfg->port = UNBOUND_DNS_PORT;
cfg->do_ip4 = 1;

View file

@ -52,8 +52,11 @@ struct config_str2list;
struct config_file {
/** verbosity level as specified in the config file */
int verbosity;
/** statistics interval (in seconds) */
int stat_interval;
/** if false, statistics values are reset after printing them */
int stat_cumulative;
/** number of threads to create */
int num_threads;

File diff suppressed because it is too large Load diff

View file

@ -168,6 +168,7 @@ use-syslog{COLON} { YDOUT; return VAR_USE_SYSLOG;}
local-zone{COLON} { YDOUT; return VAR_LOCAL_ZONE;}
local-data{COLON} { YDOUT; return VAR_LOCAL_DATA;}
statistics-interval{COLON} { YDOUT; return VAR_STATISTICS_INTERVAL;}
statistics-cumulative{COLON} { YDOUT; return VAR_STATISTICS_CUMULATIVE;}
{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
/* Quoted strings. Strip leading and ending quotes */

File diff suppressed because it is too large Load diff

View file

@ -115,7 +115,8 @@
VAR_INTERFACE_AUTOMATIC = 331,
VAR_STATISTICS_INTERVAL = 332,
VAR_DO_DAEMONIZE = 333,
VAR_USE_CAPS_FOR_ID = 334
VAR_USE_CAPS_FOR_ID = 334,
VAR_STATISTICS_CUMULATIVE = 335
};
#endif
/* Tokens. */
@ -196,6 +197,7 @@
#define VAR_STATISTICS_INTERVAL 332
#define VAR_DO_DAEMONIZE 333
#define VAR_USE_CAPS_FOR_ID 334
#define VAR_STATISTICS_CUMULATIVE 335
@ -207,7 +209,7 @@ typedef union YYSTYPE
char* str;
}
/* Line 1489 of yacc.c. */
#line 211 "util/configparser.h"
#line 213 "util/configparser.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1

View file

@ -89,6 +89,7 @@ extern struct config_parser_state* cfg_parser;
%token VAR_CACHE_MAX_TTL VAR_HARDEN_DNNSEC_STRIPPED VAR_ACCESS_CONTROL
%token VAR_LOCAL_ZONE VAR_LOCAL_DATA VAR_INTERFACE_AUTOMATIC
%token VAR_STATISTICS_INTERVAL VAR_DO_DAEMONIZE VAR_USE_CAPS_FOR_ID
%token VAR_STATISTICS_CUMULATIVE
%%
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
@ -129,7 +130,7 @@ content_server: server_num_threads | server_verbosity | server_port |
server_harden_dnssec_stripped | server_access_control |
server_local_zone | server_local_data | server_interface_automatic |
server_statistics_interval | server_do_daemonize |
server_use_caps_for_id
server_use_caps_for_id | server_statistics_cumulative
;
stubstart: VAR_STUB_ZONE
{
@ -192,6 +193,15 @@ server_statistics_interval: VAR_STATISTICS_INTERVAL STRING
free($2);
}
;
server_statistics_cumulative: VAR_STATISTICS_CUMULATIVE STRING
{
OUTYY(("P(server_statistics_cumulative:%s)\n", $2));
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
yyerror("expected yes or no.");
else cfg_parser->cfg->stat_cumulative = (strcmp($2, "yes")==0);
free($2);
}
;
server_port: VAR_PORT STRING
{
OUTYY(("P(server_port:%s)\n", $2));