summaryrefslogtreecommitdiff
path: root/src/support/stat.c
blob: 7150223e6cb8bb072de0b43d8c0a61c52d6e2739 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
/* DO NOT EDIT: automatically built by dist/stat.py. */

#include "wt_internal.h"

static const char * const __stats_dsrc_desc[] = {
	"LSM: bloom filter false positives",
	"LSM: bloom filter hits",
	"LSM: bloom filter misses",
	"LSM: bloom filter pages evicted from cache",
	"LSM: bloom filter pages read into cache",
	"LSM: bloom filters in the LSM tree",
	"LSM: chunks in the LSM tree",
	"LSM: highest merge generation in the LSM tree",
	"LSM: queries that could have benefited from a Bloom filter that did not exist",
	"LSM: sleep for LSM checkpoint throttle",
	"LSM: sleep for LSM merge throttle",
	"LSM: total size of bloom filters",
	"block-manager: allocations requiring file extension",
	"block-manager: blocks allocated",
	"block-manager: blocks freed",
	"block-manager: checkpoint size",
	"block-manager: file allocation unit size",
	"block-manager: file bytes available for reuse",
	"block-manager: file magic number",
	"block-manager: file major version number",
	"block-manager: file size in bytes",
	"block-manager: minor version number",
	"btree: btree checkpoint generation",
	"btree: column-store fixed-size leaf pages",
	"btree: column-store internal pages",
	"btree: column-store variable-size RLE encoded values",
	"btree: column-store variable-size deleted values",
	"btree: column-store variable-size leaf pages",
	"btree: fixed-record size",
	"btree: maximum internal page key size",
	"btree: maximum internal page size",
	"btree: maximum leaf page key size",
	"btree: maximum leaf page size",
	"btree: maximum leaf page value size",
	"btree: maximum tree depth",
	"btree: number of key/value pairs",
	"btree: overflow pages",
	"btree: pages rewritten by compaction",
	"btree: row-store internal pages",
	"btree: row-store leaf pages",
	"cache: bytes currently in the cache",
	"cache: bytes read into cache",
	"cache: bytes written from cache",
	"cache: checkpoint blocked page eviction",
	"cache: data source pages selected for eviction unable to be evicted",
	"cache: hazard pointer blocked page eviction",
	"cache: in-memory page passed criteria to be split",
	"cache: in-memory page splits",
	"cache: internal pages evicted",
	"cache: internal pages split during eviction",
	"cache: leaf pages split during eviction",
	"cache: modified pages evicted",
	"cache: overflow pages read into cache",
	"cache: overflow values cached in memory",
	"cache: page split during eviction deepened the tree",
	"cache: page written requiring lookaside records",
	"cache: pages read into cache",
	"cache: pages read into cache requiring lookaside entries",
	"cache: pages requested from the cache",
	"cache: pages written from cache",
	"cache: pages written requiring in-memory restoration",
	"cache: unmodified pages evicted",
	"compression: compressed pages read",
	"compression: compressed pages written",
	"compression: page written failed to compress",
	"compression: page written was too small to compress",
	"compression: raw compression call failed, additional data available",
	"compression: raw compression call failed, no additional data available",
	"compression: raw compression call succeeded",
	"cursor: bulk-loaded cursor-insert calls",
	"cursor: create calls",
	"cursor: cursor-insert key and value bytes inserted",
	"cursor: cursor-remove key bytes removed",
	"cursor: cursor-update value bytes updated",
	"cursor: insert calls",
	"cursor: next calls",
	"cursor: prev calls",
	"cursor: remove calls",
	"cursor: reset calls",
	"cursor: restarted searches",
	"cursor: search calls",
	"cursor: search near calls",
	"cursor: truncate calls",
	"cursor: update calls",
	"reconciliation: dictionary matches",
	"reconciliation: fast-path pages deleted",
	"reconciliation: internal page key bytes discarded using suffix compression",
	"reconciliation: internal page multi-block writes",
	"reconciliation: internal-page overflow keys",
	"reconciliation: leaf page key bytes discarded using prefix compression",
	"reconciliation: leaf page multi-block writes",
	"reconciliation: leaf-page overflow keys",
	"reconciliation: maximum blocks required for a page",
	"reconciliation: overflow values written",
	"reconciliation: page checksum matches",
	"reconciliation: page reconciliation calls",
	"reconciliation: page reconciliation calls for eviction",
	"reconciliation: pages deleted",
	"session: object compaction",
	"session: open cursor count",
	"transaction: update conflicts",
};

int
__wt_stat_dsrc_desc(WT_CURSOR_STAT *cst, int slot, const char **p)
{
	WT_UNUSED(cst);
	*p = __stats_dsrc_desc[slot];
	return (0);
}

void
__wt_stat_dsrc_init_single(WT_DSRC_STATS *stats)
{
	memset(stats, 0, sizeof(*stats));
}

void
__wt_stat_dsrc_init(WT_DATA_HANDLE *handle)
{
	int i;

	for (i = 0; i < WT_COUNTER_SLOTS; ++i) {
		handle->stats[i] = &handle->stat_array[i];
		__wt_stat_dsrc_init_single(handle->stats[i]);
	}
}

void
__wt_stat_dsrc_clear_single(WT_DSRC_STATS *stats)
{
	stats->bloom_false_positive = 0;
	stats->bloom_hit = 0;
	stats->bloom_miss = 0;
	stats->bloom_page_evict = 0;
	stats->bloom_page_read = 0;
	stats->bloom_count = 0;
	stats->lsm_chunk_count = 0;
	stats->lsm_generation_max = 0;
	stats->lsm_lookup_no_bloom = 0;
	stats->lsm_checkpoint_throttle = 0;
	stats->lsm_merge_throttle = 0;
	stats->bloom_size = 0;
	stats->block_extension = 0;
	stats->block_alloc = 0;
	stats->block_free = 0;
	stats->block_checkpoint_size = 0;
	stats->allocation_size = 0;
	stats->block_reuse_bytes = 0;
	stats->block_magic = 0;
	stats->block_major = 0;
	stats->block_size = 0;
	stats->block_minor = 0;
		/* not clearing btree_checkpoint_generation */
	stats->btree_column_fix = 0;
	stats->btree_column_internal = 0;
	stats->btree_column_rle = 0;
	stats->btree_column_deleted = 0;
	stats->btree_column_variable = 0;
	stats->btree_fixed_len = 0;
	stats->btree_maxintlkey = 0;
	stats->btree_maxintlpage = 0;
	stats->btree_maxleafkey = 0;
	stats->btree_maxleafpage = 0;
	stats->btree_maxleafvalue = 0;
	stats->btree_maximum_depth = 0;
	stats->btree_entries = 0;
	stats->btree_overflow = 0;
	stats->btree_compact_rewrite = 0;
	stats->btree_row_internal = 0;
	stats->btree_row_leaf = 0;
		/* not clearing cache_bytes_inuse */
	stats->cache_bytes_read = 0;
	stats->cache_bytes_write = 0;
	stats->cache_eviction_checkpoint = 0;
	stats->cache_eviction_fail = 0;
	stats->cache_eviction_hazard = 0;
	stats->cache_inmem_splittable = 0;
	stats->cache_inmem_split = 0;
	stats->cache_eviction_internal = 0;
	stats->cache_eviction_split_internal = 0;
	stats->cache_eviction_split_leaf = 0;
	stats->cache_eviction_dirty = 0;
	stats->cache_read_overflow = 0;
	stats->cache_overflow_value = 0;
	stats->cache_eviction_deepen = 0;
	stats->cache_write_lookaside = 0;
	stats->cache_read = 0;
	stats->cache_read_lookaside = 0;
	stats->cache_pages_requested = 0;
	stats->cache_write = 0;
	stats->cache_write_restore = 0;
	stats->cache_eviction_clean = 0;
	stats->compress_read = 0;
	stats->compress_write = 0;
	stats->compress_write_fail = 0;
	stats->compress_write_too_small = 0;
	stats->compress_raw_fail_temporary = 0;
	stats->compress_raw_fail = 0;
	stats->compress_raw_ok = 0;
	stats->cursor_insert_bulk = 0;
	stats->cursor_create = 0;
	stats->cursor_insert_bytes = 0;
	stats->cursor_remove_bytes = 0;
	stats->cursor_update_bytes = 0;
	stats->cursor_insert = 0;
	stats->cursor_next = 0;
	stats->cursor_prev = 0;
	stats->cursor_remove = 0;
	stats->cursor_reset = 0;
	stats->cursor_restart = 0;
	stats->cursor_search = 0;
	stats->cursor_search_near = 0;
	stats->cursor_truncate = 0;
	stats->cursor_update = 0;
	stats->rec_dictionary = 0;
	stats->rec_page_delete_fast = 0;
	stats->rec_suffix_compression = 0;
	stats->rec_multiblock_internal = 0;
	stats->rec_overflow_key_internal = 0;
	stats->rec_prefix_compression = 0;
	stats->rec_multiblock_leaf = 0;
	stats->rec_overflow_key_leaf = 0;
	stats->rec_multiblock_max = 0;
	stats->rec_overflow_value = 0;
	stats->rec_page_match = 0;
	stats->rec_pages = 0;
	stats->rec_pages_eviction = 0;
	stats->rec_page_delete = 0;
	stats->session_compact = 0;
		/* not clearing session_cursor_open */
	stats->txn_update_conflict = 0;
}

