4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/traceview/method_profiling.rb', line 4
def profile_wrapper(method, report_kvs, opts, *args, &block)
report_kvs[:Backtrace] = TraceView::API.backtrace(2) if opts[:backtrace]
report_kvs[:Arguments] = args if opts[:arguments]
TraceView::API.log(nil, :profile_entry, report_kvs)
begin
rv = self.send(method, *args, &block)
report_kvs[:ReturnValue] = rv if opts[:result]
rv
rescue => e
TraceView::API.log_exception(nil, e)
raise
ensure
report_kvs.delete(:Backtrace)
report_kvs.delete(:Controller)
report_kvs.delete(:Action)
TraceView::API.log(nil, :profile_exit, report_kvs)
end
end
|