diff --git a/.gitignore b/.gitignore index 1c96bb4f..ef657ec0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.so *.dylib ./tape +tape # Test binary, build with `go test -c` *.test diff --git a/Makefile b/Makefile index 6f3d880b..a761252d 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,8 @@ FABRIC_VERSION = latest INTERGATION_CASE = ANDLogic -BASE_VERSION = 0.0.2 -PREV_VERSION = 0.0.1 +BASE_VERSION = 0.1.3 +PREV_VERSION = 0.1.2 PROJECT_NAME = tape DOCKERIMAGE = guoger/tape @@ -35,7 +35,7 @@ GO_TAGS ?= export GO_LDFLAGS GO_TAGS FABRIC_VERSION INTERGATION_CASE -tape: +tape: @echo "Building tape program......" go build -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" ./cmd/tape diff --git a/README.md b/README.md index 2ed648c3..55aa1f40 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ You could get `tape` in three ways: #### Binary -Execute `./tape -c config.yaml -n 40000` to generate 40000 transactions to Fabric. +Execute `./tape run -c config.yaml -n 40000` to generate 40000 transactions to Fabric. #### Docker diff --git a/docs/gettingstarted.md b/docs/gettingstarted.md index 16221a43..863666f9 100644 --- a/docs/gettingstarted.md +++ b/docs/gettingstarted.md @@ -55,7 +55,7 @@ docker build -t guoger/tape:latest . 执行如下命令即可运行测试: ``` -./tape --config=config.yaml --number=40000 +./tape run --config=config.yaml --number=40000 ``` 该命令的含义是,使用 config.yaml 作为配置文件,向 Fabric 网络发送40000条交易进行性能测试。 diff --git a/pkg/infra/observer.go b/pkg/infra/observer.go index 9ae8cfc8..163bb267 100644 --- a/pkg/infra/observer.go +++ b/pkg/infra/observer.go @@ -64,8 +64,8 @@ func CreateObserver(ctx context.Context, channel string, node Node, crypto *Cryp func (o *Observer) Start(errorCh chan error, blockCh chan<- *AddressedBlock, now time.Time) { o.logger.Debugf("start observer for peer %s", o.Address) - for { + prevTime := time.Now() r, err := o.d.Recv() if err != nil { errorCh <- err @@ -78,6 +78,8 @@ func (o *Observer) Start(errorCh chan error, blockCh chan<- *AddressedBlock, now fb := r.Type.(*peer.DeliverResponse_FilteredBlock) o.logger.Debugf("receivedTime %8.2fs\tBlock %6d\tTx %6d\t Address %s\n", time.Since(now).Seconds(), fb.FilteredBlock.Number, len(fb.FilteredBlock.FilteredTransactions), o.Address) + o.logger.Infof("transactionLatency(ms) %d", time.Since(prevTime).Milliseconds()) + blockCh <- &AddressedBlock{fb.FilteredBlock, o.index} }