stats.c revision 1c3ed2a83d176d9023b51b60dfc96c133f678362
/*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: stats.c,v 1.13 2008/01/24 02:00:44 jinmei Exp $ */
/*! \file */
#include <config.h>
#include <string.h>
#include <isc/platform.h>
{
"success",
"referral",
"nxrrset",
"nxdomain",
"recursion",
"failure",
"duplicate",
"dropped"
};
#ifndef DNS_STATS_USEMULTIFIELDS
#if defined(ISC_RWLOCK_USEATOMIC) && defined(ISC_PLATFORM_HAVEXADD) && !defined(ISC_PLATFORM_HAVEXADDQ)
#define DNS_STATS_USEMULTIFIELDS 1
#else
#define DNS_STATS_USEMULTIFIELDS 0
#endif
#endif /* DNS_STATS_USEMULTIFIELDS */
typedef struct {
} dns_stat_t;
#else
typedef isc_uint64_t dns_stat_t;
#endif
struct dns_stats {
/* XXXJT: do we need a magic? */
#ifdef ISC_RWLOCK_USEATOMIC
#endif
};
return (ISC_R_NOMEMORY);
#ifdef ISC_RWLOCK_USEATOMIC
if (result != ISC_R_SUCCESS) {
return (result);
}
#endif
return (result);
}
void
#ifdef ISC_RWLOCK_USEATOMIC
#endif
}
void
#ifdef ISC_RWLOCK_USEATOMIC
/*
* We use a "read" lock to prevent other threads from reading the
* counter while we "writing" a counter field. The write access itself
* is protected by the atomic operation.
*/
#endif
/*
* If the lower 32-bit field overflows, increment the higher field.
* Note that it's *theoretically* possible that the lower field
* overlaps again before the higher field is incremented. It doesn't
* matter, however, because we don't read the value until
* dns_stats_copy() is called where the whole process is protected
* by the write (exclusive) lock.
*/
#elif defined(ISC_PLATFORM_HAVEXADDQ)
#else
#endif
#ifdef ISC_RWLOCK_USEATOMIC
#endif
}
void
int i;
#ifdef ISC_RWLOCK_USEATOMIC
/*
* We use a "write" lock before "reading" the statistics counters as
* an exclusive lock.
*/
#endif
for (i = 0; i < DNS_STATS_NCOUNTERS; i++) {
}
#else
UNUSED(i);
#endif
#ifdef ISC_RWLOCK_USEATOMIC
#endif
}
/***
*** Obsolete functions follow
***/
int i;
isc_uint64_t *p =
if (p == NULL)
return (ISC_R_NOMEMORY);
for (i = 0; i < DNS_STATS_NCOUNTERS; i++)
p[i] = 0;
*ctrp = p;
return (ISC_R_SUCCESS);
}
void
}