Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-07-01 15:41:14 +0300
committerJacob Vosmaer <jacob@gitlab.com>2019-07-01 15:41:14 +0300
commit1339ecdf7bd2c9b0e9c947876f54a2e7345ca934 (patch)
treedc7a758e37da39eef5718c05496ea18a8f1e7966
parent3bcfb3d17f1253db1b3718b08eace4377e0dc6da (diff)
Add pprof hook
-rw-r--r--parse-bitmap.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/parse-bitmap.go b/parse-bitmap.go
index 446e59811..dbbe71c10 100644
--- a/parse-bitmap.go
+++ b/parse-bitmap.go
@@ -7,6 +7,7 @@ import (
"log"
"os"
"regexp"
+ "runtime/pprof"
"sort"
"time"
@@ -31,6 +32,15 @@ func main() {
}
func _main(packIdx string) error {
+ if pprofOut := os.Getenv("PPROF_OUT"); len(pprofOut) > 0 {
+ f, err := os.Create(pprofOut)
+ if err != nil {
+ return err
+ }
+ pprof.StartCPUProfile(f)
+ defer pprof.StopCPUProfile()
+ }
+
start := time.Now()
idx, err := packfile.ReadIndex(packIdx)
if err != nil {