cmd

package
v0.0.0-...-8340628 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Plain string = "plain"
	JSON  string = "json"
	YAML  string = "yaml"
)
View Source
const (
	DEFAULT_USER          = ""
	DEFAULT_USER_PASSWORD = ""
)
View Source
const ASYM_EXAMPLE_DATA string = "0123456789abcdef"
View Source
const QPS_PRINT_INTERVAL = 5 * time.Second
View Source
const SIGN_EXAMPLE_DATA string = "0123456789abcdef"
View Source
const SYM_EXAMPLE_DATA string = "0123456789ABCDEF"

Variables

This section is empty.

Functions

func ExecuteCmd

func ExecuteCmd() error

func GetSobject

func GetSobject(kid *string) *sdkms.Sobject

GetSobject retrieves a sobject through SDKMS client. It takes a keyID as a parameter and returns a pointer to a Sobject. If the keyID is empty, it will return an error. If an error occurs during the retrieval process, the function will log a fatal error and exit.

func Max

func Max(a, b int) int

func StrPad

func StrPad(input string, padLength int, padString string, padType string) string

StrPad returns the input string padded on the left, right or both sides using padType to the specified padding length padLength.

This helper function is from internet: https://gist.github.com/asessa/3aaec43d93044fc42b7c6d5f728cb039

Example:

input := "Codes";

StrPad(input, 10, " ", "RIGHT") // produces "Codes "

StrPad(input, 10, "-=", "LEFT") // produces "=-=-=Codes"

StrPad(input, 10, "_", "BOTH") // produces "__Codes___"

StrPad(input, 6, "___", "RIGHT") // produces "Codes_"

StrPad(input, 3, "*", "RIGHT") // produces "Codes"

Types

type ProfilingStatistics

type ProfilingStatistics struct {
	InQueue       Statistic `json:"in_queue" yaml:"in_queue"`
	ParseRequest  Statistic `json:"parse_request" yaml:"parse_request"`
	SessionLookup Statistic `json:"session_lookup" yaml:"session_lookup"`
	ValidateInput Statistic `json:"validate_input" yaml:"validate_input"`
	CheckAccess   Statistic `json:"check_access" yaml:"check_access"`
	Operate       Statistic `json:"operate" yaml:"operate"`
	DbFlush       Statistic `json:"db_flush" yaml:"db_flush"`
	Total         Statistic `json:"total" yaml:"total"`
}

func (*ProfilingStatistics) Print

func (ps *ProfilingStatistics) Print(w io.Writer)

type Statistic

type Statistic struct {
	QueryNumber uint    `json:"query_number" yaml:"query_number"` // Number of queries executed
	QPS         float64 `json:"qps" yaml:"qps"`                   // Queries Per Second
	Avg         float64 `json:"avg" yaml:"avg"`                   // Average response time in nanoseconds
	Min         float64 `json:"min" yaml:"min"`                   // Minimum response time in nanoseconds
	Max         float64 `json:"max" yaml:"max"`                   // Maximum response time in nanoseconds
	P50         float64 `json:"p50" yaml:"p50"`                   // 50th percentile (median) response time in nanoseconds
	P75         float64 `json:"p75" yaml:"p75"`                   // 75th percentile response time in nanoseconds
	P90         float64 `json:"p90" yaml:"p90"`                   // 90th percentile response time in nanoseconds
	P95         float64 `json:"p95" yaml:"p95"`                   // 95th percentile response time in nanoseconds
	P99         float64 `json:"p99" yaml:"p99"`                   // 99th percentile response time in nanoseconds
}

Statistic represents the performance metrics of a load test.

func StatisticFromDurations

func StatisticFromDurations(times []time.Duration, duration time.Duration) *Statistic

func StatisticFromFloat64Data

func StatisticFromFloat64Data(data stats.Float64Data, totalDuration *time.Duration) *Statistic

func (*Statistic) Print

func (st *Statistic) Print(w io.Writer)

func (*Statistic) String

func (st *Statistic) String() string

type TestConfig

type TestConfig struct {
	TestName       string           `json:"test_name" yaml:"test_name"`
	ServerName     string           `json:"server_name" yaml:"server_name"`
	ServerPort     uint16           `json:"server_port" yaml:"server_port"`
	VerifyTls      bool             `json:"verify_tls" yaml:"verify_tls"`
	Connections    uint             `json:"connections" yaml:"connections"`
	CreateSession  bool             `json:"create_session" yaml:"create_session"`
	WarmupDuration time.Duration    `json:"warmup_duration" yaml:"warmup_duration"`
	TestDuration   time.Duration    `json:"test_duration" yaml:"test_duration"`
	TargetQPS      uint             `json:"target_qps" yaml:"target_qps"`
	Sobject        *sdkms.Sobject   `json:"sobject" yaml:"sobject"`
	Plugin         *sdkms.Plugin    `json:"plugin" yaml:"plugin"`
	PluginInput    *json.RawMessage `json:"plugin_input" yaml:"plugin_input"`
}

func (*TestConfig) Print

func (tc *TestConfig) Print(w io.Writer)

type TestResult

type TestResult struct {
	Warmup             *Statistic           `json:"warmup" yaml:"warmup"`
	Test               *Statistic           `json:"test" yaml:"test"`
	ActualTestDuration time.Duration        `json:"actual_test_duration" yaml:"actual_test_duration"`
	SendDuration       time.Duration        `json:"send_duration" yaml:"send_duration"`
	ProfilingResults   *ProfilingStatistics `json:"profiling_results" yaml:"profiling_results"`
}

func (*TestResult) Print

func (tr *TestResult) Print(w io.Writer)

type TestSummary

type TestSummary struct {
	TestTime string      `json:"test_time" yaml:"test_time"` // ISO 8601 timestamp string
	Config   *TestConfig `json:"config" yaml:"config"`
	Result   *TestResult `json:"result" yaml:"result"`
}

func (*TestSummary) WriteJson

func (ts *TestSummary) WriteJson(w io.Writer) error

func (*TestSummary) WritePlain

func (ts *TestSummary) WritePlain(w io.Writer) error

type TestSummaryJsonWriter

type TestSummaryJsonWriter interface {
	WriteJson(w io.Writer) error
}

type TestSummaryPlainWriter

type TestSummaryPlainWriter interface {
	WritePlain(w io.Writer) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL