stats.c File Reference

#include <config.h>
#include <string.h>
#include <isc/atomic.h>
#include <isc/buffer.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/platform.h>
#include <isc/print.h>
#include <isc/rwlock.h>
#include <isc/stats.h>
#include <isc/util.h>

Go to the source code of this file.

Data Structures

struct  isc_stats

Defines

#define ISC_STATS_MAGIC   ISC_MAGIC('S', 't', 'a', 't')
#define ISC_STATS_VALID(x)   ISC_MAGIC_VALID(x, ISC_STATS_MAGIC)
#define ISC_STATS_USEMULTIFIELDS   0

Typedefs

typedef isc_uint64_t isc_stat_t

Functions

static isc_result_t create_stats (isc_mem_t *mctx, int ncounters, isc_stats_t **statsp)
void isc_stats_attach (isc_stats_t *stats, isc_stats_t **statsp)
 Attach to a statistics set.
void isc_stats_detach (isc_stats_t **statsp)
 Detaches from the statistics set.
int isc_stats_ncounters (isc_stats_t *stats)
 Returns the number of counters contained in stats.
static void incrementcounter (isc_stats_t *stats, int counter)
static void decrementcounter (isc_stats_t *stats, int counter)
static void copy_counters (isc_stats_t *stats)
isc_result_t isc_stats_create (isc_mem_t *mctx, isc_stats_t **statsp, int ncounters)
 Create a statistics counter structure of general type. It counts a general set of counters indexed by an ID between 0 and ncounters -1.
void isc_stats_increment (isc_stats_t *stats, isc_statscounter_t counter)
 Increment the counter-th counter of stats.
void isc_stats_decrement (isc_stats_t *stats, isc_statscounter_t counter)
 Decrement the counter-th counter of stats.
void isc_stats_dump (isc_stats_t *stats, isc_stats_dumper_t dump_fn, void *arg, unsigned int options)
 Dump the current statistics counters in a specified way. For each counter in stats, dump_fn is called with its current value and the given argument arg. By default counters that have a value of 0 is skipped; if options has the ISC_STATSDUMP_VERBOSE flag, even such counters are dumped.
void isc_stats_set (isc_stats_t *stats, isc_uint64_t val, isc_statscounter_t counter)
 Set the given counter to the specfied value.


Detailed Description

Definition in file stats.c.


Define Documentation

#define ISC_STATS_MAGIC   ISC_MAGIC('S', 't', 'a', 't')

Definition at line 35 of file stats.c.

Referenced by create_stats().

#define ISC_STATS_VALID (  )     ISC_MAGIC_VALID(x, ISC_STATS_MAGIC)

Definition at line 36 of file stats.c.

Referenced by isc_stats_attach(), isc_stats_decrement(), isc_stats_detach(), isc_stats_dump(), isc_stats_increment(), isc_stats_ncounters(), and isc_stats_set().

#define ISC_STATS_USEMULTIFIELDS   0

Definition at line 42 of file stats.c.


Typedef Documentation

typedef isc_uint64_t isc_stat_t

Definition at line 52 of file stats.c.


Function Documentation

static isc_result_t create_stats ( isc_mem_t mctx,
int  ncounters,
isc_stats_t **  statsp 
) [static]

Definition at line 88 of file stats.c.

References isc_stats::copiedcounters, isc_stats::counters, DESTROYLOCK, isc_mem_attach(), isc_mem_get, isc_mem_put, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_rwlock_init(), ISC_STATS_MAGIC, isc_stats::lock, isc_stats::magic, isc_stats::mctx, isc_stats::ncounters, isc_stats::references, and REQUIRE.

Referenced by dns_generalstats_create(), dns_opcodestats_create(), dns_rdatasetstats_create(), dns_rdatatypestats_create(), and isc_stats_create().

void isc_stats_attach ( isc_stats_t stats,
isc_stats_t **  statsp 
)

Attach to a statistics set.

Requires:

Definition at line 150 of file stats.c.

References ISC_STATS_VALID, isc_stats::lock, LOCK, isc_stats::references, REQUIRE, and UNLOCK.

Referenced by dns_dispatchmgr_setstats(), dns_view_getadbstats(), dns_view_getresstats(), dns_view_setadbstats(), dns_view_setresstats(), and setcachestats().

void isc_stats_detach ( isc_stats_t **  statsp  ) 

Detaches from the statistics set.

Requires:

Definition at line 162 of file stats.c.

