perftools.rb 0.1.6 → 0.1.8

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.
data/README CHANGED
@@ -139,6 +139,12 @@ google-perftools for ruby code
139
139
 
140
140
  === Resources
141
141
 
142
+ GoRuCo 2009 Lightning Talk on perftools.rb
143
+ http://goruco2009.confreaks.com/30-may-2009-18-35-rejectconf-various-presenters.html at 21:52
144
+
145
+ Ilya Grigorik's introduction to perftools.rb
146
+ http://www.igvita.com/2009/06/13/profiling-ruby-with-googles-perftools/
147
+
142
148
  Google Perftools
143
149
  http://code.google.com/p/google-perftools/
144
150
 
data/ext/extconf.rb CHANGED
@@ -1,8 +1,13 @@
1
1
  require 'mkmf'
2
+
3
+ if have_func('rb_thread_blocking_region')
4
+ raise 'Ruby 1.9 is not supported yet'
5
+ end
6
+
2
7
  require 'fileutils'
3
8
  require 'net/http'
4
9
 
5
- url = 'http://google-perftools.googlecode.com/files/google-perftools-1.2.tar.gz'
10
+ url = 'http://google-perftools.googlecode.com/files/google-perftools-1.3.tar.gz'
6
11
  perftools = File.basename(url)
7
12
  dir = File.basename(perftools, '.tar.gz')
8
13
 
@@ -10,9 +15,15 @@ Logging.message "(I'm about to download and compile google-perftools.. this will
10
15
 
11
16
  FileUtils.mkdir_p('src')
12
17
 
18
+ if proxy = URI(ENV['http_proxy'] || ENV['HTTP_PROXY']) rescue nil
19
+ proxy_host = proxy.host
20
+ proxy_port = proxy.port
21
+ proxy_user, proxy_pass = proxy.userinfo.split(/:/) if proxy.userinfo
22
+ end
23
+
13
24
  Dir.chdir('src') do
14
25
  unless File.exists?(perftools)
15
- Net::HTTP.get_response(URI(url)) do |res|
26
+ Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass).get_response(URI(url)) do |res|
16
27
  File.open(perftools, 'wb') do |out|
17
28
  res.read_body do |chunk|
18
29
  out.write(chunk)
@@ -25,7 +36,6 @@ Dir.chdir('src') do
25
36
  xsystem("tar zxvf #{perftools}")
26
37
  Dir.chdir(dir) do
27
38
  xsystem("patch -p1 < ../../../patches/perftools.patch")
28
- xsystem("patch -p1 < ../../../patches/perftools-static.patch")
29
39
  xsystem("patch -p1 < ../../../patches/perftools-osx.patch") if RUBY_PLATFORM =~ /darwin/
30
40
  xsystem("patch -p1 < ../../../patches/perftools-debug.patch")# if ENV['DEBUG']
31
41
  end
@@ -37,11 +47,11 @@ Dir.chdir('src') do
37
47
  end
38
48
  end
39
49
 
40
- unless File.exists?('../libprofiler.a')
50
+ unless File.exists?('../librubyprofiler.a')
41
51
  Dir.chdir(dir) do
42
52
  xsystem("./configure --disable-heap-profiler --disable-heap-checker --disable-shared")
43
53
  xsystem("make")
44
- FileUtils.cp '.libs/libprofiler.a', '../../'
54
+ FileUtils.cp '.libs/libprofiler.a', '../../librubyprofiler.a'
45
55
  end
46
56
  end
47
57
  end
@@ -51,6 +61,6 @@ when /darwin/, /linux/
51
61
  CONFIG['LDSHARED'] = "$(CXX) " + CONFIG['LDSHARED'].split[1..-1].join(' ')
52
62
  end
53
63
 
54
- $libs = append_library($libs, 'profiler')
64
+ $libs = append_library($libs, 'rubyprofiler')
55
65
  have_func('rb_during_gc', 'ruby.h')
