Skip to content

Instantly share code, notes, and snippets.

@matthewd
Created June 15, 2011 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewd/1027580 to your computer and use it in GitHub Desktop.
Save matthewd/1027580 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
lib_path = File.expand_path("../../lib", __FILE__)
$:.unshift lib_path
require 'uri'
require 'net/http'
require 'optparse'
require 'tempfile'
require 'benchmark/suite'
require 'benchmark/ips'
#report_uri = URI.parse("http://sierra.trebex.net:8000/result/add/")
report_uri = URI.parse("http://localhost:8000/result/add/")
project = ARGV.shift
executable = ARGV.shift
commit = ARGV.shift
date = ARGV.shift
results = Marshal.load(ARGF.read)
results.reports.each do |file, subreports|
report_name = file.sub(/^(?:.*\/)?benchmark\/(.*[^\/])\/+bench_(.*)\.rb$/, '\1/\2')
ips = 0
subreports.each do |report|
ips += report.ips
end
ips /= subreports.size
params = {
'project' => project,
'executable' => executable,
'commitid' => commit,
'benchmark' => report_name,
'environment' => `hostname`.chomp,
#'revision_date' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
'revision_date' => date,
'result_date' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
'result_value' => ips,
#'std_dev' => report.ips_sd,
}
result = Net::HTTP.post_form(report_uri, params)
unless Net::HTTPSuccess === result
p result
p result.body
exit
end
end
#!/bin/bash
ROOT="$1"
EXE="$2"
SHORTNAME="$3"
FULLNAME="$4"
SHORTEXE=$(echo "$EXE" | sed -e 's/.*\///' -e 's/[^A-Za-z0-9]\+/-/g')
HASH=$(cd "$ROOT"; git log -1 --format=%h)
DATE="$(date -u -d "$(cd "$ROOT"; git log -1 --format=%ci $HASH)" '+%Y-%m-%d %H:%M:%S')"
RESULTS="results/$SHORTEXE-$HASH"
if [ ! -f "$RESULTS" ]; then
ruby bin/benchmark -t "$ROOT/$EXE" -s "$RESULTS" benchmark/core/fixnum
sleep 2
else
echo "$RESULTS already exists"
fi
ruby benchmark/bin/codespeed "$SHORTNAME" "$FULLNAME" "$HASH" "$DATE" "$RESULTS"
% benchmark/bin/cs-run . 'bin/rbx' Rubinius 'Rubinius (JIT)'
% benchmark/bin/cs-run . 'bin/rbx -Xint' Rubinius 'Rubinius (No JIT)'
% benchmark/bin/cs-run ../jruby 'bin/jruby --server' JRuby 'JRuby (Server)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment