summaryrefslogtreecommitdiff
path: root/dist/stat.py
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-11-19 09:30:46 -0500
committerKeith Bostic <keith@wiredtiger.com>2013-11-19 09:30:46 -0500
commit27049022640f17f31bd4ded4a5719603b558608d (patch)
treebc684834a4a62270a6e2c0f14aae4bbe0339d3a4 /dist/stat.py
parent97795b99ff0b1213f482fcb9003f6bb5fb4a974d (diff)
downloadmongo-27049022640f17f31bd4ded4a5719603b558608d.tar.gz
Give statistics' integer IDs separate namespaces.
Close #766.
Diffstat (limited to 'dist/stat.py')
-rw-r--r--dist/stat.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/dist/stat.py b/dist/stat.py
index e6021cab18d..783f2f191f2 100644
--- a/dist/stat.py
+++ b/dist/stat.py
@@ -8,11 +8,13 @@ from dist import source_paths_list
# Read the source files.
from stat_data import dsrc_stats, connection_stats
-def print_struct(title, name, stats):
+def print_struct(title, name, base, stats):
'''Print the structures for the stat.h file.'''
f.write('/*\n')
f.write(' * Statistics entries for ' + title + '.\n')
f.write(' */\n')
+ f.write(
+ '#define\tWT_' + name.upper() + '_STATS_BASE\t' + str(base) + '\n')
f.write('struct __wt_' + name + '_stats {\n')
for l in stats:
@@ -32,8 +34,9 @@ for line in open('../src/include/stat.h', 'r'):
elif line.count('Statistics section: BEGIN'):
f.write('\n')
skip = 1
- print_struct('data sources', 'dsrc', dsrc_stats)
- print_struct('connections', 'connection', connection_stats)
+ print_struct(
+ 'connections', 'connection', 1000, connection_stats)
+ print_struct('data sources', 'dsrc', 2000, dsrc_stats)
f.close()
compare_srcfile(tmp_file, '../src/include/stat.h')
@@ -50,7 +53,7 @@ def print_defines():
* @{
*/
''')
- for v, l in enumerate(connection_stats):
+ for v, l in enumerate(connection_stats, 1000):
f.write('/*! %s */\n' % '\n * '.join(textwrap.wrap(l.desc, 70)))
f.write('#define\tWT_STAT_CONN_' + l.name.upper() + "\t" *
max(1, 6 - int((len('WT_STAT_CONN_' + l.name)) / 8)) +
@@ -63,7 +66,7 @@ def print_defines():
* @{
*/
''')
- for v, l in enumerate(dsrc_stats):
+ for v, l in enumerate(dsrc_stats, 2000):
f.write('/*! %s */\n' % '\n * '.join(textwrap.wrap(l.desc, 70)))
f.write('#define\tWT_STAT_DSRC_' + l.name.upper() + "\t" *
max(1, 6 - int((len('WT_STAT_DSRC_' + l.name)) / 8)) +