void
__wt_stat_dsrc_clear_all(WT_DSRC_STATS **stats)
{
	u_int i;

	for (i = 0; i < WT_COUNTER_SLOTS; ++i)
		__wt_stat_dsrc_clear_single(stats[i]);
}

void
__wt_stat_dsrc_aggregate_single(
    WT_DSRC_STATS *from, WT_DSRC_STATS *to)
{
	to->bloom_false_positive += from->bloom_false_positive;
	to->bloom_hit += from->bloom_hit;
	to->bloom_miss += from->bloom_miss;
	to->bloom_page_evict += from->bloom_page_evict;
	to->bloom_page_read += from->bloom_page_read;
	to->bloom_count += from->bloom_count;
	to->lsm_chunk_count += from->lsm_chunk_count;
	if (from->lsm_generation_max > to->lsm_generation_max)
		to->lsm_generation_max = from->lsm_generation_max;
	to->lsm_lookup_no_bloom += from->lsm_lookup_no_bloom;
	to->lsm_checkpoint_throttle += from->lsm_checkpoint_throttle;
	to->lsm_merge_throttle += from->lsm_merge_throttle;
	to->bloom_size += from->bloom_size;
	to->block_extension += from->block_extension;
	to->block_alloc += from->block_alloc;
	to->block_free += from->block_free;
	to->block_checkpoint_size += from->block_checkpoint_size;
	if (from->allocation_size > to->allocation_size)
		to->allocation_size = from->allocation_size;
	to->block_reuse_bytes += from->block_reuse_bytes;
	if (from->block_magic > to->block_magic)
		to->block_magic = from->block_magic;
	if (from->block_major > to->block_major)
		to->block_major = from->block_major;
	to->block_size += from->block_size;
	if (from->block_minor > to->block_minor)
		to->block_minor = from->block_minor;
	to->btree_checkpoint_generation += from->btree_checkpoint_generation;
	to->btree_column_fix += from->btree_column_fix;
	to->btree_column_internal += from->btree_column_internal;
	to->btree_column_rle += from->btree_column_rle;
	to->btree_column_deleted += from->btree_column_deleted;
	to->btree_column_variable += from->btree_column_variable;
	if (from->btree_fixed_len > to->btree_fixed_len)
		to->btree_fixed_len = from->btree_fixed_len;
	if (from->btree_maxintlkey > to->btree_maxintlkey)
		to->btree_maxintlkey = from->btree_maxintlkey;
	if (from->btree_maxintlpage > to->btree_maxintlpage)
		to->btree_maxintlpage = from->btree_maxintlpage;
	if (from->btree_maxleafkey > to->btree_maxleafkey)
		to->btree_maxleafkey = from->btree_maxleafkey;
	if (from->btree_maxleafpage > to->btree_maxleafpage)
		to->btree_maxleafpage = from->btree_maxleafpage;
	if (from->btree_maxleafvalue > to->btree_maxleafvalue)
		to->btree_maxleafvalue = from->btree_maxleafvalue;
	if (from->btree_maximum_depth > to->btree_maximum_depth)
		to->btree_maximum_depth = from->btree_maximum_depth;
	to->btree_entries += from->btree_entries;
	to->btree_overflow += from->btree_overflow;
	to->btree_compact_rewrite += from->btree_compact_rewrite;
	to->btree_row_internal += from->btree_row_internal;
	to->btree_row_leaf += from->btree_row_leaf;
	to->cache_bytes_inuse += from->cache_bytes_inuse;
	to->cache_bytes_read += from->cache_bytes_read;
	to->cache_bytes_write += from->cache_bytes_write;
	to->cache_eviction_checkpoint += from->cache_eviction_checkpoint;
	to->cache_eviction_fail += from->cache_eviction_fail;
	to->cache_eviction_hazard += from->cache_eviction_hazard;
	to->cache_inmem_splittable += from->cache_inmem_splittable;
	to->cache_inmem_split += from->cache_inmem_split;
	to->cache_eviction_internal += from->cache_eviction_internal;
	to->cache_eviction_split_internal +=
	    from->cache_eviction_split_internal;
	to->cache_eviction_split_leaf += from->cache_eviction_split_leaf;
	to->cache_eviction_dirty += from->cache_eviction_dirty;
	to->cache_read_overflow += from->cache_read_overflow;
	to->cache_overflow_value += from->cache_overflow_value;
	to->cache_eviction_deepen += from->cache_eviction_deepen;
	to->cache_write_lookaside += from->cache_write_lookaside;
	to->cache_read += from->cache_read;
	to->cache_read_lookaside += from->cache_read_lookaside;
	to->cache_pages_requested += from->cache_pages_requested;
	to->cache_write += from->cache_write;
	to->cache_write_restore += from->cache_write_restore;
	to->cache_eviction_clean += from->cache_eviction_clean;
	to->compress_read += from->compress_read;
	to->compress_write += from->compress_write;
	to->compress_write_fail += from->compress_write_fail;
	to->compress_write_too_small += from->compress_write_too_small;
	to->compress_raw_fail_temporary += from->compress_raw_fail_temporary;
	to->compress_raw_fail += from->compress_raw_fail;
	to->compress_raw_ok += from->compress_raw_ok;
	to->cursor_insert_bulk += from->cursor_insert_bulk;
	to->cursor_create += from->cursor_create;
	to->cursor_insert_bytes += from->cursor_insert_bytes;
	to->cursor_remove_bytes += from->cursor_remove_bytes;
	to->cursor_update_bytes += from->cursor_update_bytes;
	to->cursor_insert += from->cursor_insert;
	to->cursor_next += from->cursor_next;
	to->cursor_prev += from->cursor_prev;
	to->cursor_remove += from->cursor_remove;
	to->cursor_reset += from->cursor_reset;
	to->cursor_restart += from->cursor_restart;
	to->cursor_search += from->cursor_search;
	to->cursor_search_near += from->cursor_search_near;
	to->cursor_truncate += from->cursor_truncate;
	to->cursor_update += from->cursor_update;
	to->rec_dictionary += from->rec_dictionary;
	to->rec_page_delete_fast += from->rec_page_delete_fast;
	to->rec_suffix_compression += from->rec_suffix_compression;
	to->rec_multiblock_internal += from->rec_multiblock_internal;
	to->rec_overflow_key_internal += from->rec_overflow_key_internal;
	to->rec_prefix_compression += from->rec_prefix_compression;
	to->rec_multiblock_leaf += from->rec_multiblock_leaf;
	to->rec_overflow_key_leaf += from->rec_overflow_key_leaf;
	if (from->rec_multiblock_max > to->rec_multiblock_max)
		to->rec_multiblock_max = from->rec_multiblock_max;
	to->rec_overflow_value += from->rec_overflow_value;
	to->rec_page_match += from->rec_page_match;
	to->rec_pages += from->rec_pages;
	to->rec_pages_eviction += from->rec_pages_eviction;
	to->rec_page_delete += from->rec_page_delete;
	to->session_compact += from->session_compact;
	to->session_cursor_open += from->session_cursor_open;
	to->txn_update_conflict += from->txn_update_conflict;
}

