cleanup
parent
660ca650cc
commit
a9860db6c2
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.cloudfoundry.org/bytefmt"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
|
@ -11,17 +10,14 @@ func main() {
|
|||
params := Route()
|
||||
cephconn := connectioninit(¶ms)
|
||||
defer cephconn.conn.Shutdown()
|
||||
|
||||
stats, _ := cephconn.ioctx.GetPoolStats()
|
||||
log.Println(stats)
|
||||
blocksize, err := bytefmt.ToBytes(params.bs)
|
||||
if err != nil {
|
||||
log.Println("Can't convert defined block size. 4K block size will be used\n")
|
||||
blocksize = 4096
|
||||
}
|
||||
log.Printf("%v\n", blocksize)
|
||||
|
||||
log.Printf("%v\n", params.blocksize)
|
||||
var buffs [][]byte
|
||||
for i :=0; i < 2 * params.threads_count; i++ {
|
||||
buffs = append(buffs, make([]byte, blocksize))
|
||||
for i := 0; i < 2*params.threadsCount; i++ {
|
||||
buffs = append(buffs, make([]byte, params.blocksize))
|
||||
}
|
||||
for num := range buffs {
|
||||
_, err := rand.Read(buffs[num])
|
||||
|
@ -32,6 +28,4 @@ func main() {
|
|||
fmt.Printf("%+v\n", buffs)
|
||||
fmt.Println(len(buffs))
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
26
flags.go
26
flags.go
|
@ -1,20 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"code.cloudfoundry.org/bytefmt"
|
||||
"github.com/juju/gnuflag"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
"log"
|
||||
"github.com/juju/gnuflag"
|
||||
)
|
||||
|
||||
type Params struct {
|
||||
duration time.Duration
|
||||
threads_count int
|
||||
parallel bool
|
||||
duration time.Duration
|
||||
threadsCount int
|
||||
blocksize uint64
|
||||
parallel bool
|
||||
bs, cluster, user, keyring, config, pool, mode, define string
|
||||
}
|
||||
|
||||
func Route () Params {
|
||||
func Route() Params {
|
||||
params := Params{}
|
||||
gnuflag.DurationVar(¶ms.duration, "duration", 30,
|
||||
"Time limit for each test in seconds")
|
||||
|
@ -50,17 +52,23 @@ func Route () Params {
|
|||
"Mode osd or host")
|
||||
gnuflag.StringVar(¶ms.define, "define", "",
|
||||
"Define specifically osd or host. osd.X or ceph-host-X")
|
||||
gnuflag.IntVar(¶ms.threads_count, "threads", 1,
|
||||
gnuflag.IntVar(¶ms.threadsCount, "threads", 1,
|
||||
"Threads count")
|
||||
gnuflag.IntVar(¶ms.threads_count, "t", 1,
|
||||
gnuflag.IntVar(¶ms.threadsCount, "t", 1,
|
||||
"Threads count on each osd")
|
||||
gnuflag.BoolVar(¶ms.parallel, "parallel", false,
|
||||
"Do test all osd in parallel mode")
|
||||
gnuflag.Parse(true)
|
||||
var err error
|
||||
if params.mode == "osd" && len(params.define) != 0 {
|
||||
if i := strings.HasPrefix(params.define, "osd."); i != true {
|
||||
log.Fatalln("Define correct osd in format osd.X")
|
||||
}
|
||||
}
|
||||
params.blocksize, err = bytefmt.ToBytes(params.bs)
|
||||
if err != nil {
|
||||
log.Println("Can't convert defined block size. 4K block size will be used\n")
|
||||
params.blocksize = 4096
|
||||
}
|
||||
return params
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue