mirror of https://github.com/etcd-io/dbtester.git
parent
0c007bd7c1
commit
6b7eb7cbbb
|
|
@ -30,9 +30,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra"
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc"
|
||||
"github.com/gyuho/psn/ps"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import math "math"
|
|||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import (
|
||||
context "github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
|
||||
grpc "github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc"
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
import io "io"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package bench is copied from https://github.com/coreos/etcd/tree/master/tools/benchmark
|
||||
// bench is copied from https://github.com/coreos/etcd/tree/master/tools/benchmark
|
||||
// for the purpose of supporting other databases.
|
||||
package bench
|
||||
package main
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2015 CoreOS, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bench
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bench
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bench
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
|
|||
|
|
@ -12,9 +12,11 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bench
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/cheggaaa/pb"
|
||||
|
|
@ -39,6 +41,10 @@ var (
|
|||
wg sync.WaitGroup
|
||||
)
|
||||
|
||||
func init() {
|
||||
cobra.EnablePrefixMatching = true
|
||||
}
|
||||
|
||||
func init() {
|
||||
Command.PersistentFlags().StringVarP(&database, "database", "d", "etcd", "'etcd', 'zk'(zookeeper)")
|
||||
Command.PersistentFlags().StringSliceVar(&endpoints, "endpoints", []string{"10.240.0.9:2181", "10.240.0.10:2181", "10.240.0.14:2181"}, "gRPC endpoints")
|
||||
|
|
@ -46,3 +52,10 @@ func init() {
|
|||
Command.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients (only for etcd)")
|
||||
Command.PersistentFlags().BoolVar(&sample, "sample", false, "'true' to sample requests for every second")
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := Command.Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stdout, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bench
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package bench
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import (
|
|||
|
||||
"github.com/coreos/dbtester/agent"
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra"
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/golang.org/x/net/context"
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/google.golang.org/grpc"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
|
|||
3
main.go
3
main.go
|
|
@ -19,7 +19,6 @@
|
|||
//
|
||||
// Available Commands:
|
||||
// agent Database agent in remote servers.
|
||||
// bench Low-level benchmark tool for etcd, Zookeeper.
|
||||
// start Starts database through RPC calls.
|
||||
// stop Stops database through RPC calls.
|
||||
// restart Restarts database through RPC calls.
|
||||
|
|
@ -36,7 +35,6 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/coreos/dbtester/agent"
|
||||
"github.com/coreos/dbtester/bench"
|
||||
"github.com/coreos/dbtester/control"
|
||||
|
||||
"github.com/coreos/etcd/Godeps/_workspace/src/github.com/spf13/cobra"
|
||||
|
|
@ -56,7 +54,6 @@ func init() {
|
|||
|
||||
func init() {
|
||||
rootCommand.AddCommand(agent.Command)
|
||||
rootCommand.AddCommand(bench.Command)
|
||||
rootCommand.AddCommand(control.StartCommand)
|
||||
rootCommand.AddCommand(control.StopCommand)
|
||||
rootCommand.AddCommand(control.RestartCommand)
|
||||
|
|
|
|||
Loading…
Reference in New Issue