void
__wt_stat_dsrc_aggregate(
    WT_DSRC_STATS **from, WT_DSRC_STATS *to)
{
	int64_t v;

	to->bloom_false_positive += WT_STAT_READ(from, bloom_false_positive);
	to->bloom_hit += WT_STAT_READ(from, bloom_hit);
	to->bloom_miss += WT_STAT_READ(from, bloom_miss);
	to->bloom_page_evict += WT_STAT_READ(from, bloom_page_evict);
	to->bloom_page_read += WT_STAT_READ(from, bloom_page_read);
	to->bloom_count += WT_STAT_READ(from, bloom_count);
	to->lsm_chunk_count += WT_STAT_READ(from, lsm_chunk_count);
	if ((v = WT_STAT_READ(from, lsm_generation_max)) >
	    to->lsm_generation_max)
		to->lsm_generation_max = v;
	to->lsm_lookup_no_bloom += WT_STAT_READ(from, lsm_lookup_no_bloom);
	to->lsm_checkpoint_throttle +=
	    WT_STAT_READ(from, lsm_checkpoint_throttle);
	to->lsm_merge_throttle += WT_STAT_READ(from, lsm_merge_throttle);
	to->bloom_size += WT_STAT_READ(from, bloom_size);
	to->block_extension += WT_STAT_READ(from, block_extension);
	to->block_alloc += WT_STAT_READ(from, block_alloc);
	to->block_free += WT_STAT_READ(from, block_free);
	to->block_checkpoint_size +=
	    WT_STAT_READ(from, block_checkpoint_size);
	if ((v = WT_STAT_READ(from, allocation_size)) > to->allocation_size)
		to->allocation_size = v;
	to->block_reuse_bytes += WT_STAT_READ(from, block_reuse_bytes);
	if ((v = WT_STAT_READ(from, block_magic)) > to->block_magic)
		to->block_magic = v;
	if ((v = WT_STAT_READ(from, block_major)) > to->block_major)
		to->block_major = v;
	to->block_size += WT_STAT_READ(from, block_size);
	if ((v = WT_STAT_READ(from, block_minor)) > to->block_minor)
		to->block_minor = v;
	to->btree_checkpoint_generation +=
	    WT_STAT_READ(from, btree_checkpoint_generation);
	to->btree_column_fix += WT_STAT_READ(from, btree_column_fix);
	to->btree_column_internal +=
	    WT_STAT_READ(from, btree_column_internal);
	to->btree_column_rle += WT_STAT_READ(from, btree_column_rle);
	to->btree_column_deleted += WT_STAT_READ(from, btree_column_deleted);
	to->btree_column_variable +=
	    WT_STAT_READ(from, btree_column_variable);
	if ((v = WT_STAT_READ(from, btree_fixed_len)) > to->btree_fixed_len)
		to->btree_fixed_len = v;
	if ((v = WT_STAT_READ(from, btree_maxintlkey)) > to->btree_maxintlkey)
		to->btree_maxintlkey = v;
	if ((v = WT_STAT_READ(from, btree_maxintlpage)) >
	    to->btree_maxintlpage)
		to->btree_maxintlpage = v;
	if ((v = WT_STAT_READ(from, btree_maxleafkey)) > to->btree_maxleafkey)
		to->btree_maxleafkey = v;
	if ((v = WT_STAT_READ(from, btree_maxleafpage)) >
	    to->btree_maxleafpage)
		to->btree_maxleafpage = v;
	if ((v = WT_STAT_READ(from, btree_maxleafvalue)) >
	    to->btree_maxleafvalue)
		to->btree_maxleafvalue = v;
	if ((v = WT_STAT_READ(from, btree_maximum_depth)) >
	    to->btree_maximum_depth)
		to->btree_maximum_depth = v;
	to->btree_entries += WT_STAT_READ(from, btree_entries);
	to->btree_overflow += WT_STAT_READ(from, btree_overflow);
	to->btree_compact_rewrite +=
	    WT_STAT_READ(from, btree_compact_rewrite);
	to->btree_row_internal += WT_STAT_READ(from, btree_row_internal);
	to->btree_row_leaf += WT_STAT_READ(from, btree_row_leaf);
	to->cache_bytes_inuse += WT_STAT_READ(from, cache_bytes_inuse);
	to->cache_bytes_read += WT_STAT_READ(from, cache_bytes_read);
	to->cache_bytes_write += WT_STAT_READ(from, cache_bytes_write);
	to->cache_eviction_checkpoint +=
	    WT_STAT_READ(from, cache_eviction_checkpoint);
	to->cache_eviction_fail += WT_STAT_READ(from, cache_eviction_fail);
	to->cache_eviction_hazard +=
	    WT_STAT_READ(from, cache_eviction_hazard);
	to->cache_inmem_splittable +=
	    WT_STAT_READ(from, cache_inmem_splittable);
	to->cache_inmem_split += WT_STAT_READ(from, cache_inmem_split);
	to->cache_eviction_internal +=
	    WT_STAT_READ(from, cache_eviction_internal);
	to->cache_eviction_split_internal +=
	    WT_STAT_READ(from, cache_eviction_split_internal);
	to->cache_eviction_split_leaf +=
	    WT_STAT_READ(from, cache_eviction_split_leaf);
	to->cache_eviction_dirty += WT_STAT_READ(from, cache_eviction_dirty);
	to->cache_read_overflow += WT_STAT_READ(from, cache_read_overflow);
	to->cache_overflow_value += WT_STAT_READ(from, cache_overflow_value);
	to->cache_eviction_deepen +=
	    WT_STAT_READ(from, cache_eviction_deepen);
	to->cache_write_lookaside +=
	    WT_STAT_READ(from, cache_write_lookaside);
	to->cache_read += WT_STAT_READ(from, cache_read);
	to->cache_read_lookaside += WT_STAT_READ(from, cache_read_lookaside);
	to->cache_pages_requested +=
	    WT_STAT_READ(from, cache_pages_requested);
	to->cache_write += WT_STAT_READ(from, cache_write);
	to->cache_write_restore += WT_STAT_READ(from, cache_write_restore);
	to->cache_eviction_clean += WT_STAT_READ(from, cache_eviction_clean);
	to->compress_read += WT_STAT_READ(from, compress_read);
	to->compress_write += WT_STAT_READ(from, compress_write);
	to->compress_write_fail += WT_STAT_READ(from, compress_write_fail);
	to->compress_write_too_small +=
	    WT_STAT_READ(from, compress_write_too_small);
	to->compress_raw_fail_temporary +=
	    WT_STAT_READ(from, compress_raw_fail_temporary);
	to->compress_raw_fail += WT_STAT_READ(from, compress_raw_fail);
	to->compress_raw_ok += WT_STAT_READ(from, compress_raw_ok);
	to->cursor_insert_bulk += WT_STAT_READ(from, cursor_insert_bulk);
	to->cursor_create += WT_STAT_READ(from, cursor_create);
	to->cursor_insert_bytes += WT_STAT_READ(from, cursor_insert_bytes);
	to->cursor_remove_bytes += WT_STAT_READ(from, cursor_remove_bytes);
	to->cursor_update_bytes += WT_STAT_READ(from, cursor_update_bytes);
	to->cursor_insert += WT_STAT_READ(from, cursor_insert);
	to->cursor_next += WT_STAT_READ(from, cursor_next);
	to->cursor_prev += WT_STAT_READ(from, cursor_prev);
	to->cursor_remove += WT_STAT_READ(from, cursor_remove);
	to->cursor_reset += WT_STAT_READ(from, cursor_reset);
	to->cursor_restart += WT_STAT_READ(from, cursor_restart);
	to->cursor_search += WT_STAT_READ(from, cursor_search);
	to->cursor_search_near += WT_STAT_READ(from, cursor_search_near);
	to->cursor_truncate += WT_STAT_READ(from, cursor_truncate);
	to->cursor_update += WT_STAT_READ(from, cursor_update);
	to->rec_dictionary += WT_STAT_READ(from, rec_dictionary);
	to->rec_page_delete_fast += WT_STAT_READ(from, rec_page_delete_fast);
	to->rec_suffix_compression +=
	    WT_STAT_READ(from, rec_suffix_compression);
	to->rec_multiblock_internal +=
	    WT_STAT_READ(from, rec_multiblock_internal);
	to->rec_overflow_key_internal +=
	    WT_STAT_READ(from, rec_overflow_key_internal);
	to->rec_prefix_compression +=
	    WT_STAT_READ(from, rec_prefix_compression);
	to->rec_multiblock_leaf += WT_STAT_READ(from, rec_multiblock_leaf);
	to->rec_overflow_key_leaf +=
	    WT_STAT_READ(from, rec_overflow_key_leaf);
	if ((v = WT_STAT_READ(from, rec_multiblock_max)) >
	    to->rec_multiblock_max)
		to->rec_multiblock_max = v;
	to->rec_overflow_value += WT_STAT_READ(from, rec_overflow_value);
	to->rec_page_match += WT_STAT_READ(from, rec_page_match);
	to->rec_pages += WT_STAT_READ(from, rec_pages);
	to->rec_pages_eviction += WT_STAT_READ(from, rec_pages_eviction);
	to->rec_page_delete += WT_STAT_READ(from, rec_page_delete);
	to->session_compact += WT_STAT_READ(from, session_compact);
	to->session_cursor_open += WT_STAT_READ(from, session_cursor_open);
	to->txn_update_conflict += WT_STAT_READ(from, txn_update_conflict);
}

