Skip to content

Commit

Permalink
Addressed Review Commments from Madhur and Rosie
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavapamula committed May 11, 2022
1 parent 6e5e628 commit f5c12a9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions cmd/check_perf.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Coinbase, Inc.
// Copyright 2022 Coinbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ var (
checkPerfCmd = &cobra.Command{
Use: "check:perf",
Short: "Benchmark performance of time-critical endpoints of Asset Issuer's Rosetta Implementation",
Long: `This command can be used to benchmark the performance of time critical methods for a rosetta server.
Long: `This command can be used to benchmark the performance of time critical methods for a Rosetta server.
This is useful for ensuring that there are no performance degradations in the rosetta-server.`,
RunE: runCheckPerfCmd,
}
Expand All @@ -45,19 +45,19 @@ func runCheckPerfCmd(_ *cobra.Command, _ []string) error {

fmt.Printf("Running Check:Perf for %s:%s for blocks %d-%d \n", Config.Network.Blockchain, Config.Network.Network, Config.Perf.StartBlock, Config.Perf.EndBlock)

fetcher, timer, elapsed := t.Setup_Benchmarking(Config)
fetcher, timer, elapsed := t.SetupBenchmarking(Config)
blockEndpointTimeConstraint := time.Duration(Config.Perf.BlockEndpointTimeConstraintMs*TotalNumEndpoints) * time.Millisecond
blockEndpointCtx, blockEndpointCancel := context.WithTimeout(ctx, blockEndpointTimeConstraint)
g.Go(func() error {
return t.Bmark_Block(blockEndpointCtx, Config, fetcher, timer, elapsed, perfRawStats)
return t.BmarkBlock(blockEndpointCtx, Config, fetcher, timer, elapsed, perfRawStats)
})
defer blockEndpointCancel()

fetcher, timer, elapsed = t.Setup_Benchmarking(Config)
fetcher, timer, elapsed = t.SetupBenchmarking(Config)
accountBalanceEndpointTimeConstraint := time.Duration(Config.Perf.AccountBalanceEndpointTimeConstraintMs*TotalNumEndpoints) * time.Millisecond
accountBalanceEndpointCtx, accountBalanceEndpointCancel := context.WithTimeout(ctx, accountBalanceEndpointTimeConstraint)
g.Go(func() error {
return t.Bmark_AccountBalance(accountBalanceEndpointCtx, Config, fetcher, timer, elapsed, perfRawStats)
return t.BmarkAccountBalance(accountBalanceEndpointCtx, Config, fetcher, timer, elapsed, perfRawStats)
})
defer accountBalanceEndpointCancel()

Expand Down
6 changes: 3 additions & 3 deletions pkg/results/perf_results.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Coinbase, Inc.
// Copyright 2022 Coinbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,8 +64,8 @@ func (c *CheckPerfStats) Print() {
table.SetRowLine(true)
table.SetRowSeparator("-")
table.SetHeader([]string{"check:perf Stats", "Description", "Value"})
table.Append([]string{"Start Block", "Start Block", strconv.FormatInt(c.StartBlock, 10)})
table.Append([]string{"End Block", "EndBlock", strconv.FormatInt(c.EndBlock, 10)})
table.Append([]string{"Start Block", "The Starting Block", strconv.FormatInt(c.StartBlock, 10)})
table.Append([]string{"End Block", "The Ending Block", strconv.FormatInt(c.EndBlock, 10)})
table.Append([]string{"Num Times Each Endpoint", "Number of times that each endpoint was hit", strconv.FormatInt(int64(c.NumTimesHitEachEndpoint), 10)})
table.Append(
[]string{
Expand Down
2 changes: 1 addition & 1 deletion pkg/tester/benchmark_utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Coinbase, Inc.
// Copyright 2022 Coinbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions pkg/tester/data_perf.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Coinbase, Inc.
// Copyright 2022 Coinbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@ import (
"github.com/coinbase/rosetta-sdk-go/types"
)

func Setup_Benchmarking(config *configuration.Configuration) (*fetcher.Fetcher, func() time.Duration, chan time.Duration) {
func SetupBenchmarking(config *configuration.Configuration) (*fetcher.Fetcher, func() time.Duration, chan time.Duration) {
// Create a new fetcher
fetcher := fetcher.New(
config.OnlineURL,
Expand All @@ -37,7 +37,7 @@ func Setup_Benchmarking(config *configuration.Configuration) (*fetcher.Fetcher,
}

// Benchmark the asset issuer's /block endpoint
func Bmark_Block(ctx context.Context, config *configuration.Configuration, fetcher *fetcher.Fetcher, timer func() time.Duration, elapsed chan time.Duration, rawStats *results.CheckPerfRawStats) error {
func BmarkBlock(ctx context.Context, config *configuration.Configuration, fetcher *fetcher.Fetcher, timer func() time.Duration, elapsed chan time.Duration, rawStats *results.CheckPerfRawStats) error {
total_errors := 0
go func() {
for m := config.Perf.StartBlock; m < config.Perf.EndBlock; m++ {
Expand Down Expand Up @@ -65,7 +65,7 @@ func Bmark_Block(ctx context.Context, config *configuration.Configuration, fetch
}

// Benchmark the asset issuers /account/balance endpoint
func Bmark_AccountBalance(ctx context.Context, config *configuration.Configuration, fetcher *fetcher.Fetcher, timer func() time.Duration, elapsed chan time.Duration, rawStats *results.CheckPerfRawStats) error {
func BmarkAccountBalance(ctx context.Context, config *configuration.Configuration, fetcher *fetcher.Fetcher, timer func() time.Duration, elapsed chan time.Duration, rawStats *results.CheckPerfRawStats) error {
total_errors := 0
go func() {
for m := config.Perf.StartBlock; m < config.Perf.EndBlock; m++ {
Expand Down

0 comments on commit f5c12a9

Please sign in to comment.