Skip to content

Commit

Permalink
Upgrade to google-perftools 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Nov 12, 2010
1 parent 0f44f24 commit 3fc7f2d
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 222 deletions.
6 changes: 2 additions & 4 deletions ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.4/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.6/config.log"
end
ret
end
Expand All @@ -23,7 +23,7 @@ def sys(cmd)
end
end

perftools = File.basename('google-perftools-1.4.tar.gz')
perftools = File.basename('google-perftools-1.6.tar.gz')
dir = File.basename(perftools, '.tar.gz')

puts "(I'm about to compile google-perftools.. this will definitely take a while)"
Expand All @@ -45,9 +45,7 @@ def sys(cmd)
['perftools-pprof', true],
['perftools-gc', true],
['perftools-osx', RUBY_PLATFORM =~ /darwin/],
['perftools-osx-106', RUBY_PLATFORM =~ /darwin10/],
['perftools-debug', true],
['perftools-realtime', true],
['perftools-objects', true],
['perftools-frames', true]
].each do |patch, apply|
Expand Down
Binary file removed ext/src/google-perftools-1.4.tar.gz
Binary file not shown.
Binary file added ext/src/google-perftools-1.6.tar.gz
Binary file not shown.
10 changes: 5 additions & 5 deletions patches/perftools-notests.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
diff --git a/Makefile.in b/Makefile.in
index 0ddc27c..1869975 100644
index b301f4d..969db5e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -53,9 +53,7 @@ host_triplet = @host@
@ENABLE_FRAME_POINTERS_TRUE@@X86_64_TRUE@am__append_3 = -fno-omit-frame-pointer
@ENABLE_FRAME_POINTERS_FALSE@@X86_64_TRUE@am__append_4 = -DNO_FRAME_POINTER
@@ -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
-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_22)
- $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_23)
+noinst_PROGRAMS =
bin_PROGRAMS =
@MINGW_TRUE@am__append_6 = libwindows.la libspinlock.la
Expand Down
28 changes: 11 additions & 17 deletions patches/perftools-objects.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
commit 5ffd87871619a750ad19e247670a0887a6d38fbd
Author: Aman Gupta <aman@tmm1.net>
Date: Sun Aug 1 18:50:38 2010 -0700

perftools-objects

