Skip to content

Commit

Permalink
Remove unused bench
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimalekseev committed Jul 31, 2023
1 parent ed07843 commit d8e28f6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
4 changes: 0 additions & 4 deletions plugin/input/journalctl/commiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ func (a *AsyncCommiter) Commit(event *pipeline.Event) {
a.Lock()
defer a.Unlock()

if !a.debouncer.Ready() {
return
}

a.debouncer.Do(func() {
a.save(offInfo)
})
Expand Down
28 changes: 0 additions & 28 deletions plugin/input/journalctl/journalctl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
package journalctl

import (
"path"
"path/filepath"
"strings"
"sync"
"testing"
"time"

"github.com/ozontech/file.d/cfg"
"github.com/ozontech/file.d/pipeline"
"github.com/ozontech/file.d/plugin/output/devnull"
"github.com/ozontech/file.d/test"
"github.com/stretchr/testify/assert"
insaneJSON "github.com/vitkovskii/insane-json"
)

func setInput(p *pipeline.Pipeline, config *Config) {
Expand Down Expand Up @@ -110,28 +107,3 @@ func TestOffsets(t *testing.T) {
assert.Equal(t, 1, cnt)
}
}

func BenchmarkName(b *testing.B) {
p := Plugin{config: &Config{
OffsetsFile: path.Join(b.TempDir(), "offsets.yaml"),
}}
p.commiter = NewSyncCommiter(p.sync)

event := &pipeline.Event{Root: insaneJSON.Spawn()}
defer insaneJSON.Release(event.Root)

p.config.PersistenceMode_ = persistenceModeSync
b.Run("sync", func(b *testing.B) {
for i := 0; i < b.N; i++ {
p.Commit(event)
}
})

p.commiter = NewAsyncCommiter(NewDebouncer(time.Second), p.sync)
p.config.PersistenceMode_ = persistenceModeAsync
b.Run("async", func(b *testing.B) {
for i := 0; i < b.N; i++ {
p.Commit(event)
}
})
}

0 comments on commit d8e28f6

Please sign in to comment.