github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/benchmark/cmd/command/loadgen.go (about) 1 package command 2 3 import ( 4 "github.com/pyroscope-io/pyroscope/benchmark/internal/config" 5 "github.com/pyroscope-io/pyroscope/benchmark/internal/loadgen" 6 "github.com/pyroscope-io/pyroscope/pkg/cli" 7 "github.com/spf13/cobra" 8 ) 9 10 func newLoadGen(cfg *config.LoadGen) *cobra.Command { 11 vpr := newViper() 12 loadgenCmd := &cobra.Command{ 13 Use: "loadgen [flags]", 14 Short: "Generates load", 15 RunE: cli.CreateCmdRunFn(cfg, vpr, func(_ *cobra.Command, args []string) error { 16 setLogLevel(cfg.LogLevel) 17 18 return loadgen.Cli(cfg) 19 }), 20 } 21 22 cli.PopulateFlagSet(cfg, loadgenCmd.Flags(), vpr) 23 return loadgenCmd 24 }