Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Migrate to perftools 1.8.3 #33

Closed
wants to merge 1 commit into from

10 participants

@bearded

Hello guys,

What do you think about migration at perftools 1.8.3 ?

Hope this pull request will help

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

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

@bearded
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
@tmm1
Owner

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

@bearded

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

@bearded

@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)

@bearded

@tmm1, now it is ok?

@bearded

@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
@bearded

Hey Aman,

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

@greggroth

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>'
@bearded

@greggroth, could you please show Gemfile?

@greggroth

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.

@bearded

@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
@greggroth

That did the trick. Thanks!

@tmm1
Owner

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

@grzuy

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

@bearded

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

@grzuy

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

@betelgeuse

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

@Maher4Ever

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: :)

@bearded

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

@brainopia

:+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.

@bearded

@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

@nicoolas25

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

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

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.

@betelgeuse

@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.

@bearded

@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 ?

@grzuy

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

@bearded bearded closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2011
  1. Migrate to perftools 1.8.3

    bearded authored
    * 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'
This page is out of date. Refresh to see the latest.
View
8 README.md
@@ -123,7 +123,7 @@ The sampling interval of the profiler can be adjusted to collect more
You'll also need graphviz to generate call graphs using dot:
sudo brew install graphviz ghostscript # osx
- sudo apt-get install graphviz ps2pdf # debian/ubuntu
+ sudo apt-get install graphviz ghostscript # debian/ubuntu
@tmm1 Owner
tmm1 added a note

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

