dev_panel 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,7 +52,7 @@ module DevPanel
52
52
  border-bottom: 0;
53
53
  border-top-left-radius: 2px;
54
54
  border-top-right-radius: 2px;
55
- text-align:center;
55
+ text-align:left;
56
56
  border: solid 1px #fff;
57
57
  }
58
58
 
@@ -154,11 +154,10 @@ module DevPanel
154
154
  end
155
155
 
156
156
  def html_table
157
- controller_time = (Stats.data[:action_controller].duration - stats(:view_runtime))
158
157
  table_rows = rowify([
159
- first_td("Total:") + td("#{Stats.data[:action_controller].duration.round(2).to_s}ms"),
160
- first_td("Controller:") + td("#{controller_time.round(2).to_s}ms"),
161
- first_td("View:") + td("#{stats(:view_runtime).round(2).to_s}ms"),
158
+ first_td("Total:") + td("#{Stats.total_duration.to_s}ms"),
159
+ first_td("Controller:") + td("#{Stats.controller_duration.to_s}ms (#{Stats.controller_duration_percent}%)"),
160
+ first_td("View:") + td("#{Stats.view_duration.to_s}ms (#{Stats.view_duration_percent}%)"),
162
161
  first_td("Partials:") + td(partial_count),
163
162
  first_td("Response:") + td(stats(:status)),
164
163
  first_td("Controller:") + td(stats(:controller)),
@@ -5,6 +5,11 @@ module DevPanel
5
5
 
6
6
  Rails.application.middleware.use DevPanel::Middleware
7
7
 
8
+ ActiveSupport::Notifications.subscribe(//) do |*args|
9
+ event = ActiveSupport::Notifications::Event.new(*args)
10
+ puts event.inspect
11
+ end
12
+
8
13
  ActiveSupport::Notifications.subscribe('start_processing.action_controller') do |*args|
9
14
  event = ActiveSupport::Notifications::Event.new(*args)
10
15
  Stats.delete_data if event.payload[:format] == :html
@@ -17,6 +17,31 @@ module DevPanel
17
17
  @@data ||= { log: "" }
18
18
  end
19
19
 
20
+ def self.total_duration
21
+ data[:action_controller].duration.round(2)
22
+ end
23
+
24
+ def self.controller_duration
25
+ (data[:action_controller].duration - stats(:view_runtime)).round(2)
26
+ end
27
+
28
+ def self.view_duration
29
+ stats(:view_runtime).round(2)
30
+ end
31
+
32
+ def self.controller_duration_percent
33
+ ((controller_duration / total_duration) * 100).round(0)
34
+ end
35
+
36
+ def self.view_duration_percent
37
+ ((view_duration / total_duration) * 100).round(0)
38
+ end
39
+
40
+ def self.stats(symbol)
41
+ data[:action_controller].payload[symbol]
42
+ end
43
+
44
+
20
45
  def self.delete_data
21
46
  @@data = {}
22
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
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: 2013-08-26 00:00:00.000000000 Z
12
+ date: 2013-08-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A panel that appears in the browser to provide stats on page load times
15
15
  and other debugging information for Rails 3