rails-dtrace 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -31,17 +31,6 @@ And then execute:
31
31
  $ bundle
32
32
  ```
33
33
 
34
- If you are using edge Rails (master/4.0), the notification syntax has
35
- changed in an awesome way. In this case, you'll want the `rails_4`
36
- branch.
37
-
38
- ```ruby
39
- gem 'ruby-usdt', :git => 'git://github.com/chrisa/ruby-usdt.git',
40
- :submodules => true, :branch => 'disable_provider'
41
- gem 'rails-dtrace', :git => 'git://github.com/sax/rails-dtrace.git',
42
- :branch => 'rails_4'
43
- ```
44
-
45
34
  ## Warning
46
35
 
47
36
  This gem in an experiment in progress. The code does not have automated
@@ -71,7 +60,7 @@ Arguments to probes are:
71
60
 
72
61
  The notification name is turned into the probe function, and the probe name is defined as 'event'. For instance, `sql.active_record` becomes `ruby*:rails:sql.active_record:event`. This is to make events somewhat compatible with the edge Rails method of firing events, described below.
73
62
 
74
- Some operating systems (MacOS X, I'm looking at you) don't give you nanosecond time resolution. In this case you get microseconds multipled by 1000.
63
+ Some operating systems (MacOS X, I'm looking at you) don't give you nanosecond time resolution. In this case you get microseconds multipled by 1000. If the time differential is larger than the maximum value of a C int *(2147483647)*, then that will be output instead.
75
64
 
76
65
  The following dtrace command can be used, as an example:
77
66
 
@@ -96,7 +85,7 @@ Example output:
96
85
 
97
86
  ### Rails 4 / Edge Rails
98
87
 
99
- Note that you need to use the `rails_4` branch in order for this to work. In newer Rails, notifications become more dtrace-like. Rather than a notification sending a message to `#call` (which gets start time and end time), they can send two messages, `#start` and `#finish`. This way, you can do your own math on the notifications.
88
+ In newer Rails, notifications become more dtrace-like. Rather than a notification sending a message to `#call` (which gets start time and end time), they can send two messages, `#start` and `#finish`. This way, you can do your own math on the notification timing.
100
89
 
101
90
  In *rails-dtrace*, the notification name becomes the probe function, and we map `start -> entry` and `finish -> exit`.
102
91
 
@@ -106,6 +95,7 @@ Arguments to probes are:
106
95
 
107
96
  * `arg0` - Unique identifier of notification - String
108
97
  * `arg1` - Stringified hash of notification payload - String
98
+ * `arg2` - 0 - This is for seamless compatibility with older Rails - Integer
109
99
 
110
100
  The following dtrace command can be used, as an example:
111
101
 
@@ -2,6 +2,8 @@ require 'usdt'
2
2
 
3
3
  module DTrace
4
4
  class Subscriber
5
+ MAX_INT = 2147483647
6
+
5
7
  cattr_reader :probes, :provider
6
8
 
7
9
  @@provider = USDT::Provider.create :ruby, :rails
@@ -64,7 +66,7 @@ module DTrace
64
66
 
65
67
  def nsec_time_diff(start_time, end_time)
66
68
  return 0 unless start_time and end_time
67
- ((end_time - start_time) * 1000000000).to_i
69
+ [((end_time - start_time) * 1000000000).to_i, MAX_INT].min
68
70
  end
69
71
  end
70
72
  end
@@ -1,3 +1,3 @@
1
1
  module Dtrace
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/rails-dtrace.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["sax@livinginthepast.org"]
7
7
  gem.description = %q{Turn ActiveSupport::Notification instruments into DTrace probes. This allows you to trace Rails apps.}
8
8
  gem.summary = %q{Add DTrace probes to Rails}
9
- gem.homepage = "https://github.com/sax/dtrace-rails"
9
+ gem.homepage = "https://github.com/sax/rails-dtrace"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| ::File.basename(f) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-dtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-12 00:00:00.000000000 Z
12
+ date: 2012-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-usdt
@@ -63,7 +63,7 @@ files:
63
63
  - lib/rails-dtrace/version.rb
64
64
  - rails-dtrace.gemspec
65
65
  - spec/spec_helper.rb
66
- homepage: https://github.com/sax/dtrace-rails
66
+ homepage: https://github.com/sax/rails-dtrace
67
67
  licenses: []
68
68
  post_install_message:
69
69
  rdoc_options: []
@@ -75,12 +75,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
+ segments:
79
+ - 0
80
+ hash: 860083072597597217
78
81
  required_rubygems_version: !ruby/object:Gem::Requirement
79
82
  none: false
80
83
  requirements:
81
84
  - - ! '>='
82
85
  - !ruby/object:Gem::Version
83
86
  version: '0'
87
+ segments:
88
+ - 0
89
+ hash: 860083072597597217
84
90
  requirements: []
85
91
  rubyforge_project:
86
92
  rubygems_version: 1.8.24
@@ -89,4 +95,3 @@ specification_version: 3
89
95
  summary: Add DTrace probes to Rails
90
96
  test_files:
91
97
  - spec/spec_helper.rb
92
- has_rdoc: