Skip to content

Use runtime.CallersFrames#19

Merged
ChrisHines merged 7 commits intodevelopfrom
feature/callers-frames
Nov 12, 2017
Merged

Use runtime.CallersFrames#19
ChrisHines merged 7 commits intodevelopfrom
feature/callers-frames

Conversation

@ChrisHines
Copy link
Member

Implementation for issue #10. Replacement for PR #13.

Performance relative to v1.6.0:

name old time/op new time/op delta CallVFmt-8 373ns ± 1% 292ns ± 0% -21.58% (p=0.008 n=5+5) CallPlusVFmt-8 478ns ± 0% 350ns ± 3% -26.75% (p=0.008 n=5+5) CallSharpVFmt-8 365ns ± 0% 288ns ± 0% -20.94% (p=0.008 n=5+5) CallSFmt-8 322ns ± 1% 243ns ± 0% -24.49% (p=0.008 n=5+5) CallPlusSFmt-8 421ns ± 0% 291ns ± 0% -30.88% (p=0.016 n=5+4) CallSharpSFmt-8 310ns ± 0% 233ns ± 0% -24.74% (p=0.000 n=5+4) CallDFmt-8 288ns ± 1% 209ns ± 0% -27.33% (p=0.016 n=5+4) CallNFmt-8 282ns ± 0% 262ns ± 0% -7.22% (p=0.000 n=5+4) CallPlusNFmt-8 256ns ± 0% 232ns ± 0% -9.15% (p=0.008 n=5+5) Caller-8 242ns ± 1% 688ns ± 0% +184.60% (p=0.008 n=5+5) Trace-8 581ns ± 0% 1946ns ± 0% +235.20% (p=0.008 n=5+5) Trace10-8 2.28µs ± 3% 5.33µs ± 3% +134.17% (p=0.008 n=5+5) Trace50-8 4.46µs ± 0% 12.97µs ± 0% +191.04% (p=0.008 n=5+5) Trace100-8 8.46µs ± 0% 22.96µs ± 0% +171.38% (p=0.008 n=5+5) CallerAndVFmt-8 683ns ± 0% 1072ns ± 0% +56.88% (p=0.008 n=5+5) TraceAndVFmt-8 1.83µs ± 0% 2.88µs ± 0% +57.39% (p=0.008 n=5+5) Trace10AndVFmt-8 6.70µs ± 3% 8.54µs ± 2% +27.60% (p=0.008 n=5+5) RuntimeCaller-8 491ns ± 0% 488ns ± 0% -0.53% (p=0.016 n=5+4) RuntimeCallerAndFmt-8 770ns ± 0% 778ns ± 3% ~ (p=0.317 n=4+5) FuncForPC-8 7.51ns ± 0% 7.00ns ± 0% -6.82% (p=0.008 n=5+5) FuncFileLine-8 77.7ns ± 0% 77.7ns ± 0% ~ (p=1.000 n=5+5) name old alloc/op new alloc/op delta CallVFmt-8 40.0B ± 0% 88.0B ± 0% +120.00% (p=0.008 n=5+5) CallPlusVFmt-8 72.0B ± 0% 120.0B ± 0% +66.67% (p=0.008 n=5+5) CallSharpVFmt-8 88.0B ± 0% 136.0B ± 0% +54.55% (p=0.008 n=5+5) CallSFmt-8 32.0B ± 0% 80.0B ± 0% +150.00% (p=0.008 n=5+5) CallPlusSFmt-8 64.0B ± 0% 112.0B ± 0% +75.00% (p=0.008 n=5+5) CallSharpSFmt-8 80.0B ± 0% 128.0B ± 0% +60.00% (p=0.008 n=5+5) CallDFmt-8 24.0B ± 0% 72.0B ± 0% +200.00% (p=0.008 n=5+5) CallNFmt-8 48.0B ± 0% 96.0B ± 0% +100.00% (p=0.008 n=5+5) CallPlusNFmt-8 80.0B ± 0% 128.0B ± 0% +60.00% (p=0.008 n=5+5) Caller-8 0.00B 160.00B ± 0% +Inf% (p=0.008 n=5+5) Trace-8 64.0B ± 0% 4544.0B ± 0% +7000.00% (p=0.008 n=5+5) Trace10-8 240B ± 0% 5248B ± 0% +2086.67% (p=0.008 n=5+5) Trace50-8 896B ± 0% 8320B ± 0% +828.57% (p=0.008 n=5+5) Trace100-8 1.79kB ± 0% 11.01kB ± 0% +514.29% (p=0.008 n=5+5) CallerAndVFmt-8 40.0B ± 0% 248.0B ± 0% +520.00% (p=0.008 n=5+5) TraceAndVFmt-8 192B ± 0% 4674B ± 0% +2334.38% (p=0.008 n=5+5) Trace10AndVFmt-8 640B ± 0% 5651B ± 0% +782.97% (p=0.008 n=5+5) RuntimeCaller-8 0.00B 0.00B ~ (all equal) RuntimeCallerAndFmt-8 24.0B ± 0% 24.0B ± 0% ~ (all equal) FuncForPC-8 0.00B 0.00B ~ (all equal) FuncFileLine-8 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta CallVFmt-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) CallPlusVFmt-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) CallSharpVFmt-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) CallSFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) CallPlusSFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) CallSharpSFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) CallDFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) CallNFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) CallPlusNFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) Caller-8 0.00 2.00 ± 0% +Inf% (p=0.008 n=5+5) Trace-8 1.00 ± 0% 3.00 ± 0% +200.00% (p=0.008 n=5+5) Trace10-8 1.00 ± 0% 3.00 ± 0% +200.00% (p=0.008 n=5+5) Trace50-8 1.00 ± 0% 3.00 ± 0% +200.00% (p=0.008 n=5+5) Trace100-8 1.00 ± 0% 3.00 ± 0% +200.00% (p=0.008 n=5+5) CallerAndVFmt-8 3.00 ± 0% 5.00 ± 0% +66.67% (p=0.008 n=5+5) TraceAndVFmt-8 10.0 ± 0% 12.0 ± 0% +20.00% (p=0.008 n=5+5) Trace10AndVFmt-8 32.0 ± 0% 34.0 ± 0% +6.25% (p=0.008 n=5+5) RuntimeCaller-8 0.00 0.00 ~ (all equal) RuntimeCallerAndFmt-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) FuncForPC-8 0.00 0.00 ~ (all equal) FuncFileLine-8 0.00 0.00 ~ (all equal) 
David Kushner and others added 6 commits September 1, 2017 22:40
Although the idea is attractive, Go 1.9 deprecated the ability to reliably use slices of the []uintptr returned from runtime.Callers. It is difficult to implement the CallStack Trim methods without being able to subslice or reverse iterate the []uintptr.
@coveralls
Copy link

coveralls commented Sep 15, 2017

Coverage Status

Coverage increased (+3.5%) to 92.746% when pulling d644040 on feature/callers-frames into 44dafbc on develop.

* Move tests out of stackinternal_test.go in favor of testing externally from stack_test package. * Restrict TestCallerInlinedPanic to Go 1.9 and newer since older versions of Go did not return stack frames for inlined functions.
@coveralls
Copy link

coveralls commented Sep 15, 2017

Coverage Status

Coverage increased (+5.08%) to 94.301% when pulling 93d005d on feature/callers-frames into 44dafbc on develop.

@ChrisHines
Copy link
Member Author

@dkushner, I believe this PR represents a complete refactoring to use runtime.CallersFrames. Care to take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants