diff options
author | Luke Chen <luke.chen@mongodb.com> | 2018-11-21 11:29:32 +1100 |
---|---|---|
committer | Luke Chen <luke.chen@mongodb.com> | 2018-11-21 11:29:32 +1100 |
commit | 820e9411adda1ba8da5909317bac7a9229f49efe (patch) | |
tree | 094a90e10912196dcf68da7e79333bdce498b36b /src/third_party/wiredtiger/dist/stat.py | |
parent | 51e3648d02cc25c95fa72af13c766690956110bc (diff) | |
download | mongo-820e9411adda1ba8da5909317bac7a9229f49efe.tar.gz |
Import wiredtiger: a065c83d8dd73d1c0199f742d6ee15d73c7e1394 from branch mongodb-4.2
ref: fe4a3f763b..a065c83d8d
for: 4.1.6
WT-4372 For throughput testing, create a standard metric to measure latency smoothness
WT-4378 Create new auto functions and cursor for session level statistics
WT-4403 Add statistic tracking accumulated dirty cache
WT-4405 Fix cursor next and prev for prepared transactions
WT-4409 Fix workgen throttling
Diffstat (limited to 'src/third_party/wiredtiger/dist/stat.py')
-rw-r--r-- | src/third_party/wiredtiger/dist/stat.py | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/src/third_party/wiredtiger/dist/stat.py b/src/third_party/wiredtiger/dist/stat.py index bb9048395e1..dfea67d8e21 100644 --- a/src/third_party/wiredtiger/dist/stat.py +++ b/src/third_party/wiredtiger/dist/stat.py @@ -5,7 +5,8 @@ import re, string, sys, textwrap from dist import compare_srcfile # Read the source files. -from stat_data import groups, dsrc_stats, connection_stats, join_stats +from stat_data import groups, dsrc_stats, connection_stats, join_stats, \ + session_stats def print_struct(title, name, base, stats): '''Print the structures for the stat.h file.''' @@ -36,6 +37,7 @@ for line in open('../src/include/stat.h', 'r'): 'connections', 'connection', 1000, connection_stats) print_struct('data sources', 'dsrc', 2000, dsrc_stats) print_struct('join cursors', 'join', 3000, join_stats) + print_struct('session', 'session', 4000, session_stats) f.close() compare_srcfile(tmp_file, '../src/include/stat.h') @@ -90,6 +92,15 @@ def print_defines(): */ ''') print_defines_one('JOIN', 3000, join_stats) + f.write(''' +/*! + * @} + * @name Statistics for session + * @anchor statistics_session + * @{ + */ +''') + print_defines_one('SESSION', 4000, session_stats) f.write('/*! @} */\n') # Update the #defines in the wiredtiger.in file. @@ -175,7 +186,8 @@ __wt_stat_''' + name + '_clear_single(WT_' + name.upper() + '''_STATS *stats) f.write('\tstats->' + l.name + ' = 0;\n') f.write('}\n') - f.write(''' + if name != 'session': + f.write(''' void __wt_stat_''' + name + '_clear_all(WT_' + name.upper() + '''_STATS **stats) { @@ -205,32 +217,34 @@ __wt_stat_''' + name + '''_aggregate_single( f.write(o) f.write('}\n') - f.write(''' + if name != 'session': + f.write(''' void __wt_stat_''' + name + '''_aggregate( WT_''' + name.upper() + '_STATS **from, WT_' + name.upper() + '''_STATS *to) { ''') - # Connection level aggregation does not currently have any computation - # of a maximum value; I'm leaving in support for it, but don't declare - # a temporary variable until it's needed. - for l in statlist: - if 'max_aggregate' in l.flags: - f.write('\tint64_t v;\n\n') - break; - for l in statlist: - if 'max_aggregate' in l.flags: - o = '\tif ((v = WT_STAT_READ(from, ' + l.name + ')) > ' +\ - 'to->' + l.name + ')\n' - if len(o) > 72: # Account for the leading tab. - o = o.replace(' > ', ' >\n\t ') - o +='\t\tto->' + l.name + ' = v;\n' - else: - o = '\tto->' + l.name + ' += WT_STAT_READ(from, ' + l.name + ');\n' - if len(o) > 72: # Account for the leading tab. - o = o.replace(' += ', ' +=\n\t ') - f.write(o) - f.write('}\n') + # Connection level aggregation does not currently have any computation + # of a maximum value; I'm leaving in support for it, but don't declare + # a temporary variable until it's needed. + for l in statlist: + if 'max_aggregate' in l.flags: + f.write('\tint64_t v;\n\n') + break; + for l in statlist: + if 'max_aggregate' in l.flags: + o = '\tif ((v = WT_STAT_READ(from, ' + l.name + ')) > ' +\ + 'to->' + l.name + ')\n' + if len(o) > 72: # Account for the leading tab. + o = o.replace(' > ', ' >\n\t ') + o +='\t\tto->' + l.name + ' = v;\n' + else: + o = '\tto->' + l.name + ' += WT_STAT_READ(from, ' + l.name +\ + ');\n' + if len(o) > 72: # Account for the leading tab. + o = o.replace(' += ', ' +=\n\t ') + f.write(o) + f.write('}\n') # Write the stat initialization and refresh routines to the stat.c file. f = open(tmp_file, 'w') @@ -240,5 +254,6 @@ f.write('#include "wt_internal.h"\n') print_func('dsrc', 'WT_DATA_HANDLE', dsrc_stats) print_func('connection', 'WT_CONNECTION_IMPL', connection_stats) print_func('join', None, join_stats) +print_func('session', None, session_stats) f.close() compare_srcfile(tmp_file, '../src/support/stat.c') |