diff --git a/benchmarking/exporter.go b/benchmarking/exporter.go index 1a4a52b5879..e14c135e02d 100644 --- a/benchmarking/exporter.go +++ b/benchmarking/exporter.go @@ -7,8 +7,6 @@ import ( "time" ) -const flushTimerInterval = time.Duration(time.Second * 30) - var fileWriter *exporter func initExporter(fileName string) { @@ -18,42 +16,22 @@ func initExporter(fileName string) { } fileWriter = &exporter{ - file: file, - bytesToFlushAfter: 10 * 100000, - flushTimer: *time.NewTimer(flushTimerInterval), + file: file, } - - go func() { - for { - <-fileWriter.flushTimer.C - fileWriter.file.Sync() - fileWriter.flushTimer.Reset(flushTimerInterval) - } - }() } type exporter struct { - file *os.File - bytesWritten int - bytesToFlushAfter int - flushTimer time.Timer + file *os.File } func (e *exporter) export(opCode OpCode, elapsedTime time.Duration, size uint32) { buf := []byte{opCode[0], opCode[1], 0, 0, 0, 0, 0, 0, 0, 0} binary.LittleEndian.PutUint32(buf[2:], uint32(elapsedTime)) binary.LittleEndian.PutUint32(buf[6:], size) - n, err := e.file.Write(buf) + _, err := e.file.Write(buf) if err != nil { panic("could not write to benchmark file: " + err.Error()) } - - e.bytesWritten += n - if e.bytesWritten > e.bytesToFlushAfter { - e.file.Sync() - e.bytesWritten = 0 - e.flushTimer.Reset(flushTimerInterval) - } } func (e *exporter) close() { diff --git a/gno.land/pkg/sdk/vm/keeper_test.go b/gno.land/pkg/sdk/vm/keeper_test.go index 294efa66fa5..aeae8835b69 100644 --- a/gno.land/pkg/sdk/vm/keeper_test.go +++ b/gno.land/pkg/sdk/vm/keeper_test.go @@ -40,12 +40,12 @@ func Echo() string { } pkgPath := "gno.land/r/test" msg1 := NewMsgAddPackage(addr, pkgPath, files) - assert.Nil(t, env.vmk.gnoStore.GetPackage(pkgPath, false)) + assert.Nil(t, env.vmk.store.GetPackage(pkgPath, false)) err := env.vmk.AddPackage(ctx, msg1) assert.NoError(t, err) - assert.NotNil(t, env.vmk.gnoStore.GetPackage(pkgPath, false)) + assert.NotNil(t, env.vmk.store.GetPackage(pkgPath, false)) err = env.vmk.AddPackage(ctx, msg1)