Skip to content
This repository

Migrate to perftools 1.8.3 #33

Closed
wants to merge 1 commit into from

10 participants

Alexey Chebotar Aman Gupta Greggory Rothmeier Gonzalo Petteri Räty Maher Sallam Ravil Bayramgalin tzeskimo raykin Nicolas Zermati
Alexey Chebotar

Hello guys,

What do you think about migration at perftools 1.8.3 ?

Hope this pull request will help

Aman Gupta tmm1 commented on the diff
README.md
... ... @@ -123,7 +123,7 @@ The sampling interval of the profiler can be adjusted to collect more
123 123 You'll also need graphviz to generate call graphs using dot:
124 124
125 125 sudo brew install graphviz ghostscript # osx
126   - sudo apt-get install graphviz ps2pdf # debian/ubuntu
  126 + sudo apt-get install graphviz ghostscript # debian/ubuntu
2
Aman Gupta Owner
tmm1 added a note

Are you sure this is correct? Which ubuntu/debian version were you on?

Alexey Chebotar
bearded added a note

Yes, I'm sure, I have checked it at 10.04.3 LTS, but you can see that ps2pdf is provided by ghostscript in every version here: http://manpages.ubuntu.com/manpages/oneiric/man1/ps2pdf.1.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Aman Gupta
Owner

Looks good, but how did you update the patch files? Were there any conflicts in the rebase?

Alexey Chebotar

