Skip to content

Commit

Permalink
Benchmark added
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Jarco committed Nov 9, 2018
1 parent 723a025 commit 73be064
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 18 additions & 0 deletions balancing/balance_breaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,3 +437,21 @@ func TestLengthDelimitedCounter(t *testing.T) {
wg.Wait()
require.Equal(t, sum, counter.Sum())
}

func BenchmarkCallMetrics(b *testing.B) {
clockAdvance := 4 * time.Millisecond
timer := &mockTimer{
baseTime: time.Now(),
advanceDur: clockAdvance}
retention := 20 * time.Second
resolution := 10 * time.Second
callMeter := newCallMeterWithTimer(retention, resolution, timer.now)
iterations := int(retention / clockAdvance)
for i := 0; i < iterations; i++ {
callMeter.UpdateTimeSpent(10 * time.Millisecond)
}
for n := 0; n < b.N; n++ {
callMeter.TimeSpent()
callMeter.Calls()
}
}
2 changes: 0 additions & 2 deletions config/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ func (c *YamlConfig) validateRegionCluster(policyName string, policies confregio
}

for _, policy := range policies.Shards {
println("dupa")
fmt.Printf("sharding policies %v\n", c.Shards)
_, exists := c.Shards[policy.ShardName]
if !exists {
errList = append(errList, fmt.Errorf("Shard \"%s\" in policy \"%s\" is not defined", policy.ShardName, policyName))
Expand Down

0 comments on commit 73be064

Please sign in to comment.