static const char * const __stats_connection_desc[] = {
	"LSM: application work units currently queued",
	"LSM: merge work units currently queued",
	"LSM: rows merged in an LSM tree",
	"LSM: sleep for LSM checkpoint throttle",
	"LSM: sleep for LSM merge throttle",
	"LSM: switch work units currently queued",
	"LSM: tree maintenance operations discarded",
	"LSM: tree maintenance operations executed",
	"LSM: tree maintenance operations scheduled",
	"LSM: tree queue hit maximum",
	"async: current work queue length",
	"async: maximum work queue length",
	"async: number of allocation state races",
	"async: number of flush calls",
	"async: number of operation slots viewed for allocation",
	"async: number of times operation allocation failed",
	"async: number of times worker found no work",
	"async: total allocations",
	"async: total compact calls",
	"async: total insert calls",
	"async: total remove calls",
	"async: total search calls",
	"async: total update calls",
	"block-manager: blocks pre-loaded",
	"block-manager: blocks read",
	"block-manager: blocks written",
	"block-manager: bytes read",
	"block-manager: bytes written",
	"block-manager: bytes written for checkpoint",
	"block-manager: mapped blocks read",
	"block-manager: mapped bytes read",
	"cache: bytes belonging to page images in the cache",
	"cache: bytes currently in the cache",
	"cache: bytes not belonging to page images in the cache",
	"cache: bytes read into cache",
	"cache: bytes written from cache",
	"cache: checkpoint blocked page eviction",
	"cache: eviction calls to get a page",
	"cache: eviction calls to get a page found queue empty",
	"cache: eviction calls to get a page found queue empty after locking",
	"cache: eviction currently operating in aggressive mode",
	"cache: eviction empty score",
	"cache: eviction server candidate queue empty when topping up",
	"cache: eviction server candidate queue not empty when topping up",
	"cache: eviction server evicting pages",
	"cache: eviction server slept, because we did not make progress with eviction",
	"cache: eviction server unable to reach eviction goal",
	"cache: eviction state",
	"cache: eviction walks abandoned",
	"cache: eviction worker thread evicting pages",
	"cache: failed eviction of pages that exceeded the in-memory maximum",
	"cache: files with active eviction walks",
	"cache: files with new eviction walks started",
	"cache: hazard pointer blocked page eviction",
	"cache: hazard pointer check calls",
	"cache: hazard pointer check entries walked",
	"cache: hazard pointer maximum array length",
	"cache: in-memory page passed criteria to be split",
	"cache: in-memory page splits",
	"cache: internal pages evicted",
	"cache: internal pages split during eviction",
	"cache: leaf pages split during eviction",
	"cache: lookaside table insert calls",
	"cache: lookaside table remove calls",
	"cache: maximum bytes configured",
	"cache: maximum page size at eviction",
	"cache: modified pages evicted",
	"cache: modified pages evicted by application threads",
	"cache: overflow pages read into cache",
	"cache: overflow values cached in memory",
	"cache: page split during eviction deepened the tree",
	"cache: page written requiring lookaside records",
	"cache: pages currently held in the cache",
	"cache: pages evicted because they exceeded the in-memory maximum",
	"cache: pages evicted because they had chains of deleted items",
	"cache: pages evicted by application threads",
	"cache: pages queued for eviction",
	"cache: pages queued for urgent eviction",
	"cache: pages queued for urgent eviction during walk",
	"cache: pages read into cache",
	"cache: pages read into cache requiring lookaside entries",
	"cache: pages requested from the cache",
	"cache: pages seen by eviction walk",
	"cache: pages selected for eviction unable to be evicted",
	"cache: pages walked for eviction",
	"cache: pages written from cache",
	"cache: pages written requiring in-memory restoration",
	"cache: percentage overhead",
	"cache: tracked bytes belonging to internal pages in the cache",
	"cache: tracked bytes belonging to leaf pages in the cache",
	"cache: tracked dirty bytes in the cache",
	"cache: tracked dirty pages in the cache",
	"cache: unmodified pages evicted",
	"connection: auto adjusting condition resets",
	"connection: auto adjusting condition wait calls",
	"connection: files currently open",
	"connection: memory allocations",
	"connection: memory frees",
	"connection: memory re-allocations",
	"connection: pthread mutex condition wait calls",
	"connection: pthread mutex shared lock read-lock calls",
	"connection: pthread mutex shared lock write-lock calls",
	"connection: total fsync I/Os",
	"connection: total read I/Os",
	"connection: total write I/Os",
	"cursor: cursor create calls",
	"cursor: cursor insert calls",
	"cursor: cursor next calls",
	"cursor: cursor prev calls",
	"cursor: cursor remove calls",
	"cursor: cursor reset calls",
	"cursor: cursor restarted searches",
	"cursor: cursor search calls",
	"cursor: cursor search near calls",
	"cursor: cursor update calls",
	"cursor: truncate calls",
	"data-handle: connection data handles currently active",
	"data-handle: connection sweep candidate became referenced",
	"data-handle: connection sweep dhandles closed",
	"data-handle: connection sweep dhandles removed from hash list",
	"data-handle: connection sweep time-of-death sets",
	"data-handle: connection sweeps",
	"data-handle: session dhandles swept",
	"data-handle: session sweep attempts",
	"log: busy returns attempting to switch slots",
	"log: consolidated slot closures",
	"log: consolidated slot join races",
	"log: consolidated slot join transitions",
	"log: consolidated slot joins",
	"log: consolidated slot unbuffered writes",
	"log: log bytes of payload data",
	"log: log bytes written",
	"log: log files manually zero-filled",
	"log: log flush operations",
	"log: log force write operations",
	"log: log force write operations skipped",
	"log: log records compressed",
	"log: log records not compressed",
	"log: log records too small to compress",
	"log: log release advances write LSN",
	"log: log scan operations",
	"log: log scan records requiring two reads",
	"log: log server thread advances write LSN",
	"log: log server thread write LSN walk skipped",
	"log: log sync operations",
	"log: log sync time duration (usecs)",
	"log: log sync_dir operations",
	"log: log sync_dir time duration (usecs)",
	"log: log write operations",
	"log: logging bytes consolidated",
	"log: maximum log file size",
	"log: number of pre-allocated log files to create",
	"log: pre-allocated log files not ready and missed",
	"log: pre-allocated log files prepared",
	"log: pre-allocated log files used",
	"log: records processed by log scan",
	"log: total in-memory size of compressed records",
	"log: total log buffer size",
	"log: total size of compressed records",
	"log: written slots coalesced",
	"log: yields waiting for previous log file close",
	"reconciliation: fast-path pages deleted",
	"reconciliation: page reconciliation calls",
	"reconciliation: page reconciliation calls for eviction",
	"reconciliation: pages deleted",
	"reconciliation: split bytes currently awaiting free",
	"reconciliation: split objects currently awaiting free",
	"session: open cursor count",
	"session: open session count",
	"session: table compact failed calls",
	"session: table compact successful calls",
	"session: table create failed calls",
	"session: table create successful calls",
	"session: table drop failed calls",
	"session: table drop successful calls",
	"session: table rebalance failed calls",
	"session: table rebalance successful calls",
	"session: table rename failed calls",
	"session: table rename successful calls",
	"session: table salvage failed calls",
	"session: table salvage successful calls",
	"session: table truncate failed calls",
	"session: table truncate successful calls",
	"session: table verify failed calls",
	"session: table verify successful calls",
	"thread-state: active filesystem fsync calls",
	"thread-state: active filesystem read calls",
	"thread-state: active filesystem write calls",
	"thread-yield: page acquire busy blocked",
	"thread-yield: page acquire eviction blocked",
	"thread-yield: page acquire locked blocked",
	"thread-yield: page acquire read blocked",
	"thread-yield: page acquire time sleeping (usecs)",
	"transaction: number of named snapshots created",
	"transaction: number of named snapshots dropped",
	"transaction: transaction begins",
	"transaction: transaction checkpoint currently running",
	"transaction: transaction checkpoint generation",
	"transaction: transaction checkpoint max time (msecs)",
	"transaction: transaction checkpoint min time (msecs)",
	"transaction: transaction checkpoint most recent time (msecs)",
	"transaction: transaction checkpoint scrub dirty target",
	"transaction: transaction checkpoint scrub time (msecs)",
	"transaction: transaction checkpoint total time (msecs)",
	"transaction: transaction checkpoints",
	"transaction: transaction failures due to cache overflow",
	"transaction: transaction fsync calls for checkpoint after allocating the transaction ID",
	"transaction: transaction fsync duration for checkpoint after allocating the transaction ID (usecs)",
	"transaction: transaction range of IDs currently pinned",
	"transaction: transaction range of IDs currently pinned by a checkpoint",
	"transaction: transaction range of IDs currently pinned by named snapshots",
	"transaction: transaction sync calls",
	"transaction: transactions committed",
	"transaction: transactions rolled back",
};