56
- create_makefile 'perftools'
66
+ create_makefile 'perftools'
@@ -1,8 +1,8 @@
1
1
  diff --git a/Makefile.in b/Makefile.in
2
- index 1247b91..45179f3 100644
2
+ index a7a4fb5..bfa0347 100644
3
3
  --- a/Makefile.in
4
4
  +++ b/Makefile.in
5
- @@ -989,13 +989,13 @@ AUTOMAKE = @AUTOMAKE@
5
+ @@ -1067,13 +1067,13 @@ AUTOMAKE = @AUTOMAKE@
6
6
  AWK = @AWK@
7
7
  CC = @CC@
8
8
  CCDEPMODE = @CCDEPMODE@
@@ -1,8 +1,8 @@
1
1
  diff --git a/Makefile.in b/Makefile.in
2
- index 1247b91..3f6e133 100644
2
+ index e3690b2..a7a4fb5 100644
3
3
  --- a/Makefile.in
4
4
  +++ b/Makefile.in
5
- @@ -1017,7 +1017,7 @@ INSTALL_DATA = @INSTALL_DATA@
5
+ @@ -1097,7 +1097,7 @@ INSTALL_DATA = @INSTALL_DATA@
6
6
  INSTALL_PROGRAM = @INSTALL_PROGRAM@
7
7
  INSTALL_SCRIPT = @INSTALL_SCRIPT@
8
8
  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
@@ -1,5 +1,25 @@
1
+ diff --git a/Makefile.in b/Makefile.in
2
+ index 8ba85fb..e3690b2 100644
3
+ --- a/Makefile.in
4
+ +++ b/Makefile.in
5
+ @@ -1067,13 +1067,13 @@ AUTOMAKE = @AUTOMAKE@
6
+ AWK = @AWK@
7
+ CC = @CC@
8
+ CCDEPMODE = @CCDEPMODE@
9
+ -CFLAGS = @CFLAGS@
10
+ +CFLAGS = @CFLAGS@ -DBUILD_FOR_RUBY -fPIC
11
+ CPP = @CPP@
12
+ CPPFLAGS = @CPPFLAGS@
13
+ CXX = @CXX@
14
+ CXXCPP = @CXXCPP@
15
+ CXXDEPMODE = @CXXDEPMODE@
16
+ -CXXFLAGS = @CXXFLAGS@
17
+ +CXXFLAGS = @CXXFLAGS@ -DBUILD_FOR_RUBY -fPIC
18
+ CYGPATH_W = @CYGPATH_W@
19
+ DEFS = @DEFS@
20
+ DEPDIR = @DEPDIR@
1
21
  diff --git a/src/pprof b/src/pprof
2
- index f23786d..21ccd12 100755
22
+ index 9d4d0e8..a41fcb1 100755
3
23
  --- a/src/pprof
4
24
  +++ b/src/pprof