I have checked every patch by hands and did update in the files. Do not know how to do this via rebase :(

Alexey Chebotar

@tmm1, I have added few more commits but I'm not sure that all of them is needed.

perftools.rb now works with ruby 1.9.3-preview1. Please have a look

update:
perftools.rb also works with 1.9.3-rc1 (see preview_revision.yml)

Alexey Chebotar

@tmm1, now it is ok?

Alexey Chebotar

@tmm1, shall I remove examples?

bearded Migrate to perftools 1.8.3
* use RbConfig::CONFIG instead of Config::CONFIG
* Fixed error 'Symbol not found: _ruby_current_thread (LoadError)' for ruby-1.9.3
* Added examples of reporting add_numbers_profile in ruby '1.8.6', '1.8.7', '1.9.1', '1.9.2', '1.9.3'
df73f93
Alexey Chebotar

Hey Aman,

I've rebased this request, could you please have a look and leave a comment?

Greggory Rothmeier

I believe this pull request is supposed to address this error when using Ruby 1.9.3, but I'm still getting this error. I've tried both the gem on RubyGems and building the gem from the latest source. Any advice? Should I just go down to 1.9.2-head?

/Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': dlopen(/Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/perftools.rb-0.5.6/lib/perftools.bundle, 9): Symbol not found: _ruby_current_thread (LoadError)
  Referenced from: /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/perftools.rb-0.5.6/lib/perftools.bundle
  Expected in: flat namespace
 in /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/perftools.rb-0.5.6/lib/perftools.bundle - /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/perftools.rb-0.5.6/lib/perftools.bundle
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-perftools_profiler-0.5.0/lib/rack/perftools_profiler/profiler.rb:43:in `initialize'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-perftools_profiler-0.5.0/lib/rack/perftools_profiler/profiler_middleware.rb:20:in `new'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-perftools_profiler-0.5.0/lib/rack/perftools_profiler/profiler_middleware.rb:20:in `initialize'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-perftools_profiler-0.5.0/lib/rack/perftools_profiler.rb:20:in `new'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-perftools_profiler-0.5.0/lib/rack/perftools_profiler.rb:20:in `new'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.0/lib/action_dispatch/middleware/stack.rb:43:in `build'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.0/lib/action_dispatch/middleware/stack.rb:112:in `block in build'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.0/lib/action_dispatch/middleware/stack.rb:112:in `each'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.0/lib/action_dispatch/middleware/stack.rb:112:in `inject'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.1.0/lib/action_dispatch/middleware/stack.rb:112:in `build'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/engine.rb:446:in `app'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/Greggory/Programing/beerlist/config/environment.rb:5:in `<top (required)>'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /Users/Greggory/Programing/beerlist/config.ru:4:in `block in <main>'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/builder.rb:51:in `initialize'
    from /Users/Greggory/Programing/beerlist/config.ru:1:in `new'
    from /Users/Greggory/Programing/beerlist/config.ru:1:in `<main>'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/builder.rb:40:in `eval'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/builder.rb:40:in `parse_file'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/server.rb:200:in `app'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/commands/server.rb:46:in `app'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.3.2/lib/rack/server.rb:252:in `start'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/commands/server.rb:70:in `start'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/commands.rb:54:in `block in <top (required)>'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
    from /Users/Greggory/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Alexey Chebotar

@greggroth, could you please show Gemfile?

Greggory Rothmeier

Right now I'm loading them only for the development environment, but I've also tried loading them for all environments.

group :development do
  gem 'perftools.rb'
  gem 'rack-perftools_profiler'
end

and in config/application.rb I've added

require 'rack/perftools_profiler'

module BlogApp
   config.middleware.use ::Rack::PerftoolsProfiler , :default_printer => 'gif', :bundler => true
end

This is in a rails 3.1 app (I've obviously removed code unrelated to this gem). I've tried with 1.9.2-head, 1.9.3-rc1, and 1.9.3-head and I get the same error every time.

Alexey Chebotar

@greggroth, please try to use

group :development do
  gem 'perftools.rb', :git => 'git://github.com/bearded/perftools.rb.git', :branch => 'perftools-1.8'
  gem 'rack-perftools_profiler'
end
Greggory Rothmeier

That did the trick. Thanks!

Aman Gupta
Owner

Sorry for the delay. I'll try to merge this this weekend.

Gonzalo

I suppose this patch will fix the gcc4.6 compile issue, is that correct?

Alexey Chebotar

@grzuy, I can't check it because of problems with compiling gcc46 on Mac OS X :(

Gonzalo

I tried it on my Linux with gcc4.6 and it seems to fix #35 :)

Petteri Räty

@tmm1 Any problems with the merge as this is still open?

Maher Sallam

This pull request worked for me and I was able to install perftools on Ubuntu 11.10.
All the other options didn't (master branch or installing from RubyGems).
So I say :shipit: :)

Alexey Chebotar

@tmm1, maybe better will be migrate at perftools 1.9.1 ?

Ravil Bayramgalin

:+1: awesome, this pull-request fixed undefined symbol `ruby_current_thread' when compiling against Ruby 1.9.3-p0.

tzeskimo

Thanks bearded. This did the trick on ubuntu 11.10.

Alexey Chebotar

@tzeskimo, I'm glad that this helps to people :)

raykin

Not pulled yet?
@bearded How to use your patch? I still can't install it on GCC 4.6.1 on ubuntu 11.10

Nicolas Zermati

Thanks @bearded, I'm using it with ruby 1.9.3p125 (Debian Sqeeze 64 bits) and it seems working.

Aman Gupta tmm1 referenced this pull request from a commit
Aman Gupta @bearded's ruby 1.9.3 patch from #33 /cc #39 1742f97
Aman Gupta
Owner
tmm1 commented

Sorry for losing track of this for so long. Thanks for keeping up with the issues @bearded!

I've just pulled the new upstream gperftools 2.0 into master, and applied the ruby 1.9 fix from this branch.

Please test against master and report any bugs. If everything looks good, I'll release a new gem.

Petteri Räty

@tmm1 it worked for me with default settings. With CPUPROFILE_REALTIME=1 I get "Disabling profiler because SIGALRM handler is already in use". I am not sure if this is a regression as I haven't been able to run perftools.rb for a while before these updates.

Alexey Chebotar

@tmm1, add_numbers_profile example works on rubies 1.9.3-p125, 1.9.2-p318, 1.9.1-p431, 1.8.7-p358, 1.8.6-p420 and ree-1.8.7-2012.02.

Thank you :+1:

@betelgeuse, could you please create issue about CPUPROFILE_REALTIME to close this PR ?

Gonzalo
grzuy commented

@tmm1 fixed my gcc4.6 compilation issue :+1:

Alexey Chebotar bearded closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 31, 2011
bearded Migrate to perftools 1.8.3
* use RbConfig::CONFIG instead of Config::CONFIG
* Fixed error 'Symbol not found: _ruby_current_thread (LoadError)' for ruby-1.9.3
* Added examples of reporting add_numbers_profile in ruby '1.8.6', '1.8.7', '1.9.1', '1.9.2', '1.9.3'
df73f93
This page is out of date. Refresh to see the latest.
8 README.md
Source Rendered
@@ -123,7 +123,7 @@ The sampling interval of the profiler can be adjusted to collect more
123 123 You'll also need graphviz to generate call graphs using dot:
124 124
125 125 sudo brew install graphviz ghostscript # osx
126   - sudo apt-get install graphviz ps2pdf # debian/ubuntu
  126 + sudo apt-get install graphviz ghostscript # debian/ubuntu
127 127
128 128 If graphviz fails to build on OSX Lion, you may need to recompile libgd, [see here](https://github.com/mxcl/homebrew/issues/6645#issuecomment-1806807)
129 129
@@ -140,9 +140,9 @@ The sampling interval of the profiler can be adjusted to collect more
140 140
141 141 Download:
142 142
143   - wget http://google-perftools.googlecode.com/files/google-perftools-1.6.tar.gz
144   - tar zxvf google-perftools-1.6.tar.gz
145   - cd google-perftools-1.6
  143 + wget http://google-perftools.googlecode.com/files/google-perftools-1.8.3.tar.gz
  144 + tar zxvf google-perftools-1.8.3.tar.gz
  145 + cd google-perftools-1.8.3
146 146
147 147 Compile:
148 148
2  bin/pprof.rb
... ... @@ -1,3 +1,3 @@
1 1 #!/usr/bin/env ruby
2 2 require 'rbconfig'
3   -exec(File.join(File.dirname(__FILE__), 'pprof'), File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']), *ARGV)
  3 +exec(File.join(File.dirname(__FILE__), 'pprof'), File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']), *ARGV)
BIN  examples/add_numbers_profile1.8.6.gif
BIN  examples/add_numbers_profile1.8.7.gif
BIN  examples/add_numbers_profile1.9.1.gif
BIN  examples/add_numbers_profile1.9.2.gif
BIN  examples/add_numbers_profile1.9.3.gif
4 ext/extconf.rb
@@ -3,7 +3,7 @@
3 3 def sys(cmd)
4 4 puts " -- #{cmd}"
5 5 unless ret = xsystem(cmd)
6   - raise "#{cmd} failed, please report to perftools@tmm1.net with pastie.org link to #{CWD}/mkmf.log and #{CWD}/src/google-perftools-1.6/config.log"
  6 + raise "#{cmd} failed, please report to perftools@tmm1.net with pastie.org link to #{CWD}/mkmf.log and #{CWD}/src/google-perftools-1.8.3/config.log"
7 7 end
8 8 ret
9 9 end
@@ -27,7 +27,7 @@ def sys(cmd)
27 27 end
28 28 end
29 29
30   -perftools = File.basename('google-perftools-1.6.tar.gz')
  30 +perftools = File.basename('google-perftools-1.8.3.tar.gz')
31 31 dir = File.basename(perftools, '.tar.gz')
32 32
33 33 puts "(I'm about to compile google-perftools.. this will definitely take a while)"
5 ext/perftools.c
@@ -123,6 +123,11 @@ static VALUE Isend;
123 123 #include <vm_core.h>
124 124 #include <iseq.h>
125 125
  126 +// Fix compile error in ruby 1.9.3
  127 +#ifdef RTYPEDDATA_DATA
  128 +#define ruby_current_thread ((rb_thread_t *)RTYPEDDATA_DATA(rb_thread_current()))
  129 +#endif
  130 +
126 131 int
127 132 rb_stack_trace(void** result, int max_depth)
128 133 {
BIN  ext/src/google-perftools-1.6.tar.gz
Binary file not shown
BIN  ext/src/google-perftools-1.8.3.tar.gz
Binary file not shown
4 patches/perftools-debug.patch
... ... @@ -1,8 +1,8 @@
1 1 diff --git a/Makefile.in b/Makefile.in
2   -index c3bf409..c613939 100644
  2 +index 153483e..d38bee1 100644
3 3 --- a/Makefile.in
4 4 +++ b/Makefile.in
5   -@@ -1367,13 +1367,13 @@ AUTOMAKE = @AUTOMAKE@
  5 +@@ -1509,13 +1509,13 @@ AUTOMAKE = @AUTOMAKE@
6 6 AWK = @AWK@
7 7 CC = @CC@
8 8 CCDEPMODE = @CCDEPMODE@
2  patches/perftools-frames.patch
... ... @@ -1,5 +1,5 @@
1 1 diff --git a/src/profiledata.h b/src/profiledata.h
2   -index ccdf96f..0517614 100644
  2 +index 1b3eb2e..0d81603 100644
3 3 --- a/src/profiledata.h
4 4 +++ b/src/profiledata.h
5 5 @@ -106,7 +106,7 @@ class ProfileData {
12 patches/perftools-gc.patch
... ... @@ -1,5 +1,5 @@
1 1 diff --git a/src/profiledata.cc b/src/profiledata.cc
2   -index e6240d9..b901ee8 100644
  2 +index ea95493..582ec9a 100644
3 3 --- a/src/profiledata.cc
4 4 +++ b/src/profiledata.cc
5 5 @@ -198,6 +198,29 @@ static void DumpProcSelfMaps(int fd) {
@@ -33,7 +33,7 @@ index e6240d9..b901ee8 100644
33 33 if (!enabled()) {
34 34 return;
35 35 diff --git a/src/profiledata.h b/src/profiledata.h
36   -index 67c463d..a68e12f 100644
  36 +index 2f013e6..1b3eb2e 100644
37 37 --- a/src/profiledata.h
38 38 +++ b/src/profiledata.h
39 39 @@ -40,6 +40,12 @@
@@ -61,10 +61,10 @@ index 67c463d..a68e12f 100644
61 61 static const int kAssociativity = 4; // For hashtable
62 62 static const int kBuckets = 1 << 10; // For hashtable
63 63 diff --git a/src/profiler.cc b/src/profiler.cc
64   -index d89a53a..37234b2 100644
  64 +index b38602a..3363428 100644
65 65 --- a/src/profiler.cc
66 66 +++ b/src/profiler.cc
67   -@@ -87,6 +87,10 @@ class CpuProfiler {
  67 +@@ -92,6 +92,10 @@ class CpuProfiler {
68 68 // Write the data to disk (and continue profiling).
69 69 void FlushTable();
70 70
@@ -75,7 +75,7 @@ index d89a53a..37234b2 100644
75 75 bool Enabled();
76 76
77 77 void GetCurrentState(ProfilerState* state);
78   -@@ -221,6 +225,16 @@ void CpuProfiler::FlushTable() {
  78 +@@ -226,6 +230,16 @@ void CpuProfiler::FlushTable() {
79 79 EnableHandler();
80 80 }
81 81
@@ -92,7 +92,7 @@ index d89a53a..37234b2 100644
92 92 bool CpuProfiler::Enabled() {
93 93 SpinLockHolder cl(&lock_);
94 94 return collector_.enabled();
95   -@@ -300,6 +314,12 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
  95 +@@ -306,6 +320,12 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
96 96 CpuProfiler::instance_.FlushTable();
97 97 }
98 98
14 patches/perftools-notests.patch
@@ -2,14 +2,14 @@ diff --git a/Makefile.in b/Makefile.in
2 2 index b301f4d..969db5e 100644
3 3 --- a/Makefile.in
4 4 +++ b/Makefile.in
5   -@@ -65,9 +65,7 @@ host_triplet = @host@
6   - @ENABLE_FRAME_POINTERS_TRUE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_3 = -fno-omit-frame-pointer
7   - @ENABLE_FRAME_POINTERS_FALSE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_4 = -DNO_FRAME_POINTER
8   - @MINGW_TRUE@am__append_5 = -Wl,-u__tcmalloc
  5 +@@ -67,9 +67,7 @@
  6 + @ENABLE_FRAME_POINTERS_TRUE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_4 = -fno-omit-frame-pointer
  7 + @ENABLE_FRAME_POINTERS_FALSE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_5 = -DNO_FRAME_POINTER
  8 + @MINGW_TRUE@am__append_6 = -Wl,-u__tcmalloc
9 9 -noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
10 10 - $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
11   -- $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_23)
12   -+noinst_PROGRAMS =
  11 +- $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_28)
  12 ++noinst_PROGRAMS =
13 13 bin_PROGRAMS =
14   - @MINGW_TRUE@am__append_6 = libwindows.la libspinlock.la
  14 + @MINGW_TRUE@am__append_7 = libwindows.la libspinlock.la
15 15
6 patches/perftools-objects.patch
... ... @@ -1,5 +1,5 @@
1 1 diff --git a/src/profile-handler.cc b/src/profile-handler.cc
2   -index 5df5054..2335617 100644
  2 +index dfc2e38..d3bfb42 100644
3 3 --- a/src/profile-handler.cc
4 4 +++ b/src/profile-handler.cc
5 5 @@ -395,6 +395,8 @@ void ProfileHandler::GetState(ProfileHandlerState* state) {
@@ -47,7 +47,7 @@ index 5df5054..2335617 100644
47 47 sa.sa_handler = SIG_IGN;
48 48 sa.sa_flags = SA_RESTART;
49 49 diff --git a/src/profiler.cc b/src/profiler.cc
50   -index f408cf8..7645c45 100644
  50 +index 3363428..0043513 100644
51 51 --- a/src/profiler.cc
52 52 +++ b/src/profiler.cc
53 53 @@ -102,6 +102,10 @@ class CpuProfiler {
@@ -72,7 +72,7 @@ index f408cf8..7645c45 100644
72 72 };
73 73
74 74 // Profile data structure singleton: Constructor will check to see if
75   -@@ -323,6 +323,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
  75 +@@ -324,6 +324,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
76 76 extern "C" PERFTOOLS_DLL_DECL void ProfilerGcMark(void (*cb)(VALUE)) {
77 77 CpuProfiler::instance_.GcMark(cb);
78 78 }
6 patches/perftools-osx.patch
... ... @@ -1,11 +1,11 @@
1 1 diff --git a/Makefile.in b/Makefile.in
2   -index 566d77c..c3bf409 100644
  2 +index 153483e..fe68999 100644
3 3 --- a/Makefile.in
4 4 +++ b/Makefile.in
5   -@@ -1397,7 +1397,7 @@ INSTALL_DATA = @INSTALL_DATA@
6   - INSTALL_PROGRAM = @INSTALL_PROGRAM@
  5 +@@ -1543,7 +1543,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
7 6 INSTALL_SCRIPT = @INSTALL_SCRIPT@
8 7 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
  8 + LD = @LD@
9 9 -LDFLAGS = @LDFLAGS@
10 10 +LDFLAGS = @LDFLAGS@ -Wl,-flat_namespace,-undefined,dynamic_lookup
11 11 LIBOBJS = @LIBOBJS@
20 patches/perftools-pprof.patch
... ... @@ -1,14 +1,8 @@
1   -commit 1828f461a3ea523b7018d03ab83850621cf66ba9
2   -Author: Aman Gupta <aman@tmm1.net>
3   -Date: Fri Nov 12 16:33:15 2010 -0600
4   -
5   - perftools-pprof
6   -
7 1 diff --git a/src/pprof b/src/pprof
8   -index e67e42e..b04d988 100755
  2 +index dbe71a4..e300f22 100755
9 3 --- a/src/pprof
10 4 +++ b/src/pprof
11   -@@ -560,7 +560,8 @@ sub Main() {
  5 +@@ -575,7 +575,8 @@ sub Main() {
12 6 my $symbol_map = {};
13 7
14 8 # Read one profile, pick the last item on the list
@@ -18,7 +12,7 @@ index e67e42e..b04d988 100755
18 12 my $profile = $data->{profile};
19 13 my $pcs = $data->{pcs};
20 14 my $libs = $data->{libs}; # Info about main program and shared libraries
21   -@@ -589,7 +590,18 @@ sub Main() {
  15 +@@ -604,7 +605,18 @@ sub Main() {
22 16
23 17 # Collect symbols
24 18 my $symbols;
@@ -38,7 +32,7 @@ index e67e42e..b04d988 100755
38 32 $symbols = FetchSymbols($pcs, $symbol_map);
39 33 } elsif ($main::use_symbol_page) {
40 34 $symbols = FetchSymbols($pcs);
41   -@@ -2425,6 +2437,10 @@ sub RemoveUninterestingFrames {
  35 +@@ -2790,6 +2802,10 @@ sub RemoveUninterestingFrames {
42 36 foreach my $name ('ProfileData::Add', # historical
43 37 'ProfileData::prof_handler', # historical
44 38 'CpuProfiler::prof_handler',
@@ -49,7 +43,7 @@ index e67e42e..b04d988 100755
49 43 '__FRAME_END__',
50 44 '__pthread_sighandler',
51 45 '__restore') {
52   -@@ -2434,6 +2450,7 @@ sub RemoveUninterestingFrames {
  46 +@@ -2799,6 +2815,7 @@ sub RemoveUninterestingFrames {
53 47 # Nothing skipped for unknown types
54 48 }
55 49
@@ -57,7 +51,7 @@ index e67e42e..b04d988 100755
57 51 if ($main::profile_type eq 'cpu') {
58 52 # If all the second-youngest program counters are the same,
59 53 # this STRONGLY suggests that it is an artifact of measurement,
60   -@@ -2458,6 +2475,7 @@ sub RemoveUninterestingFrames {
  54 +@@ -2823,6 +2840,7 @@ sub RemoveUninterestingFrames {
61 55 $profile = $result;
62 56 }
63 57 }
@@ -65,7 +59,7 @@ index e67e42e..b04d988 100755
65 59
66 60 my $result = {};
67 61 foreach my $k (keys(%{$profile})) {
68   -@@ -3360,7 +3378,7 @@ sub ReadCPUProfile {
  62 +@@ -3749,7 +3767,7 @@ sub ReadCPUProfile {
69 63 # file, in which case the subtract-one was done when the file
70 64 # was written.
71 65 if ($j > 0 && !$main::use_symbolized_profile) {
25 patches/perftools.patch
... ... @@ -1,8 +1,8 @@
1 1 diff --git a/Makefile.in b/Makefile.in
2   -index 232d2ec..566d77c 100644
  2 +index f3aa67e..5b73c77 100644
3 3 --- a/Makefile.in
4 4 +++ b/Makefile.in
5   -@@ -1367,13 +1367,13 @@ AUTOMAKE = @AUTOMAKE@
  5 +@@ -1511,13 +1511,13 @@ AUTOMAKE = @AUTOMAKE@
6 6 AWK = @AWK@
7 7 CC = @CC@
8 8 CCDEPMODE = @CCDEPMODE@
@@ -19,10 +19,10 @@ index 232d2ec..566d77c 100644
19 19 DEFS = @DEFS@
20 20 DEPDIR = @DEPDIR@
21 21 diff --git a/src/profile-handler.cc b/src/profile-handler.cc
22   -index e658d30..370d012 100644
  22 +index 700b5c0..dfc2e38 100644
23 23 --- a/src/profile-handler.cc
24 24 +++ b/src/profile-handler.cc
25   -@@ -264,6 +264,11 @@ ProfileHandler::~ProfileHandler() {
  25 +@@ -267,6 +267,11 @@ ProfileHandler::~ProfileHandler() {
26 26 void ProfileHandler::RegisterThread() {
27 27 SpinLockHolder cl(&control_lock_);
28 28
@@ -34,7 +34,7 @@ index e658d30..370d012 100644
34 34 // We try to detect whether timers are being shared by setting a
35 35 // timer in the first call to this function, then checking whether
36 36 // it's set in the second call.
37   -@@ -305,6 +310,7 @@ void ProfileHandler::RegisterThread() {
  37 +@@ -308,6 +313,7 @@ void ProfileHandler::RegisterThread() {
38 38 StartTimer();
39 39 break;
40 40 }
@@ -197,7 +197,7 @@ index 5f2531b..ea95493 100644
197 197
198 198 out_ = -1;
199 199 diff --git a/src/profiledata.h b/src/profiledata.h
200   -index da7ea9e..67c463d 100644
  200 +index 3521bac..2f013e6 100644
201 201 --- a/src/profiledata.h
202 202 +++ b/src/profiledata.h
203 203 @@ -169,6 +169,7 @@ class ProfileData {
@@ -209,10 +209,10 @@ index da7ea9e..67c463d 100644
209 209
210 210 // Move 'entry' to the eviction buffer.
211 211 diff --git a/src/profiler.cc b/src/profiler.cc
212   -index 183a7c7..d89a53a 100644
  212 +index a57953e..b38602a 100644
213 213 --- a/src/profiler.cc
214 214 +++ b/src/profiler.cc
215   -@@ -63,6 +63,12 @@ typedef int ucontext_t; // just to quiet the compiler, mostly
  215 +@@ -68,6 +68,12 @@ typedef int ucontext_t; // just to quiet the compiler, mostly
216 216 #include "conflict-signal.h" /* used on msvc machines */
217 217 #endif
218 218
@@ -225,17 +225,18 @@ index 183a7c7..d89a53a 100644
225 225 using std::string;
226 226
227 227 // Collects up all profile data. This is a singleton, which is
228   -@@ -261,6 +267,9 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
  228 +@@ -266,6 +272,10 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
229 229 (*instance->filter_)(instance->filter_arg_)) {
230 230 void* stack[ProfileData::kMaxStackDepth];
231 231
232 232 +#ifdef BUILD_FOR_RUBY
233 233 + int depth = rb_stack_trace(stack, arraysize(stack));
234 234 +#else
  235 ++
235 236 // The top-most active routine doesn't show up as a normal
236 237 // frame, but as the "pc" value in the signal handler context.
237 238 stack[0] = GetPC(*reinterpret_cast<ucontext_t*>(signal_ucontext));
238   -@@ -274,8 +283,10 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
  239 +@@ -279,8 +289,10 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
239 240 int depth = GetStackTraceWithContext(stack + 1, arraysize(stack) - 1,
240 241 2, signal_ucontext);
241 242 depth++; // To account for pc value in stack[0];
@@ -248,7 +249,7 @@ index 183a7c7..d89a53a 100644
248 249 }
249 250
250 251 diff --git a/src/stacktrace.cc b/src/stacktrace.cc
251   -index d158eea..e8509fe 100644
  252 +index 175cdf5..18b4a79 100644
252 253 --- a/src/stacktrace.cc
253 254 +++ b/src/stacktrace.cc
254 255 @@ -52,6 +52,7 @@
@@ -259,7 +260,7 @@ index d158eea..e8509fe 100644
259 260 #include <config.h>
260 261 #include <google/stacktrace.h>
261 262 #include "stacktrace_config.h"
262   -@@ -69,3 +70,4 @@
  263 +@@ -108,3 +109,4 @@
263 264 #else
264 265 # error Cannot calculate stack trace: will need to write for your environment
265 266 #endif

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.