perftools.rb 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ CWD = File.expand_path(File.dirname(__FILE__))
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.4/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.6/config.log"
7
7
  end
8
8
  ret
9
9
  end
@@ -23,7 +23,7 @@ if RUBY_VERSION >= "1.9"
23
23
  end
24
24
  end
25
25
 
26
- perftools = File.basename('google-perftools-1.4.tar.gz')
26
+ perftools = File.basename('google-perftools-1.6.tar.gz')
27
27
  dir = File.basename(perftools, '.tar.gz')
28
28
 
29
29
  puts "(I'm about to compile google-perftools.. this will definitely take a while)"
@@ -45,9 +45,7 @@ Dir.chdir('src') do
45
45
  ['perftools-pprof', true],
46
46
  ['perftools-gc', true],
47
47
  ['perftools-osx', RUBY_PLATFORM =~ /darwin/],
48
- ['perftools-osx-106', RUBY_PLATFORM =~ /darwin10/],
49
48
  ['perftools-debug', true],
50
- ['perftools-realtime', true],
51
49
  ['perftools-objects', true],
52
50
  ['perftools-frames', true]
53
51
  ].each do |patch, apply|
@@ -1,14 +1,14 @@
1
1
  diff --git a/Makefile.in b/Makefile.in
2
- index 0ddc27c..1869975 100644
2
+ index b301f4d..969db5e 100644
3
3
  --- a/Makefile.in
4
4
  +++ b/Makefile.in
5
- @@ -53,9 +53,7 @@ host_triplet = @host@
6
- @ENABLE_FRAME_POINTERS_TRUE@@X86_64_TRUE@am__append_3 = -fno-omit-frame-pointer
7
- @ENABLE_FRAME_POINTERS_FALSE@@X86_64_TRUE@am__append_4 = -DNO_FRAME_POINTER
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
8
  @MINGW_TRUE@am__append_5 = -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_22)
11
+ - $(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_23)
12
12
  +noinst_PROGRAMS =
13
13
  bin_PROGRAMS =
14
14
  @MINGW_TRUE@am__append_6 = libwindows.la libspinlock.la
@@ -1,14 +1,8 @@
1
- commit 5ffd87871619a750ad19e247670a0887a6d38fbd
2
- Author: Aman Gupta <aman@tmm1.net>
3
- Date: Sun Aug 1 18:50:38 2010 -0700
4
-
5
- perftools-objects
6
-
7
1
  diff --git a/src/profile-handler.cc b/src/profile-handler.cc
8
- index 619b980..2ecf2c0 100644
2
+ index 5df5054..2335617 100644
9
3
  --- a/src/profile-handler.cc
10
4
  +++ b/src/profile-handler.cc
