-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Truffle] Add tools for measuring startup time and memory consumption.
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
- 9.0.4.0
- 9.0.3.0
- 9.0.1.0
1 parent
145518e
commit 492d310
Showing
10 changed files
with
196 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
# Calculates the approximate minimum heap sized needed to run hello world. | ||
# Not run it fast - just run it at all. | ||
|
||
# For example: | ||
# $ ruby test/truffle/memory/minimum-heap.rb bin/jruby "-X+T -e 'puts 14'" | ||
|
||
tolerance = 1 | ||
|
||
lower = 0 | ||
upper = 4 * 1024 | ||
|
||
while upper - lower > tolerance | ||
mid = lower + (upper - lower) / 2 | ||
|
||
print "trying #{mid}m... " | ||
can_run = !(`#{ARGV[0]} -J-Xmx#{mid}m #{ARGV[1]} 2>&1`.include? 'GC overhead limit exceeded') | ||
|
||
if can_run | ||
puts "yes" | ||
upper = mid | ||
else | ||
puts "no" | ||
lower = mid | ||
end | ||
end | ||
|
||
puts "minimum heap: #{upper}m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
# Counts how many classes are loaded to run a program. | ||
|
||
# For example: | ||
# $ bin/jruby -X+T -J-XX:+TraceClassLoading -e 'puts 14' 2>&1 | ruby test/truffle/startup/count-classes.rb | ||
|
||
classes = 0 | ||
|
||
ARGF.each do |line| | ||
if line.start_with? '[Loaded ' | ||
classes += 1 | ||
else | ||
puts line | ||
end | ||
end | ||
|
||
puts "classes-loaded #{classes}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
gnu_date() { | ||
if hash gdate 2> /dev/null | ||
then | ||
gdate "$@" | ||
else | ||
date "$@" | ||
fi | ||
} | ||
|
||
gnu_date +"before-launcher %s.%N" | ||
bin/jruby "$@" | ||
gnu_date +"after-launcher %s.%N" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
# Calculates where the time goes for important regions while running a program. | ||
|
||
# For example: | ||
# $ test/truffle/startup/jruby-timed -X+T -Xtruffle.metrics.time=true -e 'puts 14' 2>&1 | ruby test/truffle/startup/process-times.rb | ||
|
||
before_times = {} | ||
after_times = {} | ||
nesting = 0 | ||
accounted = 0 | ||
|
||
ARGF.each do |line| | ||
if line =~ /([\w-]+) (\d+\.\d+)/ | ||
id = $1.split('-') | ||
relative = id.first | ||
region = id.drop(1).join('-') | ||
time = $2.to_f | ||
|
||
case relative | ||
when 'before' | ||
before_times[region] = time | ||
nesting += 1 | ||
when 'after' | ||
after_times[region] = time | ||
elapsed = time - before_times[region] | ||
|
||
# 3 means ignore launcher, ignore main, then count regions within that | ||
if nesting == 3 && !(['launcher', 'main'].include? region) | ||
accounted += elapsed | ||
end | ||
|
||
puts "#{region} #{elapsed}" | ||
nesting -= 1 | ||
end | ||
end | ||
end | ||
|
||
total = after_times['launcher'] - before_times['launcher'] | ||
|
||
puts "accounted #{accounted}" | ||
puts "unaccounted #{total - accounted}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
# Repeatedly makes the same request, ignoring failures. Useful for server.rb | ||
# where you may want to know how soon it can handle its first request. | ||
|
||
require 'open-uri' | ||
|
||
loop do | ||
begin | ||
open('http://localhost:8000/hello').read | ||
rescue | ||
next | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env ruby | ||
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 1.0 | ||
# GNU General Public License version 2 | ||
# GNU Lesser General Public License version 2.1 | ||
|
||
# Serves a single request then shuts down. Useful with client.rb to make that | ||
# request. | ||
|
||
require 'webrick' | ||
|
||
server = WEBrick::HTTPServer.new(Port: 8000) | ||
|
||
server.mount_proc '/hello' do |req, res| | ||
res.status = 200 | ||
res['Content-Type'] = 'text/plain' | ||
res.body = 'Hello, World!' | ||
server.shutdown | ||
end | ||
|
||
server.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters