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: ac595959741f
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6ab9dd220564
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jul 1, 2016

  1. Copy the full SHA
    6ab9dd2 View commit details
Showing with 103 additions and 1 deletion.
  1. +17 −1 ci.hocon
  2. +86 −0 mx.jruby/mx_jruby.py
18 changes: 17 additions & 1 deletion ci.hocon
Original file line number Diff line number Diff line change
@@ -214,6 +214,16 @@ micro-benchmarks: {
] ${post-process-and-upload-results}
}

server-benchmarks: {
packages: {
"apache/ab": ">=2.3"
}

run: ${setup-benchmarks} [
[mx, benchmark, server]
] ${post-process-and-upload-results}
}

builds: [
{name: ruby-test-fast} ${common} ${gate-caps} {run: [${jt} [test, fast]]},
{name: ruby-test-specs-command-line} ${common} ${gate-caps} {run: [${jt} [test, specs, ":command_line"]]},
@@ -269,5 +279,11 @@ builds: [
{name: ruby-benchmarks-micro-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${micro-benchmarks},
{name: ruby-benchmarks-micro-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${micro-benchmarks},
{name: ruby-benchmarks-micro-graal-enterprise} ${common} ${graal-enterprise} ${bench-caps} ${jruby-truffle} ${micro-benchmarks},
{name: ruby-benchmarks-micro-graal-vm} ${common} ${graal-vm} ${daily-bench-caps} ${jruby-truffle} ${micro-benchmarks}
{name: ruby-benchmarks-micro-graal-vm} ${common} ${graal-vm} ${daily-bench-caps} ${jruby-truffle} ${micro-benchmarks},

{name: ruby-benchmarks-server-noindy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-noindy-benchmark} ${server-benchmarks},
{name: ruby-benchmarks-server-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${server-benchmarks},
{name: ruby-benchmarks-server-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${server-benchmarks},
{name: ruby-benchmarks-server-graal-enterprise} ${common} ${graal-enterprise} ${bench-caps} ${jruby-truffle} ${server-benchmarks},
{name: ruby-benchmarks-server-graal-vm} ${common} ${graal-vm} ${daily-bench-caps} ${jruby-truffle} ${server-benchmarks}
]
86 changes: 86 additions & 0 deletions mx.jruby/mx_jruby.py
Original file line number Diff line number Diff line change
@@ -9,8 +9,11 @@
import sys
import os
import subprocess
import pipes
import shutil
import json
import time
from threading import Thread

import mx
import mx_benchmark
@@ -22,6 +25,32 @@ def jt(args, suite=None, nonZeroIsFatal=True, out=None, err=None, timeout=None,
jt = os.path.join(rubyDir, 'tool', 'jt.rb')
return mx.run(['ruby', jt] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, timeout=timeout, env=env, cwd=cwd)

FNULL = open(os.devnull, 'w')

class BackgroundServerTask:
def __init__(self, args):
self.args = args

def __enter__(self):
preexec_fn, creationflags = mx._get_new_progress_group_args()
if mx._opts.verbose:
mx.log(' '.join(['(background)'] + map(pipes.quote, self.args)))
self.process = subprocess.Popen(self.args, preexec_fn=preexec_fn, creationflags=creationflags, stdout=FNULL, stderr=FNULL)
mx._addSubprocess(self.process, self.args)

def __exit__(self, type, value, traceback):
self.process.kill()
self.process.wait()

def is_running(self):
return self.process.poll() is None

class BackgroundJT(BackgroundServerTask):
def __init__(self, args):
rubyDir = _suite.dir
jt = os.path.join(rubyDir, 'tool', 'jt.rb')
BackgroundServerTask.__init__(self, ['ruby', jt] + args)

class MavenProject(mx.Project):
def __init__(self, suite, name, deps, workingSets, theLicense, **args):
mx.Project.__init__(self, suite, name, "", [], deps, workingSets, _suite.dir, theLicense)
@@ -529,6 +558,62 @@ def benchmarks(self):
def time(self):
return micro_benchmark_time

server_benchmarks = [
'tcp-server',
'webrick'
]

server_benchmark_time = 60 * 4 # Seems unstable otherwise

class ServerBenchmarkSuite(RubyBenchmarkSuite):
def benchmarks(self):
return server_benchmarks

def name(self):
return 'server'

def runBenchmark(self, benchmark, bmSuiteArgs):
arguments = ['run', '--exec']
if 'MX_NO_GRAAL' not in os.environ:
arguments.extend(['--graal', '-J-G:+TruffleCompilationExceptionsAreFatal'])
arguments.extend(['all-ruby-benchmarks/servers/' + benchmark + '.rb'])

server = BackgroundJT(arguments)

with server:
time.sleep(10)
out = mx.OutputCapture()
if mx.run(
['ruby', 'all-ruby-benchmarks/servers/harness.rb', str(server_benchmark_time)],
out=out,
nonZeroIsFatal=False) == 0 and server.is_running():
samples = [float(s) for s in out.data.split('\n')[0:-1]]
print samples
half_samples = len(samples) / 2
used_samples = samples[len(samples)-half_samples-1:]
ips = sum(used_samples) / float(len(used_samples))

return [{
'benchmark': benchmark,
'metric.name': 'throughput',
'metric.value': ips,
'metric.unit': 'op/s',
'metric.better': 'higher',
'extra.metric.human': str(used_samples)
}]
else:
sys.stderr.write(out.data)

# TODO CS 24-Jun-16, how can we fail the wider suite?
return [{
'benchmark': benchmark,
'metric.name': 'throughput',
'metric.value': 0,
'metric.unit': 'op/s',
'metric.better': 'higher',
'extra.error': 'failed'
}]

mx_benchmark.add_bm_suite(AllocationBenchmarkSuite())
mx_benchmark.add_bm_suite(MinHeapBenchmarkSuite())
mx_benchmark.add_bm_suite(TimeBenchmarkSuite())
@@ -537,3 +622,4 @@ def time(self):
mx_benchmark.add_bm_suite(PSDBenchmarkSuite())
mx_benchmark.add_bm_suite(SyntheticBenchmarkSuite())
mx_benchmark.add_bm_suite(MicroBenchmarkSuite())
mx_benchmark.add_bm_suite(ServerBenchmarkSuite())