int
__wt_stat_connection_desc(WT_CURSOR_STAT *cst, int slot, const char **p)
{
	WT_UNUSED(cst);
	*p = __stats_connection_desc[slot];
	return (0);
}

void
__wt_stat_connection_init_single(WT_CONNECTION_STATS *stats)
{
	memset(stats, 0, sizeof(*stats));
}

void
__wt_stat_connection_init(WT_CONNECTION_IMPL *handle)
{
	int i;

	for (i = 0; i < WT_COUNTER_SLOTS; ++i) {
		handle->stats[i] = &handle->stat_array[i];
		__wt_stat_connection_init_single(handle->stats[i]);
	}
}

void
__wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats)
{
		/* not clearing lsm_work_queue_app */
		/* not clearing lsm_work_queue_manager */
	stats->lsm_rows_merged = 0;
	stats->lsm_checkpoint_throttle = 0;
	stats->lsm_merge_throttle = 0;
		/* not clearing lsm_work_queue_switch */
	stats->lsm_work_units_discarded = 0;
	stats->lsm_work_units_done = 0;
	stats->lsm_work_units_created = 0;
	stats->lsm_work_queue_max = 0;
	stats->async_cur_queue = 0;
		/* not clearing async_max_queue */
	stats->async_alloc_race = 0;
	stats->async_flush = 0;
	stats->async_alloc_view = 0;
	stats->async_full = 0;
	stats->async_nowork = 0;
	stats->async_op_alloc = 0;
	stats->async_op_compact = 0;
	stats->async_op_insert = 0;
	stats->async_op_remove = 0;
	stats->async_op_search = 0;
	stats->async_op_update = 0;
	stats->block_preload = 0;
	stats->block_read = 0;
	stats->block_write = 0;
	stats->block_byte_read = 0;
	stats->block_byte_write = 0;
	stats->block_byte_write_checkpoint = 0;
	stats->block_map_read = 0;
	stats->block_byte_map_read = 0;
		/* not clearing cache_bytes_image */
		/* not clearing cache_bytes_inuse */
		/* not clearing cache_bytes_other */
	stats->cache_bytes_read = 0;
	stats->cache_bytes_write = 0;
	stats->cache_eviction_checkpoint = 0;
	stats->cache_eviction_get_ref = 0;
	stats->cache_eviction_get_ref_empty = 0;
	stats->cache_eviction_get_ref_empty2 = 0;
		/* not clearing cache_eviction_aggressive_set */
		/* not clearing cache_eviction_empty_score */
	stats->cache_eviction_queue_empty = 0;
	stats->cache_eviction_queue_not_empty = 0;
	stats->cache_eviction_server_evicting = 0;
	stats->cache_eviction_server_slept = 0;
	stats->cache_eviction_slow = 0;
		/* not clearing cache_eviction_state */
	stats->cache_eviction_walks_abandoned = 0;
	stats->cache_eviction_worker_evicting = 0;
	stats->cache_eviction_force_fail = 0;
		/* not clearing cache_eviction_walks_active */
	stats->cache_eviction_walks_started = 0;
	stats->cache_eviction_hazard = 0;
	stats->cache_hazard_checks = 0;
	stats->cache_hazard_walks = 0;
	stats->cache_hazard_max = 0;
	stats->cache_inmem_splittable = 0;
	stats->cache_inmem_split = 0;
	stats->cache_eviction_internal = 0;
	stats->cache_eviction_split_internal = 0;
	stats->cache_eviction_split_leaf = 0;
	stats->cache_lookaside_insert = 0;
	stats->cache_lookaside_remove = 0;
		/* not clearing cache_bytes_max */
		/* not clearing cache_eviction_maximum_page_size */
	stats->cache_eviction_dirty = 0;
	stats->cache_eviction_app_dirty = 0;
	stats->cache_read_overflow = 0;
	stats->cache_overflow_value = 0;
	stats->cache_eviction_deepen = 0;
	stats->cache_write_lookaside = 0;
		/* not clearing cache_pages_inuse */
	stats->cache_eviction_force = 0;
	stats->cache_eviction_force_delete = 0;
	stats->cache_eviction_app = 0;
	stats->cache_eviction_pages_queued = 0;
	stats->cache_eviction_pages_queued_urgent = 0;
	stats->cache_eviction_pages_queued_oldest = 0;
	stats->cache_read = 0;
	stats->cache_read_lookaside = 0;
	stats->cache_pages_requested = 0;
	stats->cache_eviction_pages_seen = 0;
	stats->cache_eviction_fail = 0;
	stats->cache_eviction_walk = 0;
	stats->cache_write = 0;
	stats->cache_write_restore = 0;
		/* not clearing cache_overhead */
		/* not clearing cache_bytes_internal */
		/* not clearing cache_bytes_leaf */
		/* not clearing cache_bytes_dirty */
		/* not clearing cache_pages_dirty */
	stats->cache_eviction_clean = 0;
	stats->cond_auto_wait_reset = 0;
	stats->cond_auto_wait = 0;
		/* not clearing file_open */
	stats->memory_allocation = 0;
	stats->memory_free = 0;
	stats->memory_grow = 0;
	stats->cond_wait = 0;
	stats->rwlock_read = 0;
	stats->rwlock_write = 0;
	stats->fsync_io = 0;
	stats->read_io = 0;
	stats->write_io = 0;
	stats->cursor_create = 0;
	stats->cursor_insert = 0;
	stats->cursor_next = 0;
	stats->cursor_prev = 0;
	stats->cursor_remove = 0;
	stats->cursor_reset = 0;
	stats->cursor_restart = 0;
	stats->cursor_search = 0;
	stats->cursor_search_near = 0;
	stats->cursor_update = 0;
	stats->cursor_truncate = 0;
		/* not clearing dh_conn_handle_count */
	stats->dh_sweep_ref = 0;
	stats->dh_sweep_close = 0;
	stats->dh_sweep_remove = 0;
	stats->dh_sweep_tod = 0;
	stats->dh_sweeps = 0;
	stats->dh_session_handles = 0;
	stats->dh_session_sweeps = 0;
	stats->log_slot_switch_busy = 0;
	stats->log_slot_closes = 0;
	stats->log_slot_races = 0;
	stats->log_slot_transitions = 0;
	stats->log_slot_joins = 0;
	stats->log_slot_unbuffered = 0;
	stats->log_bytes_payload = 0;
	stats->log_bytes_written = 0;
	stats->log_zero_fills = 0;
	stats->log_flush = 0;
	stats->log_force_write = 0;
	stats->log_force_write_skip = 0;
	stats->log_compress_writes = 0;
	stats->log_compress_write_fails = 0;
	stats->log_compress_small = 0;
	stats->log_release_write_lsn = 0;
	stats->log_scans = 0;
	stats->log_scan_rereads = 0;
	stats->log_write_lsn = 0;
	stats->log_write_lsn_skip = 0;
	stats->log_sync = 0;
		/* not clearing log_sync_duration */
	stats->log_sync_dir = 0;
		/* not clearing log_sync_dir_duration */
	stats->log_writes = 0;
	stats->log_slot_consolidated = 0;
		/* not clearing log_max_filesize */
		/* not clearing log_prealloc_max */
	stats->log_prealloc_missed = 0;
	stats->log_prealloc_files = 0;
	stats->log_prealloc_used = 0;
	stats->log_scan_records = 0;
	stats->log_compress_mem = 0;
		/* not clearing log_buffer_size */
	stats->log_compress_len = 0;
	stats->log_slot_coalesced = 0;
	stats->log_close_yields = 0;
	stats->rec_page_delete_fast = 0;
	stats->rec_pages = 0;
	stats->rec_pages_eviction = 0;
	stats->rec_page_delete = 0;
		/* not clearing rec_split_stashed_bytes */
		/* not clearing rec_split_stashed_objects */
		/* not clearing session_cursor_open */
		/* not clearing session_open */
		/* not clearing session_table_compact_fail */
		/* not clearing session_table_compact_success */
		/* not clearing session_table_create_fail */
		/* not clearing session_table_create_success */
		/* not clearing session_table_drop_fail */
		/* not clearing session_table_drop_success */
		/* not clearing session_table_rebalance_fail */
		/* not clearing session_table_rebalance_success */
		/* not clearing session_table_rename_fail */
		/* not clearing session_table_rename_success */
		/* not clearing session_table_salvage_fail */
		/* not clearing session_table_salvage_success */
		/* not clearing session_table_truncate_fail */
		/* not clearing session_table_truncate_success */
		/* not clearing session_table_verify_fail */
		/* not clearing session_table_verify_success */
		/* not clearing thread_fsync_active */
		/* not clearing thread_read_active */
		/* not clearing thread_write_active */
	stats->page_busy_blocked = 0;
	stats->page_forcible_evict_blocked = 0;
	stats->page_locked_blocked = 0;
	stats->page_read_blocked = 0;
	stats->page_sleep = 0;
	stats->txn_snapshots_created = 0;
	stats->txn_snapshots_dropped = 0;
	stats->txn_begin = 0;
		/* not clearing txn_checkpoint_running */
		/* not clearing txn_checkpoint_generation */
		/* not clearing txn_checkpoint_time_max */
		/* not clearing txn_checkpoint_time_min */
		/* not clearing txn_checkpoint_time_recent */
		/* not clearing txn_checkpoint_scrub_target */
		/* not clearing txn_checkpoint_scrub_time */
		/* not clearing txn_checkpoint_time_total */
	stats->txn_checkpoint = 0;
	stats->txn_fail_cache = 0;
	stats->txn_checkpoint_fsync_post = 0;
		/* not clearing txn_checkpoint_fsync_post_duration */
		/* not clearing txn_pinned_range */
		/* not clearing txn_pinned_checkpoint_range */
		/* not clearing txn_pinned_snapshot_range */
	stats->txn_sync = 0;
	stats->txn_commit = 0;
	stats->txn_rollback = 0;
}

