summaryrefslogtreecommitdiff
path: root/dist/s_stat
blob: 5d5937e18332ceb329d6e10098c8be9b881a48da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#! /bin/sh

# Complain about unused statistics fields.
t=__wt.$$
trap 'rm -f $t' 0 1 2 3 13 15

# List of files to search: skip stat.c, it lists all of the fields by
# definition.
l=`sed \
    -e '/src\/support\/stat.c/d' \
    -e '/^[a-z]/!d' \
    -e 's/[	 ].*$//' \
    -e 's,^,../,' filelist`
l="$l `echo ../src/include/*.i ../src/include/os.h`"

(
# Get the list of statistics fields.
search=`sed \
    -e 's/^	int64_t \([a-z_*]*\);$/\1/p' \
    -e d ../src/include/stat.h |
    sort`

# There are some fields that are used, but we can't detect it.
cat << UNUSED_STAT_FIELDS
lock_checkpoint_count
lock_checkpoint_wait_application
lock_checkpoint_wait_internal
lock_handle_list_count
lock_handle_list_wait_application
lock_handle_list_wait_internal
lock_metadata_count
lock_metadata_wait_application
lock_metadata_wait_internal
lock_schema_count
lock_schema_wait_application
lock_schema_wait_internal
lock_table_count
lock_table_wait_application
lock_table_wait_internal
UNUSED_STAT_FIELDS

echo "$search"
fgrep -who "$search" $l) | sort | uniq -u > $t

test -s $t && {
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	echo 'unused statistics fields'
	echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
	cat $t
	exit 1
}
exit 0