5
25
  @@ -504,7 +504,8 @@ sub Main() {
@@ -12,8 +32,8 @@ index f23786d..21ccd12 100755
12
32
  my $profile = $data->{profile};
13
33
  my $pcs = $data->{pcs};
14
34
  my $libs = $data->{libs}; # Info about main program and shared libraries
15
- @@ -536,6 +537,17 @@ sub Main() {
16
- $symbols = ExtractSymbols($libs, $pcs);
35
+ @@ -549,6 +550,17 @@ sub Main() {
36
+ $profile = IgnoreProfile($symbols, $profile, $main::opt_ignore);
17
37
  }
18
38
 
19
39
  + if (-e "$fname.symbols") {
@@ -29,12 +49,12 @@ index f23786d..21ccd12 100755
29
49
  +
30
50
  my $calls = ExtractCalls($symbols, $profile);
31
51
 
32
- # Remove uniniteresting stack items
52
+ # Reduce profiles to required output granularity, and also clean
33
53
  diff --git a/src/profile-handler.cc b/src/profile-handler.cc
34
- index 0a9f54c..5b99a81 100644
54
+ index e658d30..370d012 100644
35
55
  --- a/src/profile-handler.cc
36
56
  +++ b/src/profile-handler.cc
37
- @@ -263,6 +263,11 @@ ProfileHandler::~ProfileHandler() {
57
+ @@ -264,6 +264,11 @@ ProfileHandler::~ProfileHandler() {
38
58
  void ProfileHandler::RegisterThread() {
39
59
  SpinLockHolder cl(&control_lock_);
40
60
 
@@ -46,7 +66,7 @@ index 0a9f54c..5b99a81 100644
46
66
  // We try to detect whether timers are being shared by setting a
47
67
  // timer in the first call to this function, then checking whether
48
68
  // it's set in the second call.
49
- @@ -304,6 +309,7 @@ void ProfileHandler::RegisterThread() {
69
+ @@ -305,6 +310,7 @@ void ProfileHandler::RegisterThread() {
50
70
  StartTimer();
51
71
  break;
52
72
  }
@@ -246,7 +266,7 @@ index c51c7b2..21c7669 100644
246
266
  }
247
267
 
248
268
  diff --git a/src/stacktrace.cc b/src/stacktrace.cc
249
- index d158eea..e4132fe 100644
269
+ index d158eea..e8509fe 100644
250
270
  --- a/src/stacktrace.cc
251
271
  +++ b/src/stacktrace.cc
252
272
  @@ -52,6 +52,7 @@
@@ -254,7 +274,7 @@ index d158eea..e4132fe 100644
254
274
  // Some code may do that.
255
275
 
256
276
  +#ifndef BUILD_FOR_RUBY
257
- #include "config.h"
277
+ #include <config.h>
258
278
  #include <google/stacktrace.h>
259
279
  #include "stacktrace_config.h"
260
280
  @@ -69,3 +70,4 @@
@@ -262,29 +282,8 @@ index d158eea..e4132fe 100644
262
282
  # error Cannot calculate stack trace: will need to write for your environment
263
283
  #endif
264
284
  +#endif
265
-
266
- diff --git a/Makefile.in b/Makefile.in
267
- index 1247b91..45179f3 100644
268
- --- a/Makefile.in
269
- +++ b/Makefile.in
270
- @@ -989,13 +989,13 @@ AUTOMAKE = @AUTOMAKE@
271
- AWK = @AWK@
272
- CC = @CC@
273
- CCDEPMODE = @CCDEPMODE@
274
- -CFLAGS = @CFLAGS@
275
- +CFLAGS = @CFLAGS@ -DBUILD_FOR_RUBY -fPIC
276
- CPP = @CPP@
277
- CPPFLAGS = @CPPFLAGS@
278
- CXX = @CXX@
279
- CXXCPP = @CXXCPP@
280
- CXXDEPMODE = @CXXDEPMODE@
281
- -CXXFLAGS = @CXXFLAGS@
282
- +CXXFLAGS = @CXXFLAGS@ -DBUILD_FOR_RUBY -fPIC
283
- CYGPATH_W = @CYGPATH_W@
284
- DEFS = @DEFS@
285
- DEPDIR = @DEPDIR@
286
285
  diff --git a/src/stacktrace_with_context.cc b/src/stacktrace_with_context.cc
287
- index f9fc28f..beb7562 100644
286
+ index 02f837d..ca5da92 100644
288
287
  --- a/src/stacktrace_with_context.cc
289
288
  +++ b/src/stacktrace_with_context.cc
290
289
  @@ -41,6 +41,7 @@
@@ -292,7 +291,7 @@ index f9fc28f..beb7562 100644
292
291
  // ATTRIBUTE_NOINLINE.
293
292
 
294
293
  +#ifndef BUILD_FOR_RUBY
295
- #include "config.h"
294
+ #include <config.h>
296
295
  #include <google/stacktrace.h>
297
296
  #include "stacktrace_config.h"
298
297
  @@ -59,3 +60,4 @@ int GetStackTraceWithContext(void** result, int max_depth,
data/perftools.rb.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'perftools.rb'
3
- s.version = '0.1.6'
4
- s.date = '2009-06-02'
3
+ s.version = '0.1.8'
4
+ s.date = '2009-06-15'
5
5
  s.rubyforge_project = 'perftools-rb'
6
6
  s.summary = 'google-perftools for ruby code'
7
7
  s.description = 'A sampling profiler for ruby code based on patches to google-perftools'
@@ -24,7 +24,6 @@ spec = Gem::Specification.new do |s|
24
24
  "ext/perftools.c",
25
25
  "patches/perftools-debug.patch",
26
26
  "patches/perftools-osx.patch",
27
- "patches/perftools-static.patch",
28
27
  "patches/perftools.patch",
29
28
  "perftools.rb.gemspec"
30
29
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perftools.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-02 00:00:00 -04:00
12
+ date: 2009-06-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -28,7 +28,6 @@ files:
28
28
  - ext/perftools.c
29
29
  - patches/perftools-debug.patch
30
30
  - patches/perftools-osx.patch
31
- - patches/perftools-static.patch
32
31
  - patches/perftools.patch
33
32
  - perftools.rb.gemspec
34
33
  has_rdoc: true
@@ -1,27 +0,0 @@
1
- diff --git a/Makefile.in b/Makefile.in
2
- index 1247b91..e7c5bca 100644
3
- --- a/Makefile.in
4
- +++ b/Makefile.in
5
- @@ -3736,14 +3736,14 @@ uninstall-man: uninstall-man1
6
- # (since it does work only in global constructors and destructors).
7
- # We just replace the .a with an 'ld-r-ized' version under libtool's
8
- # nose.
9
- -@WITH_CPU_PROFILER_TRUE@libprofiler.o: libprofiler.la $(libprofiler_la_OBJECTS) $(libprofiler_la_DEPENDENCIES) $(libprofiler_la_LIBADD)
10
- -@WITH_CPU_PROFILER_TRUE@ $(CXXLINK) $(libprofiler_la_OBJECTS) $(libprofiler_la_LIBADD)
11
- -@WITH_CPU_PROFILER_TRUE@ cp -f "$@" .libs/libprofiler.a
12
- -@WITH_CPU_PROFILER_TRUE@profiler_unittest.sh$(EXEEXT): $(top_srcdir)/$(profiler_unittest_sh_SOURCES) \
13
- -@WITH_CPU_PROFILER_TRUE@ profiler1_unittest profiler2_unittest \
14
- -@WITH_CPU_PROFILER_TRUE@ profiler3_unittest profiler4_unittest
15
- -@WITH_CPU_PROFILER_TRUE@ rm -f $@
16
- -@WITH_CPU_PROFILER_TRUE@ cp -p $(top_srcdir)/$(profiler_unittest_sh_SOURCES) $@
17
- +# @WITH_CPU_PROFILER_TRUE@libprofiler.o: libprofiler.la $(libprofiler_la_OBJECTS) $(libprofiler_la_DEPENDENCIES) $(libprofiler_la_LIBADD)
18
- +# @WITH_CPU_PROFILER_TRUE@ $(CXXLINK) $(libprofiler_la_OBJECTS) $(libprofiler_la_LIBADD)
19
- +# @WITH_CPU_PROFILER_TRUE@ cp -f "$@" .libs/libprofiler.a
20
- +# @WITH_CPU_PROFILER_TRUE@profiler_unittest.sh$(EXEEXT): $(top_srcdir)/$(profiler_unittest_sh_SOURCES) \
21
- +# @WITH_CPU_PROFILER_TRUE@ profiler1_unittest profiler2_unittest \
22
- +# @WITH_CPU_PROFILER_TRUE@ profiler3_unittest profiler4_unittest
23
- +# @WITH_CPU_PROFILER_TRUE@ rm -f $@
24
- +# @WITH_CPU_PROFILER_TRUE@ cp -p $(top_srcdir)/$(profiler_unittest_sh_SOURCES) $@
25
-
26
- rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
27
- @cd packages && ./rpm.sh ${PACKAGE} ${VERSION}