stats.c revision 135446
1135446Strhodes/* 2135446Strhodes * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") 3135446Strhodes * Copyright (C) 2000, 2001 Internet Software Consortium. 4135446Strhodes * 5135446Strhodes * Permission to use, copy, modify, and distribute this software for any 6135446Strhodes * purpose with or without fee is hereby granted, provided that the above 7135446Strhodes * copyright notice and this permission notice appear in all copies. 8135446Strhodes * 9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11135446Strhodes * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15135446Strhodes * PERFORMANCE OF THIS SOFTWARE. 16135446Strhodes */ 17135446Strhodes 18135446Strhodes/* $Id: stats.c,v 1.5.206.1 2004/03/06 08:13:46 marka Exp $ */ 19135446Strhodes 20135446Strhodes#include <config.h> 21135446Strhodes 22135446Strhodes#include <isc/mem.h> 23135446Strhodes 24135446Strhodes#include <dns/stats.h> 25135446Strhodes 26135446StrhodesLIBDNS_EXTERNAL_DATA const char *dns_statscounter_names[DNS_STATS_NCOUNTERS] = 27135446Strhodes { 28135446Strhodes "success", 29135446Strhodes "referral", 30135446Strhodes "nxrrset", 31135446Strhodes "nxdomain", 32135446Strhodes "recursion", 33135446Strhodes "failure" 34135446Strhodes }; 35135446Strhodes 36135446Strhodesisc_result_t 37135446Strhodesdns_stats_alloccounters(isc_mem_t *mctx, isc_uint64_t **ctrp) { 38135446Strhodes int i; 39135446Strhodes isc_uint64_t *p = 40135446Strhodes isc_mem_get(mctx, DNS_STATS_NCOUNTERS * sizeof(isc_uint64_t)); 41135446Strhodes if (p == NULL) 42135446Strhodes return (ISC_R_NOMEMORY); 43135446Strhodes for (i = 0; i < DNS_STATS_NCOUNTERS; i++) 44135446Strhodes p[i] = 0; 45135446Strhodes *ctrp = p; 46135446Strhodes return (ISC_R_SUCCESS); 47135446Strhodes} 48135446Strhodes 49135446Strhodesvoid 50135446Strhodesdns_stats_freecounters(isc_mem_t *mctx, isc_uint64_t **ctrp) { 51135446Strhodes isc_mem_put(mctx, *ctrp, DNS_STATS_NCOUNTERS * sizeof(isc_uint64_t)); 52135446Strhodes *ctrp = NULL; 53135446Strhodes} 54