add profiling

This commit is contained in:
Jan Pochyla 2017-09-13 02:50:34 +02:00
parent dbf93b75c4
commit abaedd4f39
3 changed files with 18 additions and 2 deletions

8
Gopkg.lock generated
View File

@ -25,6 +25,12 @@
packages = [".","base58","bech32"] packages = [".","base58","bech32"]
revision = "501929d3d046174c3d39f0ea54ece471aa17238c" revision = "501929d3d046174c3d39f0ea54ece471aa17238c"
[[projects]]
name = "github.com/pkg/profile"
packages = ["."]
revision = "5b67d428864e92711fcbd2f8629456121a56d91f"
version = "v1.2.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "github.com/tecbot/gorocksdb" name = "github.com/tecbot/gorocksdb"
@ -40,6 +46,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "07980ae9893c6e67b266e97e50329139ccf005f5b425117cd5d0d5590e8ca541" inputs-digest = "119cb8683257687e541ae944d0f3a29aa916bb81dcedd6a69a0f765fd8f1be9d"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -40,3 +40,7 @@
[[constraint]] [[constraint]]
branch = "master" branch = "master"
name = "github.com/tecbot/gorocksdb" name = "github.com/tecbot/gorocksdb"
[[constraint]]
name = "github.com/pkg/profile"
version = "1.2.1"

View File

@ -4,6 +4,8 @@ import (
"flag" "flag"
"log" "log"
"time" "time"
"github.com/pkg/profile"
) )
type BlockParser interface { type BlockParser interface {
@ -124,13 +126,17 @@ var (
queryAddress = flag.String("address", "", "query contents of this address") queryAddress = flag.String("address", "", "query contents of this address")
resync = flag.Bool("resync", false, "resync until tip") resync = flag.Bool("resync", false, "resync until tip")
repair = flag.Bool("repair", false, "repair the database") repair = flag.Bool("repair", false, "repair the database")
prof = flag.Bool("prof", false, "profile program execution")
) )
func main() { func main() {
flag.Parse() flag.Parse()
if *prof {
defer profile.Start().Stop()
}
if *repair { if *repair {
if err := RepairRocksDB(*dbPath); err != nil { if err := RepairRocksDB(*dbPath); err != nil {
log.Fatal(err) log.Fatal(err)