Documentation ¶
Overview ¶
Copyright © 2019 Andy Rea <email@andrewrea.co.uk>
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Timer utils.Timer = &utils.DefaultTimer{} HttpClient client.HttpClient = client.NewDefaultHttpClient() )
View Source
var RootCmd = &cobra.Command{ Use: "surge", Short: "A brief description of your application", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your application. For example: Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, RunE: func(cmd *cobra.Command, args []string) error { surgeClient := client.NewSurgeClientBuilder(). SetURLFilePath(urlFile). SetRandom(random). SetWorkers(workerCount). SetIterations(iterations). SetHTTPClient(HttpClient). SetTimer(Timer). Build() result, err := surgeClient.Run() if err == nil { cmd.Println(fmt.Sprintf("Transactions: %v", result.Transactions)) cmd.Println(fmt.Sprintf("Availability: %v%%", result.Availability*100)) cmd.Println(fmt.Sprintf("Elapsed Time: %v", result.ElapsedTime.String())) cmd.Println(fmt.Sprintf("Total Bytes Sent: %v", humanize.Bytes(uint64(result.TotalBytesSent)))) cmd.Println(fmt.Sprintf("Total Bytes Received: %v", humanize.Bytes(uint64(result.TotalBytesReceived)))) cmd.Println(fmt.Sprintf("Average Response Time: %vms", result.AverageResponseTime/(float64(time.Millisecond)))) cmd.Println(fmt.Sprintf("Average Transaction Rate: %.0f transactions/sec", result.TransactionRate)) cmd.Println(fmt.Sprintf("Concurrency: %.0f", result.ConcurrencyRate)) } return err }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.