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