File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ func ExampleMemProfileRate() {
2929 defer profile .Start (profile .MemProfileRate (2048 )).Stop ()
3030}
3131
32+ func ExampleMemProfileHeap () {
33+ // use heap memory profiling.
34+ defer profile .Start (profile .MemProfileHeap ).Stop ()
35+ }
36+
37+ func ExampleMemProfileAllocs () {
38+ // use allocs memory profiling.
39+ defer profile .Start (profile .MemProfileAllocs ).Stop ()
40+ }
41+
3242func ExampleProfilePath () {
3343 // set the location that the profile will be written to
3444 defer profile .Start (profile .ProfilePath (os .Getenv ("HOME" ))).Stop ()
Original file line number Diff line number Diff line change @@ -90,20 +90,16 @@ func MemProfileRate(rate int) func(*Profile) {
9090
9191// MemProfileHeap changes which type of memory profiling to profile
9292// the heap.
93- func MemProfileHeap () func (* Profile ) {
94- return func (p * Profile ) {
95- p .memProfileType = "heap"
96- p .mode = memMode
97- }
93+ func MemProfileHeap (p * Profile ) {
94+ p .memProfileType = "heap"
95+ p .mode = memMode
9896}
9997
10098// MemProfileAllocs changes which type of memory to profile
10199// allocations.
102- func MemProfileAllocs () func (* Profile ) {
103- return func (p * Profile ) {
104- p .memProfileType = "allocs"
105- p .mode = memMode
106- }
100+ func MemProfileAllocs (p * Profile ) {
101+ p .memProfileType = "allocs"
102+ p .mode = memMode
107103}
108104
109105// MutexProfile enables mutex profiling.
You can’t perform that action at this time.
0 commit comments