void
__wt_stat_connection_clear_all(WT_CONNECTION_STATS **stats)
{
	u_int i;

	for (i = 0; i < WT_COUNTER_SLOTS; ++i)
		__wt_stat_connection_clear_single(stats[i]);
}

void
__wt_stat_connection_aggregate(
    WT_CONNECTION_STATS **from, WT_CONNECTION_STATS *to)
{
	int64_t v;

	to->lsm_work_queue_app += WT_STAT_READ(from, lsm_work_queue_app);
	to->lsm_work_queue_manager +=
	    WT_STAT_READ(from, lsm_work_queue_manager);
	to->lsm_rows_merged += WT_STAT_READ(from, lsm_rows_merged);
	to->lsm_checkpoint_throttle +=
	    WT_STAT_READ(from, lsm_checkpoint_throttle);
	to->lsm_merge_throttle += WT_STAT_READ(from, lsm_merge_throttle);
	to->lsm_work_queue_switch +=
	    WT_STAT_READ(from, lsm_work_queue_switch);
	to->lsm_work_units_discarded +=
	    WT_STAT_READ(from, lsm_work_units_discarded);
	to->lsm_work_units_done += WT_STAT_READ(from, lsm_work_units_done);
	to->lsm_work_units_created +=
	    WT_STAT_READ(from, lsm_work_units_created);
	to->lsm_work_queue_max += WT_STAT_READ(from, lsm_work_queue_max);
	to->async_cur_queue += WT_STAT_READ(from, async_cur_queue);
	to->async_max_queue += WT_STAT_READ(from, async_max_queue);
	to->async_alloc_race += WT_STAT_READ(from, async_alloc_race);
	to->async_flush += WT_STAT_READ(from, async_flush);
	to->async_alloc_view += WT_STAT_READ(from, async_alloc_view);
	to->async_full += WT_STAT_READ(from, async_full);
	to->async_nowork += WT_STAT_READ(from, async_nowork);
	to->async_op_alloc += WT_STAT_READ(from, async_op_alloc);
	to->async_op_compact += WT_STAT_READ(from, async_op_compact);
	to->async_op_insert += WT_STAT_READ(from, async_op_insert);
	to->async_op_remove += WT_STAT_READ(from, async_op_remove);
	to->async_op_search += WT_STAT_READ(from, async_op_search);
	to->async_op_update += WT_STAT_READ(from, async_op_update);
	to->block_preload += WT_STAT_READ(from, block_preload);
	to->block_read += WT_STAT_READ(from, block_read);
	to->block_write += WT_STAT_READ(from, block_write);
	to->block_byte_read += WT_STAT_READ(from, block_byte_read);
	to->block_byte_write += WT_STAT_READ(from, block_byte_write);
	to->block_byte_write_checkpoint +=
	    WT_STAT_READ(from, block_byte_write_checkpoint);
	to->block_map_read += WT_STAT_READ(from, block_map_read);
	to->block_byte_map_read += WT_STAT_READ(from, block_byte_map_read);
	to->cache_bytes_image += WT_STAT_READ(from, cache_bytes_image);
	to->cache_bytes_inuse += WT_STAT_READ(from, cache_bytes_inuse);
	to->cache_bytes_other += WT_STAT_READ(from, cache_bytes_other);
	to->cache_bytes_read += WT_STAT_READ(from, cache_bytes_read);
	to->cache_bytes_write += WT_STAT_READ(from, cache_bytes_write);
	to->cache_eviction_checkpoint +=
	    WT_STAT_READ(from, cache_eviction_checkpoint);
	to->cache_eviction_get_ref +=
	    WT_STAT_READ(from, cache_eviction_get_ref);
	to->cache_eviction_get_ref_empty +=
	    WT_STAT_READ(from, cache_eviction_get_ref_empty);
	to->cache_eviction_get_ref_empty2 +=
	    WT_STAT_READ(from, cache_eviction_get_ref_empty2);
	to->cache_eviction_aggressive_set +=
	    WT_STAT_READ(from, cache_eviction_aggressive_set);
	to->cache_eviction_empty_score +=
	    WT_STAT_READ(from, cache_eviction_empty_score);
	to->cache_eviction_queue_empty +=
	    WT_STAT_READ(from, cache_eviction_queue_empty);
	to->cache_eviction_queue_not_empty +=
	    WT_STAT_READ(from, cache_eviction_queue_not_empty);
	to->cache_eviction_server_evicting +=
	    WT_STAT_READ(from, cache_eviction_server_evicting);
	to->cache_eviction_server_slept +=
	    WT_STAT_READ(from, cache_eviction_server_slept);
	to->cache_eviction_slow += WT_STAT_READ(from, cache_eviction_slow);
	to->cache_eviction_state += WT_STAT_READ(from, cache_eviction_state);
	to->cache_eviction_walks_abandoned +=
	    WT_STAT_READ(from, cache_eviction_walks_abandoned);
	to->cache_eviction_worker_evicting +=
	    WT_STAT_READ(from, cache_eviction_worker_evicting);
	to->cache_eviction_force_fail +=
	    WT_STAT_READ(from, cache_eviction_force_fail);
	to->cache_eviction_walks_active +=
	    WT_STAT_READ(from, cache_eviction_walks_active);
	to->cache_eviction_walks_started +=
	    WT_STAT_READ(from, cache_eviction_walks_started);
	to->cache_eviction_hazard +=
	    WT_STAT_READ(from, cache_eviction_hazard);
	to->cache_hazard_checks += WT_STAT_READ(from, cache_hazard_checks);
	to->cache_hazard_walks += WT_STAT_READ(from, cache_hazard_walks);
	if ((v = WT_STAT_READ(from, cache_hazard_max)) > to->cache_hazard_max)
		to->cache_hazard_max = v;
	to->cache_inmem_splittable +=
	    WT_STAT_READ(from, cache_inmem_splittable);
	to->cache_inmem_split += WT_STAT_READ(from, cache_inmem_split);
	to->cache_eviction_internal +=
	    WT_STAT_READ(from, cache_eviction_internal);
	to->cache_eviction_split_internal +=
	    WT_STAT_READ(from, cache_eviction_split_internal);
	to->cache_eviction_split_leaf +=
	    WT_STAT_READ(from, cache_eviction_split_leaf);
	to->cache_lookaside_insert +=
	    WT_STAT_READ(from, cache_lookaside_insert);
	to->cache_lookaside_remove +=
	    WT_STAT_READ(from, cache_lookaside_remove);
	to->cache_bytes_max += WT_STAT_READ(from, cache_bytes_max);
	to->cache_eviction_maximum_page_size +=
	    WT_STAT_READ(from, cache_eviction_maximum_page_size);
	to->cache_eviction_dirty += WT_STAT_READ(from, cache_eviction_dirty);
	to->cache_eviction_app_dirty +=
	    WT_STAT_READ(from, cache_eviction_app_dirty);
	to->cache_read_overflow += WT_STAT_READ(from, cache_read_overflow);
	to->cache_overflow_value += WT_STAT_READ(from, cache_overflow_value);
	to->cache_eviction_deepen +=
	    WT_STAT_READ(from, cache_eviction_deepen);
	to->cache_write_lookaside +=
	    WT_STAT_READ(from, cache_write_lookaside);
	to->cache_pages_inuse += WT_STAT_READ(from, cache_pages_inuse);
	to->cache_eviction_force += WT_STAT_READ(from, cache_eviction_force);
	to->cache_eviction_force_delete +=
	    WT_STAT_READ(from, cache_eviction_force_delete);
	to->cache_eviction_app += WT_STAT_READ(from, cache_eviction_app);
	to->cache_eviction_pages_queued +=
	    WT_STAT_READ(from, cache_eviction_pages_queued);
	to->cache_eviction_pages_queued_urgent +=
	    WT_STAT_READ(from, cache_eviction_pages_queued_urgent);
	to->cache_eviction_pages_queued_oldest +=
	    WT_STAT_READ(from, cache_eviction_pages_queued_oldest);
	to->cache_read += WT_STAT_READ(from, cache_read);
	to->cache_read_lookaside += WT_STAT_READ(from, cache_read_lookaside);
	to->cache_pages_requested +=
	    WT_STAT_READ(from, cache_pages_requested);
	to->cache_eviction_pages_seen +=
	    WT_STAT_READ(from, cache_eviction_pages_seen);
	to->cache_eviction_fail += WT_STAT_READ(from, cache_eviction_fail);
	to->cache_eviction_walk += WT_STAT_READ(from, cache_eviction_walk);
	to->cache_write += WT_STAT_READ(from, cache_write);
	to->cache_write_restore += WT_STAT_READ(from, cache_write_restore);
	to->cache_overhead += WT_STAT_READ(from, cache_overhead);
	to->cache_bytes_internal += WT_STAT_READ(from, cache_bytes_internal);
	to->cache_bytes_leaf += WT_STAT_READ(from, cache_bytes_leaf);
	to->cache_bytes_dirty += WT_STAT_READ(from, cache_bytes_dirty);
	to->cache_pages_dirty += WT_STAT_READ(from, cache_pages_dirty);
	to->cache_eviction_clean += WT_STAT_READ(from, cache_eviction_clean);
	to->cond_auto_wait_reset += WT_STAT_READ(from, cond_auto_wait_reset);
	to->cond_auto_wait += WT_STAT_READ(from, cond_auto_wait);
	to->file_open += WT_STAT_READ(from, file_open);
	to->memory_allocation += WT_STAT_READ(from, memory_allocation);
	to->memory_free += WT_STAT_READ(from, memory_free);
	to->memory_grow += WT_STAT_READ(from, memory_grow);
	to->cond_wait += WT_STAT_READ(from, cond_wait);
	to->rwlock_read += WT_STAT_READ(from, rwlock_read);
	to->rwlock_write += WT_STAT_READ(from, rwlock_write);
	to->fsync_io += WT_STAT_READ(from, fsync_io);
	to->read_io += WT_STAT_READ(from, read_io);
	to->write_io += WT_STAT_READ(from, write_io);
	to->cursor_create += WT_STAT_READ(from, cursor_create);
	to->cursor_insert += WT_STAT_READ(from, cursor_insert);
	to->cursor_next += WT_STAT_READ(from, cursor_next);
	to->cursor_prev += WT_STAT_READ(from, cursor_prev);
	to->cursor_remove += WT_STAT_READ(from, cursor_remove);
	to->cursor_reset += WT_STAT_READ(from, cursor_reset);
	to->cursor_restart += WT_STAT_READ(from, cursor_restart);
	to->cursor_search += WT_STAT_READ(from, cursor_search);
	to->cursor_search_near += WT_STAT_READ(from, cursor_search_near);
	to->cursor_update += WT_STAT_READ(from, cursor_update);
	to->cursor_truncate += WT_STAT_READ(from, cursor_truncate);
	to->dh_conn_handle_count += WT_STAT_READ(from, dh_conn_handle_count);
	to->dh_sweep_ref += WT_STAT_READ(from, dh_sweep_ref);
	to->dh_sweep_close += WT_STAT_READ(from, dh_sweep_close);
	to->dh_sweep_remove += WT_STAT_READ(from, dh_sweep_remove);
	to->dh_sweep_tod += WT_STAT_READ(from, dh_sweep_tod);
	to->dh_sweeps += WT_STAT_READ(from, dh_sweeps);
	to->dh_session_handles += WT_STAT_READ(from, dh_session_handles);
	to->dh_session_sweeps += WT_STAT_READ(from, dh_session_sweeps);
	to->log_slot_switch_busy += WT_STAT_READ(from, log_slot_switch_busy);
	to->log_slot_closes += WT_STAT_READ(from, log_slot_closes);
	to->log_slot_races += WT_STAT_READ(from, log_slot_races);
	to->log_slot_transitions += WT_STAT_READ(from, log_slot_transitions);
	to->log_slot_joins += WT_STAT_READ(from, log_slot_joins);
	to->log_slot_unbuffered += WT_STAT_READ(from, log_slot_unbuffered);
	to->log_bytes_payload += WT_STAT_READ(from, log_bytes_payload);
	to->log_bytes_written += WT_STAT_READ(from, log_bytes_written);
	to->log_zero_fills += WT_STAT_READ(from, log_zero_fills);
	to->log_flush += WT_STAT_READ(from, log_flush);
	to->log_force_write += WT_STAT_READ(from, log_force_write);
	to->log_force_write_skip += WT_STAT_READ(from, log_force_write_skip);
	to->log_compress_writes += WT_STAT_READ(from, log_compress_writes);
	to->log_compress_write_fails +=
	    WT_STAT_READ(from, log_compress_write_fails);
	to->log_compress_small += WT_STAT_READ(from, log_compress_small);
	to->log_release_write_lsn +=
	    WT_STAT_READ(from, log_release_write_lsn);
	to->log_scans += WT_STAT_READ(from, log_scans);
	to->log_scan_rereads += WT_STAT_READ(from, log_scan_rereads);
	to->log_write_lsn += WT_STAT_READ(from, log_write_lsn);
	to->log_write_lsn_skip += WT_STAT_READ(from, log_write_lsn_skip);
	to->log_sync += WT_STAT_READ(from, log_sync);
	to->log_sync_duration += WT_STAT_READ(from, log_sync_duration);
	to->log_sync_dir += WT_STAT_READ(from, log_sync_dir);
	to->log_sync_dir_duration +=
	    WT_STAT_READ(from, log_sync_dir_duration);
	to->log_writes += WT_STAT_READ(from, log_writes);
	to->log_slot_consolidated +=
	    WT_STAT_READ(from, log_slot_consolidated);
	to->log_max_filesize += WT_STAT_READ(from, log_max_filesize);
	to->log_prealloc_max += WT_STAT_READ(from, log_prealloc_max);
	to->log_prealloc_missed += WT_STAT_READ(from, log_prealloc_missed);
	to->log_prealloc_files += WT_STAT_READ(from, log_prealloc_files);
	to->log_prealloc_used += WT_STAT_READ(from, log_prealloc_used);
	to->log_scan_records += WT_STAT_READ(from, log_scan_records);
	to->log_compress_mem += WT_STAT_READ(from, log_compress_mem);
	to->log_buffer_size += WT_STAT_READ(from, log_buffer_size);
	to->log_compress_len += WT_STAT_READ(from, log_compress_len);
	to->log_slot_coalesced += WT_STAT_READ(from, log_slot_coalesced);
	to->log_close_yields += WT_STAT_READ(from, log_close_yields);
	to->rec_page_delete_fast += WT_STAT_READ(from, rec_page_delete_fast);
	to->rec_pages += WT_STAT_READ(from, rec_pages);
	to->rec_pages_eviction += WT_STAT_READ(from, rec_pages_eviction);
	to->rec_page_delete += WT_STAT_READ(from, rec_page_delete);
	to->rec_split_stashed_bytes +=
	    WT_STAT_READ(from, rec_split_stashed_bytes);
	to->rec_split_stashed_objects +=
	    WT_STAT_READ(from, rec_split_stashed_objects);
	to->session_cursor_open += WT_STAT_READ(from, session_cursor_open);
	to->session_open += WT_STAT_READ(from, session_open);
	to->session_table_compact_fail +=
	    WT_STAT_READ(from, session_table_compact_fail);
	to->session_table_compact_success +=
	    WT_STAT_READ(from, session_table_compact_success);
	to->session_table_create_fail +=
	    WT_STAT_READ(from, session_table_create_fail);
	to->session_table_create_success +=
	    WT_STAT_READ(from, session_table_create_success);
	to->session_table_drop_fail +=
	    WT_STAT_READ(from, session_table_drop_fail);
	to->session_table_drop_success +=
	    WT_STAT_READ(from, session_table_drop_success);
	to->session_table_rebalance_fail +=
	    WT_STAT_READ(from, session_table_rebalance_fail);
	to->session_table_rebalance_success +=
	    WT_STAT_READ(from, session_table_rebalance_success);
	to->session_table_rename_fail +=
	    WT_STAT_READ(from, session_table_rename_fail);
	to->session_table_rename_success +=
	    WT_STAT_READ(from, session_table_rename_success);
	to->session_table_salvage_fail +=
	    WT_STAT_READ(from, session_table_salvage_fail);
	to->session_table_salvage_success +=
	    WT_STAT_READ(from, session_table_salvage_success);
	to->session_table_truncate_fail +=
	    WT_STAT_READ(from, session_table_truncate_fail);
	to->session_table_truncate_success +=
	    WT_STAT_READ(from, session_table_truncate_success);
	to->session_table_verify_fail +=
	    WT_STAT_READ(from, session_table_verify_fail);
	to->session_table_verify_success +=
	    WT_STAT_READ(from, session_table_verify_success);
	to->thread_fsync_active += WT_STAT_READ(from, thread_fsync_active);
	to->thread_read_active += WT_STAT_READ(from, thread_read_active);
	to->thread_write_active += WT_STAT_READ(from, thread_write_active);
	to->page_busy_blocked += WT_STAT_READ(from, page_busy_blocked);
	to->page_forcible_evict_blocked +=
	    WT_STAT_READ(from, page_forcible_evict_blocked);
	to->page_locked_blocked += WT_STAT_READ(from, page_locked_blocked);
	to->page_read_blocked += WT_STAT_READ(from, page_read_blocked);
	to->page_sleep += WT_STAT_READ(from, page_sleep);
	to->txn_snapshots_created +=
	    WT_STAT_READ(from, txn_snapshots_created);
	to->txn_snapshots_dropped +=
	    WT_STAT_READ(from, txn_snapshots_dropped);
	to->txn_begin += WT_STAT_READ(from, txn_begin);
	to->txn_checkpoint_running +=
	    WT_STAT_READ(from, txn_checkpoint_running);
	to->txn_checkpoint_generation +=
	    WT_STAT_READ(from, txn_checkpoint_generation);
	to->txn_checkpoint_time_max +=
	    WT_STAT_READ(from, txn_checkpoint_time_max);
	to->txn_checkpoint_time_min +=
	    WT_STAT_READ(from, txn_checkpoint_time_min);
	to->txn_checkpoint_time_recent +=
	    WT_STAT_READ(from, txn_checkpoint_time_recent);
	to->txn_checkpoint_scrub_target +=
	    WT_STAT_READ(from, txn_checkpoint_scrub_target);
	to->txn_checkpoint_scrub_time +=
	    WT_STAT_READ(from, txn_checkpoint_scrub_time);
	to->txn_checkpoint_time_total +=
	    WT_STAT_READ(from, txn_checkpoint_time_total);
	to->txn_checkpoint += WT_STAT_READ(from, txn_checkpoint);
	to->txn_fail_cache += WT_STAT_READ(from, txn_fail_cache);
	to->txn_checkpoint_fsync_post +=
	    WT_STAT_READ(from, txn_checkpoint_fsync_post);
	to->txn_checkpoint_fsync_post_duration +=
	    WT_STAT_READ(from, txn_checkpoint_fsync_post_duration);
	to->txn_pinned_range += WT_STAT_READ(from, txn_pinned_range);
	to->txn_pinned_checkpoint_range +=
	    WT_STAT_READ(from, txn_pinned_checkpoint_range);
	to->txn_pinned_snapshot_range +=
	    WT_STAT_READ(from, txn_pinned_snapshot_range);
	to->txn_sync += WT_STAT_READ(from, txn_sync);
	to->txn_commit += WT_STAT_READ(from, txn_commit);
	to->txn_rollback += WT_STAT_READ(from, txn_rollback);
}

