This file contains hidden or 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
hi |
This file contains hidden or 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
<html> | |
<head> | |
<title>flamegraph</title> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
font-family: Monaco, "Liberation Mono", Courier, monospace; | |
font-size: 10pt; | |
} |
This file contains hidden or 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
Ruby 2.1.0 in Production: known bugs and patches | |
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production. | |
While testing the new build for rollout, we ran into a number of bugs. Most of | |
these have been fixed on trunk already, but I've documented them below to help | |
anyone else who might be testing ruby 2.1 in production. | |
@naruse I think we should backport these patches to the ruby_2_1 branch and | |
release 2.1.1 sooner rather than later, as some of the bugs are quite critical. | |
I'm happy to offer any assistance I can to expedite this process. |
This file contains hidden or 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
diff --git a/src/gperftools/profiler.h b/src/gperftools/profiler.h | |
index 95b107f..816468d 100644 | |
--- a/src/gperftools/profiler.h | |
+++ b/src/gperftools/profiler.h | |
@@ -139,6 +139,8 @@ PERFTOOLS_DLL_DECL void ProfilerStop(); | |
*/ | |
PERFTOOLS_DLL_DECL void ProfilerFlush(); | |
+PERFTOOLS_DLL_DECL void ProfilerPause(); | |
+PERFTOOLS_DLL_DECL void ProfilerResume(); |
This file contains hidden or 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
$ cat ruby_mcache.stp | |
probe process("/usr/bin/ruby").mark("method__cache__clear") | |
{ | |
module = kernel_string($arg1) | |
file = kernel_string($arg2) | |
line = $arg3 | |
printf("%s(%d) %s %s:%d cleared `%s'\n", execname(), pid(), $$name, file, line, module) | |
} | |
$ sudo stap ruby_mcache.stp |
This file contains hidden or 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
# gc_hook.rb | |
# Usage: RUBYOPT=-r./gc_hook.rb ruby app.rb | |
=begin | |
GC::Profiler.enable | |
at_exit{ GC::Profiler.raw_data.map{ |d| p(d) } } | |
=end | |
require 'objspace' | |
ObjectSpace.gc_hook = proc { |before, after| |
This file contains hidden or 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
" These VIM rules match the MRI C indentation rules. | |
" | |
" To enable use of this project specific config, add the following to your | |
" ~/.vimrc: | |
" | |
" " Enable per-directory .vimrc files | |
" set exrc | |
" " Disable unsafe commands in local .vimrc files | |
" set secure |
This file contains hidden or 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
diff --git a/extconf.rb b/extconf.rb | |
index 9f6f0c7..674eb08 100644 | |
--- a/extconf.rb | |
+++ b/extconf.rb | |
@@ -9,6 +9,7 @@ have_header('ruby/st.h') | |
have_func('rb_exec_recursive', 'ruby.h') | |
have_func('rb_exec_recursive_paired', 'ruby.h') | |
have_func('rb_proc_lambda_p', 'ruby.h') | |
+have_func('rb_obj_hide', 'ruby.h') | |
if Hash.method_defined?(:flatten) |
This file contains hidden or 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
# encoding: utf-8 | |
require 'set' | |
require 'json' | |
require 'pp' | |
class HeapDump | |
def initialize(data) | |
@objects = data.split("\n").map.with_index{ |line, idx| | |
begin | |
JSON.parse(line) |
This file contains hidden or 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
## without patch | |
2000 requests to https://github.com/rails/rails/pull/11955 as (anonymous) | |
cpu time: 154,548ms total (77ms avg/req, 68ms - 205ms) | |
oob gc: 0 / 0ms | |
in-request gc: 150 / 6,004ms total (40ms avg/req, 30ms - 124ms) | |
allocations: 154,895,372 objs total (77,447 objs avg/req, 77,332 objs - 79,043 objs) | |
## with patch |