LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 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 pprof writes runtime profiling data in the format expected | 5 // Package pprof writes runtime profiling data in the format expected |
6 // by the pprof visualization tool. | 6 // by the pprof visualization tool. |
7 // For more information about pprof, see | 7 // For more information about pprof, see |
8 // http://code.google.com/p/google-perftools/. | 8 // http://code.google.com/p/google-perftools/. |
9 package pprof | 9 package pprof |
10 | 10 |
11 import ( | 11 import ( |
12 "bufio" | 12 "bufio" |
13 "bytes" | 13 "bytes" |
14 "fmt" | 14 "fmt" |
15 "io" | 15 "io" |
16 "runtime" | 16 "runtime" |
17 "sort" | 17 "sort" |
18 "strings" | 18 "strings" |
19 "sync" | 19 "sync" |
20 "text/tabwriter" | 20 "text/tabwriter" |
21 ) | 21 ) |
22 | 22 |
23 // BUG(rsc): A bug in the OS X Snow Leopard 64-bit kernel prevents | 23 // BUG(rsc): Profiles are incomplete and inaccuate on OS X. See http://golang.or
g/issue/6047 for details. |
24 // CPU profiling from giving accurate results on that system. | |
25 | 24 |
26 // A Profile is a collection of stack traces showing the call sequences | 25 // A Profile is a collection of stack traces showing the call sequences |
27 // that led to instances of a particular event, such as allocation. | 26 // that led to instances of a particular event, such as allocation. |
28 // Packages can create and maintain their own profiles; the most common | 27 // Packages can create and maintain their own profiles; the most common |
29 // use is for tracking resources that must be explicitly closed, such as files | 28 // use is for tracking resources that must be explicitly closed, such as files |
30 // or network connections. | 29 // or network connections. |
31 // | 30 // |
32 // A Profile's methods can be called from multiple goroutines simultaneously. | 31 // A Profile's methods can be called from multiple goroutines simultaneously. |
33 // | 32 // |
34 // Each Profile has a unique name. A few profiles are predefined: | 33 // Each Profile has a unique name. A few profiles are predefined: |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 669 } |
671 } | 670 } |
672 | 671 |
673 if tw != nil { | 672 if tw != nil { |
674 tw.Flush() | 673 tw.Flush() |
675 } | 674 } |
676 return b.Flush() | 675 return b.Flush() |
677 } | 676 } |
678 | 677 |
679 func runtime_cyclesPerSecond() int64 | 678 func runtime_cyclesPerSecond() int64 |
LEFT | RIGHT |