Commit d29da750 authored by Brian Wellington's avatar Brian Wellington
Browse files

statistics counting was slowing down the server. Make client.c:count_query()

inline and remove dns_stats_ncounters(), which just returned the public
constant DNS_STATS_NCOUNTERS.
parent 7817a6f4
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.175 2001/01/22 19:21:19 gson Exp $ */
/* $Id: query.c,v 1.176 2001/01/23 01:50:25 bwelling Exp $ */
#include <config.h>
......@@ -141,10 +141,11 @@ synth_rev_respond(ns_client_t *client, dns_byaddrevent_t *bevent);
/*
* Increment query statistics counters.
*/
static void
count_query(dns_zone_t *zone, isc_boolean_t is_zone, dns_statscounter_t counter)
static inline void
count_query(dns_zone_t *zone, isc_boolean_t is_zone,
dns_statscounter_t counter)
{
REQUIRE(counter < dns_stats_ncounters());
REQUIRE(counter < DNS_STATS_NCOUNTERS);
ns_g_server->querystats[counter]++;
......@@ -2387,8 +2388,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
}
fname = query_newname(client, dbuf, &b);
if (fname == NULL) {
count_query(zone, is_zone,
dns_statscounter_failure);
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
......@@ -2518,7 +2518,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
result = dns_name_copy(client->query.qname,
fname, NULL);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone, dns_statscounter_failure);
count_query(zone, is_zone,
dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
......@@ -2704,7 +2705,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
NS_QUERYATTR_RECURSING;
else {
count_query(zone, is_zone,
dns_statscounter_failure);
dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
}
} else {
......@@ -2758,8 +2759,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
*/
result = query_addsoa(client, db, ISC_FALSE);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone,
dns_statscounter_failure);
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(result);
goto cleanup;
}
......@@ -2817,8 +2817,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
else
result = query_addsoa(client, db, ISC_FALSE);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone,
dns_statscounter_failure);
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(result);
goto cleanup;
}
......@@ -3042,8 +3041,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
rdsiter = NULL;
result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
if (result != ISC_R_SUCCESS) {
count_query(zone, is_zone,
dns_statscounter_failure);
count_query(zone, is_zone, dns_statscounter_failure);
QUERY_ERROR(DNS_R_SERVFAIL);
goto cleanup;
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.283 2001/01/22 19:21:18 gson Exp $ */
/* $Id: server.c,v 1.284 2001/01/23 01:50:26 bwelling Exp $ */
#include <config.h>
......@@ -2395,7 +2395,7 @@ ns_server_dumpstats(ns_server_t *server) {
CHECKM(isc_stdio_open(server->statsfile, "a", &fp),
"could not open statistics dump file");
ncounters = dns_stats_ncounters();
ncounters = DNS_STATS_NCOUNTERS;
fprintf(fp, "+++ Statistics Dump +++ (%lu)\n", (unsigned long)now);
for (i = 0; i < ncounters; i++)
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: stats.h,v 1.2 2001/01/09 21:53:30 bwelling Exp $ */
/* $Id: stats.h,v 1.3 2001/01/23 01:50:29 bwelling Exp $ */
#ifndef DNS_STATS_H
#define DNS_STATS_H 1
......@@ -52,12 +52,6 @@ dns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp);
* context 'mctx'.
*/
unsigned int
dns_stats_ncounters(void);
/*
* Return the number of query statistics counters.
*/
ISC_LANG_ENDDECLS
#endif /* DNS_STATS_H */
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: stats.c,v 1.3 2001/01/09 21:51:34 bwelling Exp $ */
/* $Id: stats.c,v 1.4 2001/01/23 01:50:28 bwelling Exp $ */
#include <config.h>
......@@ -50,8 +50,3 @@ dns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp) {
isc_mem_put(mctx, *ctrp, DNS_STATS_NCOUNTERS * sizeof(isc_uint64_t));
*ctrp = NULL;
}
unsigned int
dns_stats_ncounters(void) {
return (DNS_STATS_NCOUNTERS);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment