add profiling

pull/1/head
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"]
revision = "501929d3d046174c3d39f0ea54ece471aa17238c"
[[projects]]
name = "github.com/pkg/profile"
packages = ["."]
revision = "5b67d428864e92711fcbd2f8629456121a56d91f"
version = "v1.2.1"
[[projects]]
branch = "master"
name = "github.com/tecbot/gorocksdb"
@ -40,6 +46,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "07980ae9893c6e67b266e97e50329139ccf005f5b425117cd5d0d5590e8ca541"
inputs-digest = "119cb8683257687e541ae944d0f3a29aa916bb81dcedd6a69a0f765fd8f1be9d"
solver-name = "gps-cdcl"
solver-version = 1

View File

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

View File

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