Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(416)

Delta Between Two Patch Sets: src/pkg/runtime/debug.go

Issue 6443115: code review 6443115: pprof: add contention profiling (Closed)
Left Patch Set: diff -r c568561320a3 https://go.googlecode.com/hg/ Created 11 years, 7 months ago
Right Patch Set: diff -r 2aef5548a9cf https://go.googlecode.com/hg/ Created 11 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/chan.c ('k') | src/pkg/runtime/mprof.goc » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package runtime 5 package runtime
6 6
7 // Breakpoint() executes a breakpoint trap. 7 // Breakpoint() executes a breakpoint trap.
8 func Breakpoint() 8 func Breakpoint()
9 9
10 // LockOSThread wires the calling goroutine to its current operating system thre ad. 10 // LockOSThread wires the calling goroutine to its current operating system thre ad.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 func CPUProfile() []byte 131 func CPUProfile() []byte
132 132
133 // SetCPUProfileRate sets the CPU profiling rate to hz samples per second. 133 // SetCPUProfileRate sets the CPU profiling rate to hz samples per second.
134 // If hz <= 0, SetCPUProfileRate turns off profiling. 134 // If hz <= 0, SetCPUProfileRate turns off profiling.
135 // If the profiler is on, the rate cannot be changed without first turning it of f. 135 // If the profiler is on, the rate cannot be changed without first turning it of f.
136 // Most clients should use the runtime/pprof package or 136 // Most clients should use the runtime/pprof package or
137 // the testing package's -test.cpuprofile flag instead of calling 137 // the testing package's -test.cpuprofile flag instead of calling
138 // SetCPUProfileRate directly. 138 // SetCPUProfileRate directly.
139 func SetCPUProfileRate(hz int) 139 func SetCPUProfileRate(hz int)
140 140
141 // ContentionProfileRate controls the fraction of contention events 141 // SetBlockProfileRate controls the fraction of goroutine blocking events
142 // that are recorded and reported in the contention profile. 142 // that are reported in the blocking profile. The profiler aims to sample
143 // The profiler aims to sample an average of 143 // an average of one blocking event per rate nanoseconds spent blocked.
144 // one contention event per ContentionProfileRate contended cycles.
145 // 144 //
146 // To include every contention event in the profile, set ContentionProfileRate t o 1. 145 // To include every blocking event in the profile, pass rate = 1.
147 // To turn off profiling entirely, set ContentionProfileRate to 0. 146 // To turn off profiling entirely, pass rate <= 0.
148 var ContentionProfileRate int = 0 147 func SetBlockProfileRate(rate int)
149 148
150 // ContentionProfileRecord describes contention events originated 149 // BlockProfileRecord describes blocking events originated
151 // at a particular call sequence (stack trace). 150 // at a particular call sequence (stack trace).
152 type ContentionProfileRecord struct { 151 type BlockProfileRecord struct {
153 Count int64 152 Count int64
154 Cycles int64 153 Cycles int64
155 StackRecord 154 StackRecord
156 } 155 }
157 156
158 // ContentionProfile returns n, the number of records in the current contention profile. 157 // BlockProfile returns n, the number of records in the current blocking profile .
159 // If len(p) >= n, ContentionProfile copies the profile into p and returns n, tr ue. 158 // If len(p) >= n, BlockProfile copies the profile into p and returns n, true.
160 // If len(p) < n, ContentionProfile does not change p and returns n, false. 159 // If len(p) < n, BlockProfile does not change p and returns n, false.
161 // 160 //
162 // Most clients should use the runtime/pprof package or 161 // Most clients should use the runtime/pprof package or
163 // the testing package's -test.contentionprofile flag instead 162 // the testing package's -test.blockprofile flag instead
164 // of calling ContentionProfile directly. 163 // of calling BlockProfile directly.
165 func ContentionProfile(p []ContentionProfileRecord) (n int, ok bool) 164 func BlockProfile(p []BlockProfileRecord) (n int, ok bool)
166 165
167 // Stack formats a stack trace of the calling goroutine into buf 166 // Stack formats a stack trace of the calling goroutine into buf
168 // and returns the number of bytes written to buf. 167 // and returns the number of bytes written to buf.
169 // If all is true, Stack formats stack traces of all other goroutines 168 // If all is true, Stack formats stack traces of all other goroutines
170 // into buf after the trace for the current goroutine. 169 // into buf after the trace for the current goroutine.
171 func Stack(buf []byte, all bool) int 170 func Stack(buf []byte, all bool) int
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b