@bearded
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
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)
@@ -140,9 +140,9 @@ The sampling interval of the profiler can be adjusted to collect more
Download:
- wget http://google-perftools.googlecode.com/files/google-perftools-1.6.tar.gz
- tar zxvf google-perftools-1.6.tar.gz
- cd google-perftools-1.6
+ wget http://google-perftools.googlecode.com/files/google-perftools-1.8.3.tar.gz
+ tar zxvf google-perftools-1.8.3.tar.gz
+ cd google-perftools-1.8.3
Compile:
View
2  bin/pprof.rb
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
require 'rbconfig'
-exec(File.join(File.dirname(__FILE__), 'pprof'), File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']), *ARGV)
+exec(File.join(File.dirname(__FILE__), 'pprof'), File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']), *ARGV)
View
BIN  examples/add_numbers_profile1.8.6.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/add_numbers_profile1.8.7.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/add_numbers_profile1.9.1.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/add_numbers_profile1.9.2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/add_numbers_profile1.9.3.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 ext/extconf.rb
@@ -3,7 +3,7 @@
def sys(cmd)
puts " -- #{cmd}"
unless ret = xsystem(cmd)
- 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"
+ 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"
end
ret
end
@@ -27,7 +27,7 @@ def sys(cmd)
end
end
-perftools = File.basename('google-perftools-1.6.tar.gz')
+perftools = File.basename('google-perftools-1.8.3.tar.gz')
dir = File.basename(perftools, '.tar.gz')
puts "(I'm about to compile google-perftools.. this will definitely take a while)"
View
5 ext/perftools.c
@@ -123,6 +123,11 @@ static VALUE Isend;
#include <vm_core.h>
#include <iseq.h>
+// Fix compile error in ruby 1.9.3
+#ifdef RTYPEDDATA_DATA
+#define ruby_current_thread ((rb_thread_t *)RTYPEDDATA_DATA(rb_thread_current()))
+#endif
+
int
rb_stack_trace(void** result, int max_depth)
{
View
BIN  ext/src/google-perftools-1.6.tar.gz
Binary file not shown
View
BIN  ext/src/google-perftools-1.8.3.tar.gz
Binary file not shown
View
4 patches/perftools-debug.patch
@@ -1,8 +1,8 @@
diff --git a/Makefile.in b/Makefile.in
-index c3bf409..c613939 100644
+index 153483e..d38bee1 100644
--- a/Makefile.in
+++ b/Makefile.in
-@@ -1367,13 +1367,13 @@ AUTOMAKE = @AUTOMAKE@
+@@ -1509,13 +1509,13 @@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
View
2  patches/perftools-frames.patch
@@ -1,5 +1,5 @@
diff --git a/src/profiledata.h b/src/profiledata.h
-index ccdf96f..0517614 100644
+index 1b3eb2e..0d81603 100644
--- a/src/profiledata.h
+++ b/src/profiledata.h
@@ -106,7 +106,7 @@ class ProfileData {
View
12 patches/perftools-gc.patch
@@ -1,5 +1,5 @@
diff --git a/src/profiledata.cc b/src/profiledata.cc
-index e6240d9..b901ee8 100644
+index ea95493..582ec9a 100644
--- a/src/profiledata.cc
+++ b/src/profiledata.cc
@@ -198,6 +198,29 @@ static void DumpProcSelfMaps(int fd) {
@@ -33,7 +33,7 @@ index e6240d9..b901ee8 100644
if (!enabled()) {
return;
diff --git a/src/profiledata.h b/src/profiledata.h
-index 67c463d..a68e12f 100644
+index 2f013e6..1b3eb2e 100644
--- a/src/profiledata.h
+++ b/src/profiledata.h
@@ -40,6 +40,12 @@
@@ -61,10 +61,10 @@ index 67c463d..a68e12f 100644
static const int kAssociativity = 4; // For hashtable
static const int kBuckets = 1 << 10; // For hashtable
diff --git a/src/profiler.cc b/src/profiler.cc
-index d89a53a..37234b2 100644
+index b38602a..3363428 100644
--- a/src/profiler.cc
+++ b/src/profiler.cc
-@@ -87,6 +87,10 @@ class CpuProfiler {
+@@ -92,6 +92,10 @@ class CpuProfiler {
// Write the data to disk (and continue profiling).
void FlushTable();
@@ -75,7 +75,7 @@ index d89a53a..37234b2 100644
bool Enabled();
void GetCurrentState(ProfilerState* state);
-@@ -221,6 +225,16 @@ void CpuProfiler::FlushTable() {
+@@ -226,6 +230,16 @@ void CpuProfiler::FlushTable() {
EnableHandler();
}
@@ -92,7 +92,7 @@ index d89a53a..37234b2 100644
bool CpuProfiler::Enabled() {
SpinLockHolder cl(&lock_);
return collector_.enabled();
-@@ -300,6 +314,12 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
+@@ -306,6 +320,12 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
CpuProfiler::instance_.FlushTable();
}
View
14 patches/perftools-notests.patch
@@ -2,14 +2,14 @@ diff --git a/Makefile.in b/Makefile.in
index b301f4d..969db5e 100644
--- a/Makefile.in
+++ b/Makefile.in
-@@ -65,9 +65,7 @@ host_triplet = @host@
- @ENABLE_FRAME_POINTERS_TRUE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_3 = -fno-omit-frame-pointer
- @ENABLE_FRAME_POINTERS_FALSE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_4 = -DNO_FRAME_POINTER
- @MINGW_TRUE@am__append_5 = -Wl,-u__tcmalloc
+@@ -67,9 +67,7 @@
+ @ENABLE_FRAME_POINTERS_TRUE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_4 = -fno-omit-frame-pointer
+ @ENABLE_FRAME_POINTERS_FALSE@@X86_64_AND_NO_FP_BY_DEFAULT_TRUE@am__append_5 = -DNO_FRAME_POINTER
+ @MINGW_TRUE@am__append_6 = -Wl,-u__tcmalloc
-noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
- $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
-- $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_23)
-+noinst_PROGRAMS =
+- $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_28)
++noinst_PROGRAMS =
bin_PROGRAMS =
- @MINGW_TRUE@am__append_6 = libwindows.la libspinlock.la
+ @MINGW_TRUE@am__append_7 = libwindows.la libspinlock.la
View
6 patches/perftools-objects.patch
@@ -1,5 +1,5 @@
diff --git a/src/profile-handler.cc b/src/profile-handler.cc
-index 5df5054..2335617 100644
+index dfc2e38..d3bfb42 100644
--- a/src/profile-handler.cc
+++ b/src/profile-handler.cc
@@ -395,6 +395,8 @@ void ProfileHandler::GetState(ProfileHandlerState* state) {
@@ -47,7 +47,7 @@ index 5df5054..2335617 100644
sa.sa_handler = SIG_IGN;
sa.sa_flags = SA_RESTART;
diff --git a/src/profiler.cc b/src/profiler.cc
-index f408cf8..7645c45 100644
+index 3363428..0043513 100644
--- a/src/profiler.cc
+++ b/src/profiler.cc
@@ -102,6 +102,10 @@ class CpuProfiler {
@@ -72,7 +72,7 @@ index f408cf8..7645c45 100644
};
// Profile data structure singleton: Constructor will check to see if
-@@ -323,6 +323,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
+@@ -324,6 +324,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
extern "C" PERFTOOLS_DLL_DECL void ProfilerGcMark(void (*cb)(VALUE)) {
CpuProfiler::instance_.GcMark(cb);
}
View
6 patches/perftools-osx.patch
@@ -1,11 +1,11 @@
diff --git a/Makefile.in b/Makefile.in
-index 566d77c..c3bf409 100644
+index 153483e..fe68999 100644
--- a/Makefile.in
+++ b/Makefile.in
-@@ -1397,7 +1397,7 @@ INSTALL_DATA = @INSTALL_DATA@
- INSTALL_PROGRAM = @INSTALL_PROGRAM@
+@@ -1543,7 +1543,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ LD = @LD@
-LDFLAGS = @LDFLAGS@
+LDFLAGS = @LDFLAGS@ -Wl,-flat_namespace,-undefined,dynamic_lookup
LIBOBJS = @LIBOBJS@
View
20 patches/perftools-pprof.patch
@@ -1,14 +1,8 @@
-commit 1828f461a3ea523b7018d03ab83850621cf66ba9
-Author: Aman Gupta <aman@tmm1.net>
-Date: Fri Nov 12 16:33:15 2010 -0600
-
- perftools-pprof
-
diff --git a/src/pprof b/src/pprof
-index e67e42e..b04d988 100755
+index dbe71a4..e300f22 100755
--- a/src/pprof
+++ b/src/pprof
-@@ -560,7 +560,8 @@ sub Main() {
+@@ -575,7 +575,8 @@ sub Main() {
my $symbol_map = {};
# Read one profile, pick the last item on the list
@@ -18,7 +12,7 @@ index e67e42e..b04d988 100755
my $profile = $data->{profile};
my $pcs = $data->{pcs};
my $libs = $data->{libs}; # Info about main program and shared libraries
-@@ -589,7 +590,18 @@ sub Main() {
+@@ -604,7 +605,18 @@ sub Main() {
# Collect symbols
my $symbols;
@@ -38,7 +32,7 @@ index e67e42e..b04d988 100755
$symbols = FetchSymbols($pcs, $symbol_map);
} elsif ($main::use_symbol_page) {
$symbols = FetchSymbols($pcs);
-@@ -2425,6 +2437,10 @@ sub RemoveUninterestingFrames {
+@@ -2790,6 +2802,10 @@ sub RemoveUninterestingFrames {
foreach my $name ('ProfileData::Add', # historical
'ProfileData::prof_handler', # historical
'CpuProfiler::prof_handler',
@@ -49,7 +43,7 @@ index e67e42e..b04d988 100755
'__FRAME_END__',
'__pthread_sighandler',
'__restore') {
-@@ -2434,6 +2450,7 @@ sub RemoveUninterestingFrames {
+@@ -2799,6 +2815,7 @@ sub RemoveUninterestingFrames {
# Nothing skipped for unknown types
}
@@ -57,7 +51,7 @@ index e67e42e..b04d988 100755
if ($main::profile_type eq 'cpu') {
# If all the second-youngest program counters are the same,
# this STRONGLY suggests that it is an artifact of measurement,
-@@ -2458,6 +2475,7 @@ sub RemoveUninterestingFrames {
+@@ -2823,6 +2840,7 @@ sub RemoveUninterestingFrames {
$profile = $result;
}
}
@@ -65,7 +59,7 @@ index e67e42e..b04d988 100755
my $result = {};
foreach my $k (keys(%{$profile})) {
-@@ -3360,7 +3378,7 @@ sub ReadCPUProfile {
+@@ -3749,7 +3767,7 @@ sub ReadCPUProfile {
# file, in which case the subtract-one was done when the file
# was written.
if ($j > 0 && !$main::use_symbolized_profile) {
View
25 patches/perftools.patch
@@ -1,8 +1,8 @@
diff --git a/Makefile.in b/Makefile.in
-index 232d2ec..566d77c 100644
+index f3aa67e..5b73c77 100644
--- a/Makefile.in
+++ b/Makefile.in
-@@ -1367,13 +1367,13 @@ AUTOMAKE = @AUTOMAKE@
+@@ -1511,13 +1511,13 @@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
@@ -19,10 +19,10 @@ index 232d2ec..566d77c 100644
DEFS = @DEFS@
DEPDIR = @DEPDIR@
diff --git a/src/profile-handler.cc b/src/profile-handler.cc
-index e658d30..370d012 100644
+index 700b5c0..dfc2e38 100644
--- a/src/profile-handler.cc
+++ b/src/profile-handler.cc
-@@ -264,6 +264,11 @@ ProfileHandler::~ProfileHandler() {
+@@ -267,6 +267,11 @@ ProfileHandler::~ProfileHandler() {
void ProfileHandler::RegisterThread() {
SpinLockHolder cl(&control_lock_);
@@ -34,7 +34,7 @@ index e658d30..370d012 100644
// We try to detect whether timers are being shared by setting a
// timer in the first call to this function, then checking whether
// it's set in the second call.
-@@ -305,6 +310,7 @@ void ProfileHandler::RegisterThread() {
+@@ -308,6 +313,7 @@ void ProfileHandler::RegisterThread() {
StartTimer();
break;
}
@@ -197,7 +197,7 @@ index 5f2531b..ea95493 100644
out_ = -1;
diff --git a/src/profiledata.h b/src/profiledata.h
-index da7ea9e..67c463d 100644
+index 3521bac..2f013e6 100644
--- a/src/profiledata.h
+++ b/src/profiledata.h
@@ -169,6 +169,7 @@ class ProfileData {
@@ -209,10 +209,10 @@ index da7ea9e..67c463d 100644
// Move 'entry' to the eviction buffer.
diff --git a/src/profiler.cc b/src/profiler.cc
-index 183a7c7..d89a53a 100644
+index a57953e..b38602a 100644
--- a/src/profiler.cc
+++ b/src/profiler.cc
-@@ -63,6 +63,12 @@ typedef int ucontext_t; // just to quiet the compiler, mostly
+@@ -68,6 +68,12 @@ typedef int ucontext_t; // just to quiet the compiler, mostly
#include "conflict-signal.h" /* used on msvc machines */
#endif
@@ -225,17 +225,18 @@ index 183a7c7..d89a53a 100644
using std::string;
// Collects up all profile data. This is a singleton, which is
-@@ -261,6 +267,9 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
+@@ -266,6 +272,10 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
(*instance->filter_)(instance->filter_arg_)) {
void* stack[ProfileData::kMaxStackDepth];
+#ifdef BUILD_FOR_RUBY
+ int depth = rb_stack_trace(stack, arraysize(stack));
+#else
++
// The top-most active routine doesn't show up as a normal
// frame, but as the "pc" value in the signal handler context.
stack[0] = GetPC(*reinterpret_cast<ucontext_t*>(signal_ucontext));
-@@ -274,8 +283,10 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
+@@ -279,8 +289,10 @@ void CpuProfiler::prof_handler(int sig, siginfo_t*, void* signal_ucontext,
int depth = GetStackTraceWithContext(stack + 1, arraysize(stack) - 1,
2, signal_ucontext);
depth++; // To account for pc value in stack[0];
@@ -248,7 +249,7 @@ index 183a7c7..d89a53a 100644
}
diff --git a/src/stacktrace.cc b/src/stacktrace.cc
-index d158eea..e8509fe 100644
+index 175cdf5..18b4a79 100644
--- a/src/stacktrace.cc
+++ b/src/stacktrace.cc
@@ -52,6 +52,7 @@
@@ -259,7 +260,7 @@ index d158eea..e8509fe 100644
#include <config.h>
#include <google/stacktrace.h>
#include "stacktrace_config.h"
-@@ -69,3 +70,4 @@
+@@ -108,3 +109,4 @@
#else
# error Cannot calculate stack trace: will need to write for your environment
#endif
Something went wrong with that request. Please try again.