summaryrefslogtreecommitdiff
path: root/doc/development/instrumentation.md
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-13 18:41:37 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-14 09:30:16 +0200
commit783c21291e36f6491aec68c95b1de805e70e64e9 (patch)
tree55353133f38d20b2cefab932589dbffdd9966ea1 /doc/development/instrumentation.md
parentf34af6b83cc2663bb8a076f4df9c82047e5511ab (diff)
downloadgitlab-ce-18528-cpu-time-instrumentation.tar.gz
Measure CPU time for instrumented methods18528-cpu-time-instrumentation
Diffstat (limited to 'doc/development/instrumentation.md')
-rw-r--r--doc/development/instrumentation.md11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/development/instrumentation.md b/doc/development/instrumentation.md
index 9168c70945a..f788714e67a 100644
--- a/doc/development/instrumentation.md
+++ b/doc/development/instrumentation.md
@@ -97,15 +97,16 @@ def #{name}(#{args_signature})
trans = Gitlab::Metrics::Instrumentation.transaction
if trans
- start = Time.now
- retval = super
- duration = (Time.now - start) * 1000.0
+ start = Time.now
+ cpu_start = Gitlab::Metrics::System.cpu_time
+ retval = super
+ duration = (Time.now - start) * 1000.0
if duration >= Gitlab::Metrics.method_call_threshold
- trans.increment(:method_duration, duration)
+ cpu_duration = (Gitlab::Metrics::System.cpu_time - cpu_start)
trans.add_metric(Gitlab::Metrics::Instrumentation::SERIES,
- { duration: duration },
+ { duration: duration, cpu_duration: cpu_duration },
method: #{label.inspect})
end