static const char * const __stats_join_desc[] = {
	": accesses to the main table",
	": bloom filter false positives",
	": checks that conditions of membership are satisfied",
	": items inserted into a bloom filter",
	": items iterated",
};

int
__wt_stat_join_desc(WT_CURSOR_STAT *cst, int slot, const char **p)
{
	WT_UNUSED(cst);
	*p = __stats_join_desc[slot];
	return (0);
}

void
__wt_stat_join_init_single(WT_JOIN_STATS *stats)
{
	memset(stats, 0, sizeof(*stats));
}

void
__wt_stat_join_clear_single(WT_JOIN_STATS *stats)
{
	stats->main_access = 0;
	stats->bloom_false_positive = 0;
	stats->membership_check = 0;
	stats->bloom_insert = 0;
	stats->iterated = 0;
}

void
__wt_stat_join_clear_all(WT_JOIN_STATS **stats)
{
	u_int i;

	for (i = 0; i < WT_COUNTER_SLOTS; ++i)
		__wt_stat_join_clear_single(stats[i]);
}

void
__wt_stat_join_aggregate(
    WT_JOIN_STATS **from, WT_JOIN_STATS *to)
{
	to->main_access += WT_STAT_READ(from, main_access);
	to->bloom_false_positive += WT_STAT_READ(from, bloom_false_positive);
	to->membership_check += WT_STAT_READ(from, membership_check);
	to->bloom_insert += WT_STAT_READ(from, bloom_insert);
	to->iterated += WT_STAT_READ(from, iterated);
}