mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 05:57:52 +00:00
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.
This commit is contained in:
parent
7817a6f41b
commit
d29da750d2
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@ -141,10 +141,11 @@ synth_rev_respond(ns_client_t *client, dns_byaddrevent_t *bevent);
|
|||||||
/*
|
/*
|
||||||
* Increment query statistics counters.
|
* Increment query statistics counters.
|
||||||
*/
|
*/
|
||||||
static void
|
static inline void
|
||||||
count_query(dns_zone_t *zone, isc_boolean_t is_zone, dns_statscounter_t counter)
|
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]++;
|
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);
|
fname = query_newname(client, dbuf, &b);
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
count_query(zone, is_zone,
|
count_query(zone, is_zone, dns_statscounter_failure);
|
||||||
dns_statscounter_failure);
|
|
||||||
QUERY_ERROR(DNS_R_SERVFAIL);
|
QUERY_ERROR(DNS_R_SERVFAIL);
|
||||||
goto cleanup;
|
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,
|
result = dns_name_copy(client->query.qname,
|
||||||
fname, NULL);
|
fname, NULL);
|
||||||
if (result != ISC_R_SUCCESS) {
|
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);
|
QUERY_ERROR(DNS_R_SERVFAIL);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2704,7 +2705,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||||||
NS_QUERYATTR_RECURSING;
|
NS_QUERYATTR_RECURSING;
|
||||||
else {
|
else {
|
||||||
count_query(zone, is_zone,
|
count_query(zone, is_zone,
|
||||||
dns_statscounter_failure);
|
dns_statscounter_failure);
|
||||||
QUERY_ERROR(DNS_R_SERVFAIL);
|
QUERY_ERROR(DNS_R_SERVFAIL);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
result = query_addsoa(client, db, ISC_FALSE);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
count_query(zone, is_zone,
|
count_query(zone, is_zone, dns_statscounter_failure);
|
||||||
dns_statscounter_failure);
|
|
||||||
QUERY_ERROR(result);
|
QUERY_ERROR(result);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -2817,8 +2817,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||||||
else
|
else
|
||||||
result = query_addsoa(client, db, ISC_FALSE);
|
result = query_addsoa(client, db, ISC_FALSE);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
count_query(zone, is_zone,
|
count_query(zone, is_zone, dns_statscounter_failure);
|
||||||
dns_statscounter_failure);
|
|
||||||
QUERY_ERROR(result);
|
QUERY_ERROR(result);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -3042,8 +3041,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
|
|||||||
rdsiter = NULL;
|
rdsiter = NULL;
|
||||||
result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
|
result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
count_query(zone, is_zone,
|
count_query(zone, is_zone, dns_statscounter_failure);
|
||||||
dns_statscounter_failure);
|
|
||||||
QUERY_ERROR(DNS_R_SERVFAIL);
|
QUERY_ERROR(DNS_R_SERVFAIL);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@ -2395,7 +2395,7 @@ ns_server_dumpstats(ns_server_t *server) {
|
|||||||
CHECKM(isc_stdio_open(server->statsfile, "a", &fp),
|
CHECKM(isc_stdio_open(server->statsfile, "a", &fp),
|
||||||
"could not open statistics dump file");
|
"could not open statistics dump file");
|
||||||
|
|
||||||
ncounters = dns_stats_ncounters();
|
ncounters = DNS_STATS_NCOUNTERS;
|
||||||
fprintf(fp, "+++ Statistics Dump +++ (%lu)\n", (unsigned long)now);
|
fprintf(fp, "+++ Statistics Dump +++ (%lu)\n", (unsigned long)now);
|
||||||
|
|
||||||
for (i = 0; i < ncounters; i++)
|
for (i = 0; i < ncounters; i++)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
#ifndef DNS_STATS_H
|
||||||
#define DNS_STATS_H 1
|
#define DNS_STATS_H 1
|
||||||
@ -52,12 +52,6 @@ dns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp);
|
|||||||
* context 'mctx'.
|
* context 'mctx'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned int
|
|
||||||
dns_stats_ncounters(void);
|
|
||||||
/*
|
|
||||||
* Return the number of query statistics counters.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
|
||||||
#endif /* DNS_STATS_H */
|
#endif /* DNS_STATS_H */
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#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));
|
isc_mem_put(mctx, *ctrp, DNS_STATS_NCOUNTERS * sizeof(isc_uint64_t));
|
||||||
*ctrp = NULL;
|
*ctrp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
|
||||||
dns_stats_ncounters(void) {
|
|
||||||
return (DNS_STATS_NCOUNTERS);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user