diff --git a/src/profile-handler.cc b/src/profile-handler.cc
index 619b980..2ecf2c0 100644
index 5df5054..2335617 100644
--- a/src/profile-handler.cc
+++ b/src/profile-handler.cc
@@ -402,6 +402,8 @@ void ProfileHandler::GetState(ProfileHandlerState* state) {
@@ -395,6 +395,8 @@ void ProfileHandler::GetState(ProfileHandlerState* state) {
}

void ProfileHandler::StartTimer() {
Expand All @@ -17,24 +11,24 @@ index 619b980..2ecf2c0 100644
struct itimerval timer;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = 1000000 / frequency_;
@@ -410,12 +412,16 @@ void ProfileHandler::StartTimer() {
@@ -403,12 +405,16 @@ void ProfileHandler::StartTimer() {
}

void ProfileHandler::StopTimer() {
+ if (getenv("CPUPROFILE_OBJECTS") || getenv("CPUPROFILE_METHODS")) return;
+
struct itimerval timer;
memset(&timer, 0, sizeof timer);
setitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &timer, 0);
setitimer(timer_type_, &timer, 0);
}

bool ProfileHandler::IsTimerRunning() {
+ if (getenv("CPUPROFILE_OBJECTS") || getenv("CPUPROFILE_METHODS")) return false;
+
struct itimerval current_timer;
RAW_CHECK(0 == getitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &current_timer), "getitimer");
RAW_CHECK(0 == getitimer(timer_type_, &current_timer), "getitimer");
return (current_timer.it_value.tv_sec != 0 ||
@@ -423,6 +429,8 @@ bool ProfileHandler::IsTimerRunning() {
@@ -416,6 +422,8 @@ bool ProfileHandler::IsTimerRunning() {
}

void ProfileHandler::EnableHandler() {
Expand All @@ -43,7 +37,7 @@ index 619b980..2ecf2c0 100644
struct sigaction sa;
sa.sa_sigaction = SignalHandler;
sa.sa_flags = SA_RESTART | SA_SIGINFO;
@@ -431,6 +439,8 @@ void ProfileHandler::EnableHandler() {
@@ -425,6 +433,8 @@ void ProfileHandler::EnableHandler() {
}

void ProfileHandler::DisableHandler() {
Expand All @@ -53,10 +47,10 @@ index 619b980..2ecf2c0 100644
sa.sa_handler = SIG_IGN;
sa.sa_flags = SA_RESTART;
diff --git a/src/profiler.cc b/src/profiler.cc
index 37234b2..905288f 100644
index f408cf8..7645c45 100644
--- a/src/profiler.cc
+++ b/src/profiler.cc
@@ -97,6 +97,10 @@ class CpuProfiler {
@@ -102,6 +102,10 @@ class CpuProfiler {

static CpuProfiler instance_;

Expand All @@ -67,7 +61,7 @@ index 37234b2..905288f 100644
private:
// This lock implements the locking requirements described in the ProfileData
// documentation, specifically:
@@ -125,10 +129,6 @@ class CpuProfiler {
@@ -130,10 +134,6 @@ class CpuProfiler {

// Disables receiving SIGPROF interrupt.
void DisableHandler();
Expand All @@ -78,7 +72,7 @@ index 37234b2..905288f 100644
};

// Profile data structure singleton: Constructor will check to see if
@@ -318,6 +318,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
@@ -323,6 +323,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
extern "C" PERFTOOLS_DLL_DECL void ProfilerGcMark(void (*cb)(VALUE)) {
CpuProfiler::instance_.GcMark(cb);
}
Expand Down
96 changes: 0 additions & 96 deletions patches/perftools-osx-106.patch

This file was deleted.

30 changes: 15 additions & 15 deletions patches/perftools-pprof.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/pprof b/src/pprof
index b5ef29a..25b956d 100755
index e67e42e..ee9927c 100755
--- a/src/pprof
+++ b/src/pprof
@@ -530,7 +530,8 @@ sub Main() {
@@ -560,7 +560,8 @@ sub Main() {
my $symbol_map = {};

# Read one profile, pick the last item on the list
Expand All @@ -12,7 +12,7 @@ index b5ef29a..25b956d 100755
my $profile = $data->{profile};
my $pcs = $data->{pcs};
my $libs = $data->{libs}; # Info about main program and shared libraries
@@ -567,6 +568,17 @@ sub Main() {
@@ -601,6 +602,17 @@ sub Main() {
$symbols = ExtractSymbols($libs, $pcs);
}

Expand All @@ -30,26 +30,26 @@ index b5ef29a..25b956d 100755
# Remove uniniteresting stack items
$profile = RemoveUninterestingFrames($symbols, $profile);

@@ -1927,6 +1927,10 @@ sub RemoveUninterestingFrames {
'ProfileData::prof_handler', # historical
'CpuProfiler::prof_handler',
@@ -2425,6 +2437,10 @@ sub RemoveUninterestingFrames {
foreach my $name ('ProfileData::Add', # historical
'ProfileData::prof_handler', # historical
'CpuProfiler::prof_handler',
+ 'PerfTools::CpuProfiler.start',
+ 'Array#each',
+ 'Proc#call',
+ 'Class#new',
'__FRAME_END__',
+ 'PerfTools::CpuProfiler.start',
+ 'Array#each',
+ 'Proc#call',
+ 'Class#new',
'__pthread_sighandler',
'__restore') {
$skip{$name} = 1;
@@ -1935,6 +1936,7 @@ sub RemoveUninterestingFrames {
'__pthread_sighandler',
'__restore') {
@@ -2434,6 +2450,7 @@ sub RemoveUninterestingFrames {
# Nothing skipped for unknown types
}

+=pod
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,
@@ -1959,6 +1961,7 @@ sub RemoveUninterestingFrames {
@@ -2458,6 +2475,7 @@ sub RemoveUninterestingFrames {
$profile = $result;
}
}
Expand Down
68 changes: 0 additions & 68 deletions patches/perftools-realtime.patch

This file was deleted.

17 changes: 0 additions & 17 deletions patches/perftools.patch
Original file line number Diff line number Diff line change
Expand Up @@ -264,20 +264,3 @@ index d158eea..e8509fe 100644
# error Cannot calculate stack trace: will need to write for your environment
#endif
+#endif
diff --git a/src/stacktrace_with_context.cc b/src/stacktrace_with_context.cc
index ed7bfe3..a90c070 100644
--- a/src/stacktrace_with_context.cc
+++ b/src/stacktrace_with_context.cc
@@ -41,6 +41,7 @@
// may inline this code anyway. Let's hope they respect
// ATTRIBUTE_NOINLINE.

+#ifndef BUILD_FOR_RUBY
#include <config.h>
#include <google/stacktrace.h>
#include "stacktrace_config.h"
@@ -59,3 +60,4 @@ int GetStackTraceWithContext(void** result, int max_depth,
return GetStackTrace(result, max_depth, skip_count + 1);
}
#endif
+#endif

0 comments on commit 3fc7f2d

Please sign in to comment.