Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3f093f5ddc36
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1fad02514dfa
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Jun 6, 2016

  1. Copy the full SHA
    e8e91f9 View commit details
  2. Copy the full SHA
    5a42fe7 View commit details
  3. Copy the full SHA
    1fad025 View commit details
Showing with 45 additions and 8 deletions.
  1. +35 −7 mx.jruby/mx_jruby.py
  2. +10 −1 tool/jt.rb
42 changes: 35 additions & 7 deletions mx.jruby/mx_jruby.py
Original file line number Diff line number Diff line change
@@ -133,10 +133,10 @@ def runArgs(self, bmSuiteArgs):
def run(self, benchmarks, bmSuiteArgs):
def fixUpResult(result):
result.update({
'host-vm': os.environ['HOST_VM'],
'host-vm-config': os.environ['HOST_VM_CONFIG'],
'guest-vm': os.environ['GUEST_VM'],
'guest-vm-config': os.environ['GUEST_VM_CONFIG']
'host-vm': os.environ.get('HOST_VM', 'host-vm'),
'host-vm-config': os.environ.get('HOST_VM_CONFIG', 'host-vm-config'),
'guest-vm': os.environ.get('GUEST_VM', 'guest-vm'),
'guest-vm-config': os.environ.get('GUEST_VM_CONFIG', 'guest-vm-config')
})
return result

@@ -145,7 +145,7 @@ def fixUpResult(result):
def runBenchmark(self, benchmark, bmSuiteArgs):
raise NotImplementedError()

allocation_benchmarks = {
metrics_benchmarks = {
'hello': ['-e', "puts 'hello'"]
}

@@ -154,14 +154,14 @@ def name(self):
return 'allocation'

def benchmarks(self):
return allocation_benchmarks.keys()
return metrics_benchmarks.keys()

def runBenchmark(self, benchmark, bmSuiteArgs):
out = mx.OutputCapture()

options = []

jt(['metrics', 'alloc', '--json'] + allocation_benchmarks[benchmark] + bmSuiteArgs, out=out)
jt(['metrics', 'alloc', '--json'] + metrics_benchmarks[benchmark] + bmSuiteArgs, out=out)

data = json.loads(out.data)

@@ -177,4 +177,32 @@ def runBenchmark(self, benchmark, bmSuiteArgs):

return result

class MinHeapBenchmarkSuite(RubyBenchmarkSuite):
def name(self):
return 'minheap'

def benchmarks(self):
return metrics_benchmarks.keys()

def runBenchmark(self, benchmark, bmSuiteArgs):
out = mx.OutputCapture()

options = []

jt(['metrics', 'minheap', '--json'] + metrics_benchmarks[benchmark] + bmSuiteArgs, out=out)

data = json.loads(out.data)

result = {
'benchmark': benchmark,
'metric.name': 'memory',
'metric.value': data['min'],
'metric.unit': 'MB',
'metric.better': 'lower',
'extra.metric.human': data['human']
}

return result

mx_benchmark.add_bm_suite(AllocationBenchmarkSuite())
mx_benchmark.add_bm_suite(MinHeapBenchmarkSuite())
11 changes: 10 additions & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -802,6 +802,7 @@ def memory_allocated(trace)
end

def metrics_minheap(*args)
use_json = args.delete '--json'
heap = 10
Utilities.log '>', "Trying #{heap} MB\n"
until can_run_in_heap(heap, *args)
@@ -826,7 +827,15 @@ def metrics_minheap(*args)
end
end
Utilities.log "\n", nil
puts "#{heap} MB"
human_readable = "#{heap} MB"
if use_json
puts JSON.generate({
min: heap,
human: human_readable
})
else
puts human_readable
end
end

def can_run_in_heap(heap, *command)