sass-prof 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sass-prof/version.rb +1 -1
- data/lib/sass-prof.rb +11 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e37860473bfa73ead2c01c662024505ddf4bab29
|
4
|
+
data.tar.gz: cc7f27493822630a8c35fabb083151fafcd6d182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dd56d83f24ba3a906eaa9e979254c14552f33705e7731ebea0d4070d22d9f66d0901220b92350a664dffff45c2195445137001386c6162d18786ba245a34735
|
7
|
+
data.tar.gz: dc3cecbc78e426b8113e8d87d567c8eea4a0eee19cc2b2fedfed697f7c4a6b206e1868a31ef4c2d2b4c615f8759a9509e22c9c82cfff7939b48bacb0d6b06057
|
data/lib/sass-prof/version.rb
CHANGED
data/lib/sass-prof.rb
CHANGED
@@ -123,25 +123,24 @@ module Sass
|
|
123
123
|
class Profiler
|
124
124
|
attr_accessor :function, :action, :args, :env
|
125
125
|
|
126
|
-
@@t_total = 0
|
127
|
-
@@t_then = 0
|
128
|
-
@@t_now = 0
|
129
|
-
|
130
126
|
def initialize(function, action, args = nil, env = nil)
|
131
127
|
@function = function
|
132
128
|
@action = action
|
133
129
|
@args = args
|
134
130
|
@env = env
|
131
|
+
@t_total = 0
|
132
|
+
@t_then = 0
|
133
|
+
@t_now = 0
|
135
134
|
end
|
136
135
|
|
137
136
|
def start
|
138
|
-
|
137
|
+
@t_then = Time.now
|
139
138
|
end
|
140
139
|
|
141
140
|
def stop
|
142
|
-
|
143
|
-
t_delta = (
|
144
|
-
|
141
|
+
@t_now = Time.now
|
142
|
+
t_delta = (@t_now.to_f - @t_then.to_f) * 1000.0
|
143
|
+
@t_then, @t_total = @t_now, t_delta
|
145
144
|
|
146
145
|
create_fn_report
|
147
146
|
end
|
@@ -154,16 +153,16 @@ module Sass
|
|
154
153
|
|
155
154
|
Prof::Report.add_row fn_report unless Prof::Config.quiet
|
156
155
|
|
157
|
-
if
|
156
|
+
if @t_total > Prof::Config.t_max && action == :invoke
|
158
157
|
raise RuntimeError.new Prof::Formatter.colorize(
|
159
158
|
"Max execution time of #{Prof::Config.t_max}ms reached for function"\
|
160
|
-
" `#{fn_name}()` (took #{
|
159
|
+
" `#{fn_name}()` (took #{@t_total.round(3)}ms)", :red)
|
161
160
|
end
|
162
161
|
end
|
163
162
|
|
164
163
|
def fn_execution_time
|
165
|
-
color =
|
166
|
-
t_exec = "%.#{Prof::Config.precision}f" %
|
164
|
+
color = @t_total > Prof::Config.t_max ? :red : :green
|
165
|
+
t_exec = "%.#{Prof::Config.precision}f" % @t_total
|
167
166
|
Prof::Formatter.colorize t_exec, color
|
168
167
|
end
|
169
168
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezekg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: compass
|