Check-in [1a4bdf36e2]
Overview
Comment:Added debug/pprof to ease basic cpu profiling
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1a4bdf36e24d1f6a1717d7764d57bacf41c1f6bc
User & Date: spaskalev on 2014-12-21 19:38:35
Other Links: manifest | tags
Context
2014-12-21
22:52
Removed TODOs, renamed readCount->rc, wrapped->reader check-in: 630530df49 user: spaskalev tags: trunk
22:12
Check in the new decompressor implementation in a separate branch check-in: bd1368b81f user: spaskalev tags: decompressor2
19:38
Added debug/pprof to ease basic cpu profiling check-in: 1a4bdf36e2 user: spaskalev tags: trunk
17:23
Fixed a rare case of losing data from the decompressor's internal result buffer. check-in: 7b74fd57f8 user: spaskalev tags: trunk
Changes

Added src/0dev.org/debug/pprof/pprof.go version [9f08d0e6cb].



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Package pprof starts various profiling mechanism during initialization
// and provides a function to stop and flush them
package pprof

import (
	"os"
	"runtime/pprof"
)

var (
	output *os.File
)

func init() {
	output, err := os.Create("cpu.prof")
	if err != nil {
		os.Stderr.WriteString("Error opening CPU profiling output file.\n" + err.Error())
		return
	}

	err = pprof.StartCPUProfile(output)
	if err != nil {
		os.Stderr.WriteString("Error starting CPU profiling.\n" + err.Error())
	}
}

func Stop() {
	pprof.StopCPUProfile()
}