References isc_stats::copiedcounters, isc_stats::counters, DESTROYLOCK, isc_mem_put, isc_mem_putanddetach, isc_rwlock_destroy(), ISC_STATS_VALID, isc_stats::lock, LOCK, isc_stats::mctx, isc_stats::ncounters, isc_stats::references, REQUIRE, and UNLOCK.

Referenced by cache_free(), configure_view(), destroy(), destroy_mgr(), dns_cache_create3(), dns_stats_detach(), free_rbtdb(), ns_server_destroy(), ns_zone_configure(), setquerystats(), and zone_free().

int isc_stats_ncounters ( isc_stats_t stats  ) 

Returns the number of counters contained in stats.

Requires:

Definition at line 191 of file stats.c.

References ISC_STATS_VALID, isc_stats::ncounters, and REQUIRE.

static void incrementcounter ( isc_stats_t stats,
int  counter 
) [inline, static]

Definition at line 198 of file stats.c.

References isc_stats::counters, isc_rwlock_lock(), isc_rwlock_unlock(), isc_rwlocktype_read, and UNUSED.

Referenced by isc_stats_increment().

static void decrementcounter ( isc_stats_t stats,
int  counter 
) [inline, static]

Definition at line 236 of file stats.c.

References isc_stats::counters, isc_rwlock_lock(), isc_rwlock_unlock(), isc_rwlocktype_read, and UNUSED.

Referenced by isc_stats_decrement().

static void copy_counters ( isc_stats_t stats  )  [static]

Definition at line 262 of file stats.c.

References isc_stats::copiedcounters, isc_stats::counters, isc_rwlock_lock(), isc_rwlock_unlock(), isc_rwlocktype_write, isc_stats::ncounters, and UNUSED.

Referenced by isc_stats_dump().

isc_result_t isc_stats_create ( isc_mem_t mctx,
isc_stats_t **  statsp,
int  ncounters 
)

Create a statistics counter structure of general type. It counts a general set of counters indexed by an ID between 0 and ncounters -1.

Requires:

Returns:

Definition at line 291 of file stats.c.

References create_stats(), and REQUIRE.

Referenced by configure_view(), create_stats(), dns_adb_create(), dns_cache_create3(), ns_server_create(), ns_zone_configure(), and setquerystats().

void isc_stats_increment ( isc_stats_t stats,
isc_statscounter_t  counter 
)

Increment the counter-th counter of stats.

Requires:

Definition at line 298 of file stats.c.

References incrementcounter(), ISC_STATS_VALID, and REQUIRE.

Referenced by client_request(), client_send(), dns_cache_updatestats(), dns_generalstats_increment(), dns_opcodestats_increment(), dns_rdatatypestats_increment(), expire_header(), inc_adbstats(), inc_stat(), inc_stats(), ns_client_error(), process_opt(), query_prefetch(), query_recurse(), rpz_log_rewrite(), update_cachestats(), and update_rdatasetstats().

void isc_stats_decrement ( isc_stats_t stats,
isc_statscounter_t  counter 
)

Decrement the counter-th counter of stats.

Requires:

Definition at line 306 of file stats.c.

References decrementcounter(), ISC_STATS_VALID, and REQUIRE.

Referenced by dec_adbstats(), dec_stats(), ns_client_endrequest(), query_recurse(), and update_rdatasetstats().

void isc_stats_dump ( isc_stats_t stats,
isc_stats_dumper_t  dump_fn,
void *  arg,
unsigned int  options 
)

Dump the current statistics counters in a specified way. For each counter in stats, dump_fn is called with its current value and the given argument arg. By default counters that have a value of 0 is skipped; if options has the ISC_STATSDUMP_VERBOSE flag, even such counters are dumped.

Requires:

Definition at line 314 of file stats.c.

References isc_stats::copiedcounters, copy_counters(), ISC_STATS_VALID, ISC_STATSDUMP_VERBOSE, isc_stats::ncounters, and REQUIRE.

Referenced by dns_generalstats_dump(), dns_opcodestats_dump(), dns_rdatasetstats_dump(), dns_rdatatypestats_dump(), dump_counters(), and getcounters().

void isc_stats_set ( isc_stats_t stats,
isc_uint64_t  val,
isc_statscounter_t  counter 
)

Set the given counter to the specfied value.

Requires:

Definition at line 332 of file stats.c.

References isc_stats::counters, isc_rwlock_lock(), isc_rwlock_unlock(), isc_rwlocktype_write, ISC_STATS_VALID, and REQUIRE.

Referenced by dns_resolver_create(), and set_adbstat().


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha