2021-02-17 10:46:44 +00:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-03-09 10:26:45 +00:00
|
|
|
"github.com/spf13/cobra"
|
2021-02-17 10:46:44 +00:00
|
|
|
"go.uber.org/zap"
|
2021-03-09 10:26:45 +00:00
|
|
|
|
|
|
|
"storj.io/private/process"
|
2021-02-17 10:46:44 +00:00
|
|
|
)
|
|
|
|
|
2021-03-09 10:26:45 +00:00
|
|
|
var (
|
|
|
|
rootCmd = &cobra.Command{
|
|
|
|
Use: "metainfo-loop-benchmark",
|
|
|
|
Short: "metainfo-loop-benchmark",
|
2021-02-17 10:46:44 +00:00
|
|
|
}
|
|
|
|
|
2021-03-09 10:26:45 +00:00
|
|
|
runCmd = &cobra.Command{
|
|
|
|
Use: "run",
|
|
|
|
Short: "run metainfo-loop-benchmark",
|
|
|
|
RunE: run,
|
2021-02-17 10:46:44 +00:00
|
|
|
}
|
|
|
|
|
2021-03-09 10:26:45 +00:00
|
|
|
bench Bench
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(runCmd)
|
|
|
|
|
|
|
|
bench.BindFlags(runCmd.Flags())
|
|
|
|
}
|
|
|
|
|
|
|
|
func run(cmd *cobra.Command, args []string) error {
|
|
|
|
if err := bench.VerifyFlags(); err != nil {
|
|
|
|
return err
|
2021-02-17 10:46:44 +00:00
|
|
|
}
|
2021-03-09 10:26:45 +00:00
|
|
|
|
|
|
|
ctx, _ := process.Ctx(cmd)
|
|
|
|
log := zap.L()
|
|
|
|
return bench.Run(ctx, log)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
process.Exec(rootCmd)
|
2021-02-17 10:46:44 +00:00
|
|
|
}
|