Skip to content

Commit

Permalink
#77: see depth 12 stacks in nightly benchmarks profiler output (still…
Browse files Browse the repository at this point in the history
… 1 for interactive benchmarks); also print the full command-line executed to aggregate all search JFR results
  • Loading branch information
mikemccand committed Jan 12, 2021
1 parent de5ee06 commit 55d98a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 17 additions & 9 deletions src/python/competition.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import random
import searchBench
import subprocess
import time

class Data(object):

Expand Down Expand Up @@ -249,20 +250,27 @@ def __init__(self, name, checkout,
self.javacCommand = javacCommand
self.concurrentSearches = concurrentSearches

def getAggregateProfilerResult(self, id, mode):
def getAggregateProfilerResult(self, id, mode, count=30, stackSize=1):
if mode not in ('cpu', 'heap'):
raise ValueError(f'mode must be "cpu" or "heap" but got: {mode}')

result = subprocess.run(constants.JAVA_COMMAND.split(' ') +
['-cp',
f'{benchUtil.checkoutToPath(self.checkout)}/buildSrc/build/classes/java/main',
f'-Dtests.profile.mode={mode}',
'-Dtests.profile.count=30',
'org.apache.lucene.gradle.ProfileResults'] +
glob.glob(f'{constants.BENCH_BASE_DIR}/bench-search-{id}-{self.name}-*.jfr'),

command = constants.JAVA_COMMAND.split(' ') + \
['-cp',
f'{benchUtil.checkoutToPath(self.checkout)}/buildSrc/build/classes/java/main',
f'-Dtests.profile.mode={mode}',
f'-Dtests.profile.stacksize={stackSize}',
f'-Dtests.profile.count={count}',
'org.apache.lucene.gradle.ProfileResults'] +
glob.glob(f'{constants.BENCH_BASE_DIR}/bench-search-{id}-{self.name}-*.jfr')

print(f'JFR aggregation command: {' '.join(command)}')
t0 = time.time()
result = subprocess.run(command,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
check = True)
t1 = time.time()
print(f'Took {t1-t0:.2f} seconds')
return result.stdout.decode('utf-8')

def compile(self, cp):
Expand Down
4 changes: 2 additions & 2 deletions src/python/nightlyBench.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,13 +988,13 @@ def run():
w('<br><br><h2>Profiler results</h2>\n')
w('<b>CPU:<b><br>')
w('<pre>\n')
w(comp.getAggregateProfilerResult(id, 'cpu'))
w(comp.getAggregateProfilerResult(id, 'cpu', stackSize=12, count=50))
w('</pre>')

w('<br><br>')
w('<b>HEAP:<b><br>')
w('<pre>\n')
w(comp.getAggregateProfilerResult(id, 'heap'))
w(comp.getAggregateProfilerResult(id, 'heap', stackSize=12, count=50))
w('</pre>')
w('</html>\n')

Expand Down

0 comments on commit 55d98a7

Please sign in to comment.