1#ifndef STAT_H
2#define STAT_H
3/* $OpenBSD: stats.h,v 1.6 2010/07/19 19:46:44 espie Exp $ */
4
5/*
6 * Copyright (c) 1999 Marc Espie.
7 *
8 * Code written for the OpenBSD project.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
23 * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/* statistical information gathering */
33
34#if defined(STATS_VAR_LOOKUP) || \
35	defined(STATS_GN_CREATION) || \
36	defined(STATS_BUF) || \
37	defined(STATS_HASH) || \
38	defined(STATS_GROW) || \
39	defined(STATS_SUFF)
40#define HAS_STATS
41#endif
42
43#ifdef HAS_STATS
44extern void Init_Stats(void);
45
46extern unsigned long *statarray;
47#define STAT_INVOCATIONS	 statarray[0]
48#define STAT_VAR_SEARCHES	 statarray[1]
49#define STAT_VAR_COUNT		 statarray[2]
50#define STAT_VAR_MAXCOUNT	 statarray[3]
51#define STAT_GN_COUNT		 statarray[4]
52#define STAT_TOTAL_BUFS 	 statarray[5]
53#define STAT_DEFAULT_BUFS	 statarray[6]
54#define STAT_WEIRD_BUFS 	 statarray[7]
55#define STAT_BUFS_EXPANSION	 statarray[8]
56#define STAT_WEIRD_INEFFICIENT	 statarray[9]
57#define STAT_VAR_HASH_CREATION	statarray[10]
58#define STAT_VAR_FROM_ENV	statarray[11]
59#define STAT_VAR_CREATION	statarray[12]
60#define STAT_VAR_FIND		statarray[13]
61#define STAT_HASH_CREATION	statarray[14]
62#define STAT_HASH_ENTRIES	statarray[15]
63#define STAT_HASH_EXPAND	statarray[16]
64#define STAT_HASH_LOOKUP	statarray[17]
65#define STAT_HASH_LENGTH	statarray[18]
66#define STAT_HASH_SIZE		statarray[19]
67#define STAT_HASH_POSITIVE	statarray[20]
68#define STAT_USER_SECONDS	statarray[21]
69#define STAT_USER_MS		statarray[22]
70#define STAT_SYS_SECONDS	statarray[23]
71#define STAT_SYS_MS		statarray[24]
72#define STAT_VAR_HASH_MAXSIZE	statarray[25]
73#define STAT_VAR_GHASH_MAXSIZE	statarray[26]
74#define STAT_VAR_POWER		statarray[27]
75#define STAT_GROWARRAY		statarray[28]
76#define STAT_SUFF_LOOKUP_NAME	statarray[29]
77#define STAT_TRANSFORM_LOOKUP_NAME	statarray[30]
78
79#define STAT_NUMBER		32
80
81#else
82#define Init_Stats()
83#endif
84
85#endif
86