1
0
mirror of https://github.com/fluencelabs/tendermint synced 2025-06-28 20:21:47 +00:00
Files
.github
DOCKER
benchmarks
blockchain
proto
simu
atomic_test.go
chan_test.go
codec_test.go
empty.go
map_test.go
os_test.go
blockchain
cmd
config
consensus
docs
evidence
lite
mempool
node
p2p
proxy
rpc
scripts
state
test
types
version
.codecov.yml
.editorconfig
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
README.md
Vagrantfile
appveyor.yml
circle.yml
glide.lock
glide.yaml
tendermint/benchmarks/os_test.go

34 lines
588 B
Go
Raw Normal View History

2015-12-20 11:37:54 -08:00
package benchmarks
import (
"os"
"testing"
2017-10-04 16:40:45 -04:00
cmn "github.com/tendermint/tmlibs/common"
2015-12-20 11:37:54 -08:00
)
func BenchmarkFileWrite(b *testing.B) {
b.StopTimer()
file, err := os.OpenFile("benchmark_file_write.out",
os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
if err != nil {
b.Error(err)
}
2017-10-04 16:40:45 -04:00
testString := cmn.RandStr(200) + "\n"
2015-12-20 11:37:54 -08:00
b.StartTimer()
for i := 0; i < b.N; i++ {
2017-09-06 11:50:43 -04:00
_, err := file.Write([]byte(testString))
if err != nil {
b.Error(err)
}
2015-12-20 11:37:54 -08:00
}
2017-09-06 11:50:43 -04:00
if err := file.Close(); err != nil {
b.Error(err)
}
if err := os.Remove("benchmark_file_write.out"); err != nil {
2015-12-20 11:37:54 -08:00
b.Error(err)
}
}