Beispiel #1
0
func (s *BenchmarkSuite) TestInit(c *C) {
	fs := fs.NewMemoryClient()
	b := NewBenchmark(fs, &Config{Workers: 3, Files: 10})
	b.Init()

	c.Assert(b.w, HasLen, 3)
	c.Assert(b.w[0].c.Files, Equals, 3)
	c.Assert(b.w[1].c.Files, Equals, 3)
	c.Assert(b.w[2].c.Files, Equals, 4)
}
Beispiel #2
0
func (s *BenchmarkSuite) TestRun(c *C) {
	runtime.GOMAXPROCS(runtime.NumCPU())

	fs := fs.NewMemoryClient()
	b := NewBenchmark(fs, &Config{
		Workers:       100,
		Files:         10000,
		BlockSize:     512,
		FixedFileSize: 1024 * 100,
	})

	b.Init()
	status := b.Run()

	c.Assert(status.WStatus.Files, Equals, 10000)
	c.Assert(status.WStatus.Errors, Equals, 0)
	c.Assert(status.WStatus.Bytes, Equals, int64(1024000000))
}
Beispiel #3
0
func (c *MemoryCommand) Execute(args []string) error {
	c.BaseCommand.fs = fs.NewMemoryClient()

	return c.BaseCommand.Execute(args)
}