11
- @@ -402,6 +402,8 @@ void ProfileHandler::GetState(ProfileHandlerState* state) {
5
+ @@ -395,6 +395,8 @@ void ProfileHandler::GetState(ProfileHandlerState* state) {
12
6
  }
13
7
 
14
8
  void ProfileHandler::StartTimer() {
@@ -17,7 +11,7 @@ index 619b980..2ecf2c0 100644
17
11
  struct itimerval timer;
18
12
  timer.it_interval.tv_sec = 0;
19
13
  timer.it_interval.tv_usec = 1000000 / frequency_;
20
- @@ -410,12 +412,16 @@ void ProfileHandler::StartTimer() {
14
+ @@ -403,12 +405,16 @@ void ProfileHandler::StartTimer() {
21
15
  }
22
16
 
23
17
  void ProfileHandler::StopTimer() {
@@ -25,16 +19,16 @@ index 619b980..2ecf2c0 100644
25
19
  +
26
20
  struct itimerval timer;
27
21
  memset(&timer, 0, sizeof timer);
28
- setitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &timer, 0);
22
+ setitimer(timer_type_, &timer, 0);
29
23
  }
30
24
 
31
25
  bool ProfileHandler::IsTimerRunning() {
32
26
  + if (getenv("CPUPROFILE_OBJECTS") || getenv("CPUPROFILE_METHODS")) return false;
33
27
  +
34
28
  struct itimerval current_timer;
35
- RAW_CHECK(0 == getitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &current_timer), "getitimer");
29
+ RAW_CHECK(0 == getitimer(timer_type_, &current_timer), "getitimer");
36
30
  return (current_timer.it_value.tv_sec != 0 ||
37
- @@ -423,6 +429,8 @@ bool ProfileHandler::IsTimerRunning() {
31
+ @@ -416,6 +422,8 @@ bool ProfileHandler::IsTimerRunning() {
38
32
  }
39
33
 
40
34
  void ProfileHandler::EnableHandler() {
@@ -43,7 +37,7 @@ index 619b980..2ecf2c0 100644
43
37
  struct sigaction sa;
44
38
  sa.sa_sigaction = SignalHandler;
45
39
  sa.sa_flags = SA_RESTART | SA_SIGINFO;
46
- @@ -431,6 +439,8 @@ void ProfileHandler::EnableHandler() {
40
+ @@ -425,6 +433,8 @@ void ProfileHandler::EnableHandler() {
47
41
  }
48
42
 
49
43
  void ProfileHandler::DisableHandler() {
@@ -53,10 +47,10 @@ index 619b980..2ecf2c0 100644
53
47
  sa.sa_handler = SIG_IGN;
54
48
  sa.sa_flags = SA_RESTART;
55
49
  diff --git a/src/profiler.cc b/src/profiler.cc
56
- index 37234b2..905288f 100644
50
+ index f408cf8..7645c45 100644
57
51
  --- a/src/profiler.cc
58
52
  +++ b/src/profiler.cc
59
- @@ -97,6 +97,10 @@ class CpuProfiler {
53
+ @@ -102,6 +102,10 @@ class CpuProfiler {
60
54
 
61
55
  static CpuProfiler instance_;
62
56
 
@@ -67,7 +61,7 @@ index 37234b2..905288f 100644
67
61
  private:
68
62
  // This lock implements the locking requirements described in the ProfileData
69
63
  // documentation, specifically:
70
- @@ -125,10 +129,6 @@ class CpuProfiler {
64
+ @@ -130,10 +134,6 @@ class CpuProfiler {
71
65
 
72
66
  // Disables receiving SIGPROF interrupt.
73
67
  void DisableHandler();
@@ -78,7 +72,7 @@ index 37234b2..905288f 100644
78
72
  };
79
73
 
80
74
  // Profile data structure singleton: Constructor will check to see if
81
- @@ -318,6 +318,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
75
+ @@ -323,6 +323,10 @@ extern "C" PERFTOOLS_DLL_DECL void ProfilerFlush() {
82
76
  extern "C" PERFTOOLS_DLL_DECL void ProfilerGcMark(void (*cb)(VALUE)) {
83
77
  CpuProfiler::instance_.GcMark(cb);
84
78
  }
@@ -1,8 +1,14 @@
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
+
1
7
  diff --git a/src/pprof b/src/pprof
2
- index b5ef29a..25b956d 100755
8
+ index e67e42e..b04d988 100755
3
9
  --- a/src/pprof
4
10
  +++ b/src/pprof
5
- @@ -530,7 +530,8 @@ sub Main() {
11
+ @@ -560,7 +560,8 @@ sub Main() {
6
12
  my $symbol_map = {};
7
13
 
8
14
  # Read one profile, pick the last item on the list
@@ -12,36 +18,38 @@ index b5ef29a..25b956d 100755
12
18
  my $profile = $data->{profile};
13
19
  my $pcs = $data->{pcs};
14
20
  my $libs = $data->{libs}; # Info about main program and shared libraries
15
- @@ -567,6 +568,17 @@ sub Main() {
16
- $symbols = ExtractSymbols($libs, $pcs);
17
- }
21
+ @@ -589,7 +590,18 @@ sub Main() {
18
22
 
23
+ # Collect symbols
24
+ my $symbols;
25
+ - if ($main::use_symbolized_profile) {
19
26
  + if (-e "$fname.symbols") {
20
27
  + open(SYMBOLS, "<$fname.symbols");
21
28
  + while(<SYMBOLS>){
22
29
  + chop;
23
30
  + if (m/(.+?)\s*:\s*(.*)/){
24
31
  + $symbols->{$1}[0] = $2;
32
+ + $symbols->{$1}[1] = "?";
33
+ + $symbols->{$1}[2] = $2;
25
34
  + }
26
35
  + }
27
36
  + close(SYMBOLS);
28
- + }
29
- +
30
- # Remove uniniteresting stack items
31
- $profile = RemoveUninterestingFrames($symbols, $profile);
32
-
33
- @@ -1927,6 +1927,10 @@ sub RemoveUninterestingFrames {
34
- 'ProfileData::prof_handler', # historical
35
- 'CpuProfiler::prof_handler',
37
+ + } elsif ($main::use_symbolized_profile) {
38
+ $symbols = FetchSymbols($pcs, $symbol_map);
39
+ } elsif ($main::use_symbol_page) {
40
+ $symbols = FetchSymbols($pcs);
41
+ @@ -2425,6 +2437,10 @@ sub RemoveUninterestingFrames {
42
+ foreach my $name ('ProfileData::Add', # historical
43
+ 'ProfileData::prof_handler', # historical
44
+ 'CpuProfiler::prof_handler',
45
+ + 'PerfTools::CpuProfiler.start',
46
+ + 'Array#each',
47
+ + 'Proc#call',
48
+ + 'Class#new',
36
49
  '__FRAME_END__',
37
- + 'PerfTools::CpuProfiler.start',
38
- + 'Array#each',
39
- + 'Proc#call',
40
- + 'Class#new',
41
- '__pthread_sighandler',
42
- '__restore') {
43
- $skip{$name} = 1;
44
- @@ -1935,6 +1936,7 @@ sub RemoveUninterestingFrames {
50
+ '__pthread_sighandler',
51
+ '__restore') {
52
+ @@ -2434,6 +2450,7 @@ sub RemoveUninterestingFrames {
45
53
  # Nothing skipped for unknown types
46
54
  }
47
55
 
@@ -49,7 +57,7 @@ index b5ef29a..25b956d 100755
49
57
  if ($main::profile_type eq 'cpu') {
50
58
  # If all the second-youngest program counters are the same,
51
59
  # this STRONGLY suggests that it is an artifact of measurement,
52
- @@ -1959,6 +1961,7 @@ sub RemoveUninterestingFrames {
60
+ @@ -2458,6 +2475,7 @@ sub RemoveUninterestingFrames {
53
61
  $profile = $result;
54
62
  }
55
63
  }
@@ -57,3 +65,12 @@ index b5ef29a..25b956d 100755
57
65
 
58
66
  my $result = {};
59
67
  foreach my $k (keys(%{$profile})) {
68
+ @@ -3360,7 +3378,7 @@ sub ReadCPUProfile {
69
+ # file, in which case the subtract-one was done when the file
70
+ # was written.
71
+ if ($j > 0 && !$main::use_symbolized_profile) {
72
+ - $pc--;
73
+ + # $pc--;
74
+ }
75
+ $pc = sprintf("%0*x", $address_length, $pc);
76
+ $pcs->{$pc} = 1;
@@ -264,20 +264,3 @@ index d158eea..e8509fe 100644
264
264
  # error Cannot calculate stack trace: will need to write for your environment
265
265
  #endif
266
266
  +#endif
267
- diff --git a/src/stacktrace_with_context.cc b/src/stacktrace_with_context.cc
268
- index ed7bfe3..a90c070 100644
269
- --- a/src/stacktrace_with_context.cc
270
- +++ b/src/stacktrace_with_context.cc
271
- @@ -41,6 +41,7 @@
272
- // may inline this code anyway. Let's hope they respect
273
- // ATTRIBUTE_NOINLINE.
274
-
275
- +#ifndef BUILD_FOR_RUBY
276
- #include <config.h>
277
- #include <google/stacktrace.h>
278
- #include "stacktrace_config.h"
279
- @@ -59,3 +60,4 @@ int GetStackTraceWithContext(void** result, int max_depth,
280
- return GetStackTrace(result, max_depth, skip_count + 1);
281
- }
282
- #endif
283
- +#endif
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'perftools.rb'
3
- s.version = '0.5.2'
3
+ s.version = '0.5.3'
4
4
  s.date = '2010-11-12'
5
5
  s.rubyforge_project = 'perftools-rb'
6
6
  s.summary = 'google-perftools for ruby code'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 2
9
- version: 0.5.2
8
+ - 3
9
+ version: 0.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aman Gupta
@@ -31,7 +31,7 @@ files:
31
31
  - bin/pprof.rb
32
32
  - ext/extconf.rb
33
33
  - ext/perftools.c
34
- - ext/src/google-perftools-1.4.tar.gz
34
+ - ext/src/google-perftools-1.6.tar.gz
35
35
  - objalloc_tests/Makefile
36
36
  - objalloc_tests/trap.c
37
37
  - patches/perftools-debug.patch
@@ -39,10 +39,8 @@ files:
39
39
  - patches/perftools-gc.patch
40
40
  - patches/perftools-notests.patch
41
41
  - patches/perftools-objects.patch
42
- - patches/perftools-osx-106.patch
43
42
  - patches/perftools-osx.patch
44
43
  - patches/perftools-pprof.patch
45
- - patches/perftools-realtime.patch
46
44
  - patches/perftools.patch
47
45
  - perftools.rb.gemspec
48
46
  has_rdoc: true
@@ -1,96 +0,0 @@
1
- diff --git a/Makefile.in b/Makefile.in
2
- index c613939..1a901d5 100644
3
- --- a/Makefile.in
4
- diff --git a/src/base/sysinfo.cc b/src/base/sysinfo.cc
5
- index a2bc2a9..10b8886 100644
6
- --- a/src/base/sysinfo.cc
7
- +++ b/src/base/sysinfo.cc
8
- @@ -728,26 +728,59 @@ bool ProcMapsIterator::NextExt(uint64 *start, uint64 *end, char **flags,
9
-
10
- // We start with the next load command (we've already looked at this one).
11
- for (current_load_cmd_--; current_load_cmd_ >= 0; current_load_cmd_--) {
12
- - const char* lc = ((const char *)hdr + sizeof(struct mach_header));
13
- + const char* lc;
14
- + uint32_t seg_marker;
15
- + #if defined(MH_MAGIC_64)
16
- + if (hdr->magic == MH_MAGIC_64) {
17
- + lc = ((const char *)hdr + sizeof(struct mach_header_64));
18
- + seg_marker = LC_SEGMENT_64;
19
- + } else {
20
- + #endif
21
- + lc = ((const char *)hdr + sizeof(struct mach_header));
22
- + seg_marker = LC_SEGMENT;
23
- + #if defined(MH_MAGIC_64)
24
- + }
25
- + #endif
26
- // TODO(csilvers): make this not-quadradic (increment and hold state)
27
- for (int j = 0; j < current_load_cmd_; j++) // advance to *our* load_cmd
28
- lc += ((const load_command *)lc)->cmdsize;
29
- - if (((const load_command *)lc)->cmd == LC_SEGMENT) {
30
- + if (((const load_command *)lc)->cmd == seg_marker) {
31
- const intptr_t dlloff = _dyld_get_image_vmaddr_slide(current_image_);
32
- - const segment_command* sc = (const segment_command *)lc;
33
- - if (start) *start = sc->vmaddr + dlloff;
34
- - if (end) *end = sc->vmaddr + sc->vmsize + dlloff;
35
- - if (flags) *flags = kDefaultPerms; // can we do better?
36
- - if (offset) *offset = sc->fileoff;
37
- - if (inode) *inode = 0;
38
- - if (filename)
39
- - *filename = const_cast<char*>(_dyld_get_image_name(current_image_));
40
- - if (file_mapping) *file_mapping = 0;
41
- - if (file_pages) *file_pages = 0; // could we use sc->filesize?
42
- - if (anon_mapping) *anon_mapping = 0;
43
- - if (anon_pages) *anon_pages = 0;
44
- - if (dev) *dev = 0;
45
- - return true;
46
- + #if defined(MH_MAGIC_64)
47
- + if (hdr->magic == MH_MAGIC_64) {
48
- + const segment_command_64* sc = (const segment_command_64 *)lc;
49
- + if (start) *start = sc->vmaddr + dlloff;
50
- + if (end) *end = sc->vmaddr + sc->vmsize + dlloff;
51
- + if (flags) *flags = kDefaultPerms; // can we do better?
52
- + if (offset) *offset = sc->fileoff;
53
- + if (inode) *inode = 0;
54
- + if (filename)
55
- + *filename = const_cast<char*>(_dyld_get_image_name(current_image_));
56
- + if (file_mapping) *file_mapping = 0;
57
- + if (file_pages) *file_pages = 0; // could we use sc->filesize?
58
- + if (anon_mapping) *anon_mapping = 0;
59
- + if (anon_pages) *anon_pages = 0;
60
- + if (dev) *dev = 0;
61
- + return true;
62
- + } else {
63
- + #endif
64
- + const segment_command* sc = (const segment_command *)lc;
65
- + if (start) *start = sc->vmaddr + dlloff;
66
- + if (end) *end = sc->vmaddr + sc->vmsize + dlloff;
67
- + if (flags) *flags = kDefaultPerms; // can we do better?
68
- + if (offset) *offset = sc->fileoff;
69
- + if (inode) *inode = 0;
70
- + if (filename)
71
- + *filename = const_cast<char*>(_dyld_get_image_name(current_image_));
72
- + if (file_mapping) *file_mapping = 0;
73
- + if (file_pages) *file_pages = 0; // could we use sc->filesize?
74
- + if (anon_mapping) *anon_mapping = 0;
75
- + if (anon_pages) *anon_pages = 0;
76
- + if (dev) *dev = 0;
77
- + return true;
78
- + #if defined(MH_MAGIC_64)
79
- + }
80
- + #endif
81
- }
82
- }
83
- // If we get here, no more load_cmd's in this image talk about
84
- diff --git a/src/pprof b/src/pprof
85
- index 3531300..b256ed2 100755
86
- --- a/src/pprof
87
- +++ b/src/pprof
88
- @@ -3193,7 +3193,7 @@ sub ParseTextSectionHeaderFromOtool {
89
- $sectname = $1;
90
- } elsif ($line =~ /segname (\w+)/) {
91
- $segname = $1;
92
- - } elsif (!($cmd eq "LC_SEGMENT" &&
93
- + } elsif (!(($cmd eq "LC_SEGMENT" || $cmd eq "LC_SEGMENT_64") &&
94
- $sectname eq "__text" &&
95
- $segname eq "__TEXT")) {
96
- next;
@@ -1,68 +0,0 @@
1
- diff --git a/src/profile-handler.cc b/src/profile-handler.cc
2
- index 370d012..619b980 100644
3
- --- a/src/profile-handler.cc
4
- +++ b/src/profile-handler.cc
5
- @@ -133,6 +133,9 @@ class ProfileHandler {
6
- // SIGPROF interrupt frequency, read-only after construction.
7
- int32 frequency_;
8
-
9
- + // use SIGALRM/ITIMER_REAL
10
- + bool realtime_;
11
- +
12
- // Counts the number of callbacks registered.
13
- int32 callback_count_ GUARDED_BY(control_lock_);
14
-
15
- @@ -241,6 +244,13 @@ ProfileHandler::ProfileHandler()
16
- callback_count_(0),
17
- timer_sharing_(TIMERS_UNTOUCHED) {
18
- SpinLockHolder cl(&control_lock_);
19
- +
20
- + const char* rt = getenv("CPUPROFILE_REALTIME");
21
- + if (rt != NULL)
22
- + realtime_ = true;
23
- + else
24
- + realtime_ = false;
25
- +
26
- // Get frequency of interrupts (if specified)
27
- char junk;
28
- const char* fr = getenv("CPUPROFILE_FREQUENCY");
29
- @@ -396,18 +406,18 @@ void ProfileHandler::StartTimer() {
30
- timer.it_interval.tv_sec = 0;
31
- timer.it_interval.tv_usec = 1000000 / frequency_;
32
- timer.it_value = timer.it_interval;
33
- - setitimer(ITIMER_PROF, &timer, 0);
34
- + setitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &timer, 0);
35
- }
36
-
37
- void ProfileHandler::StopTimer() {
38
- struct itimerval timer;
39
- memset(&timer, 0, sizeof timer);
40
- - setitimer(ITIMER_PROF, &timer, 0);
41
- + setitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &timer, 0);
42
- }
43
-
44
- bool ProfileHandler::IsTimerRunning() {
45
- struct itimerval current_timer;
46
- - RAW_CHECK(0 == getitimer(ITIMER_PROF, &current_timer), "getitimer");
47
- + RAW_CHECK(0 == getitimer(realtime_ ? ITIMER_REAL : ITIMER_PROF, &current_timer), "getitimer");
48
- return (current_timer.it_value.tv_sec != 0 ||
49
- current_timer.it_value.tv_usec != 0);
50
- }
51
- @@ -417,7 +427,7 @@ void ProfileHandler::EnableHandler() {
52
- sa.sa_sigaction = SignalHandler;
53
- sa.sa_flags = SA_RESTART | SA_SIGINFO;
54
- sigemptyset(&sa.sa_mask);
55
- - RAW_CHECK(sigaction(SIGPROF, &sa, NULL) == 0, "sigprof (enable)");
56
- + RAW_CHECK(sigaction(realtime_ ? SIGALRM : SIGPROF, &sa, NULL) == 0, "sigprof (enable)");
57
- }
58
-
59
- void ProfileHandler::DisableHandler() {
60
- @@ -425,7 +435,7 @@ void ProfileHandler::DisableHandler() {
61
- sa.sa_handler = SIG_IGN;
62
- sa.sa_flags = SA_RESTART;
63
- sigemptyset(&sa.sa_mask);
64
- - RAW_CHECK(sigaction(SIGPROF, &sa, NULL) == 0, "sigprof (disable)");
65
- + RAW_CHECK(sigaction(realtime_ ? SIGALRM : SIGPROF, &sa, NULL) == 0, "sigprof (disable)");
66
- }
67
-
68
- void ProfileHandler::SignalHandler(int sig, siginfo_t* sinfo, void* ucontext) {