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 12:49:31 +0200
commit120fbbd4875f340b5c863b7e0e3eabcb2796e15d (patch)
tree0b66dc65a31cc14bc8aeb3f009f60518697748a5 /doc/development/instrumentation.md
parent0c0ef7dfb6afb1695b62037fc0fa5aba6ce697d7 (diff)
downloadgitlab-ce-120fbbd4875f340b5c863b7e0e3eabcb2796e15d.tar.gz
Measure CPU time for instrumented methods
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..50d2866ca46 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