Documentation
¶
Overview ¶
Copyright © 2025 blacktop
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2025 blacktop ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2025 blacktop ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFlags ¶
func AddFlags(cmd *cobra.Command, flags *ProfilingFlags)
AddFlags adds profiling flags to the given command
Types ¶
type Benchmark ¶
type Benchmark struct {
// contains filtered or unexported fields
}
Benchmark represents a benchmark test
func NewBenchmark ¶
NewBenchmark creates a new benchmark with the given name
func (*Benchmark) Start ¶
func (b *Benchmark) Start()
Start begins the benchmark timing and memory measurement
func (*Benchmark) Stop ¶
func (b *Benchmark) Stop() BenchmarkResult
Stop ends the benchmark and returns the results
type BenchmarkResult ¶
type BenchmarkResult struct {
Name string
Duration time.Duration
MemAllocated uint64
MemDelta int64
TotalAlloc uint64
GCRuns uint32
Goroutines int
Error error
}
BenchmarkResult holds the results of a benchmark run
func BenchmarkFunc ¶
func BenchmarkFunc(name string, fn func() error) BenchmarkResult
BenchmarkFunc runs a function and returns benchmark results
func (BenchmarkResult) PrintResult ¶
func (r BenchmarkResult) PrintResult()
PrintResult prints the benchmark result in a formatted way
type BenchmarkSuite ¶
type BenchmarkSuite struct {
// contains filtered or unexported fields
}
BenchmarkSuite holds multiple benchmark results
func NewBenchmarkSuite ¶
func NewBenchmarkSuite() *BenchmarkSuite
NewBenchmarkSuite creates a new benchmark suite
func (*BenchmarkSuite) Add ¶
func (bs *BenchmarkSuite) Add(result BenchmarkResult)
Add adds a benchmark result to the suite
func (*BenchmarkSuite) PrintSummary ¶
func (bs *BenchmarkSuite) PrintSummary()
PrintSummary prints a summary of all benchmark results
func (*BenchmarkSuite) SaveToFile ¶
func (bs *BenchmarkSuite) SaveToFile(filename string) error
SaveToFile saves the benchmark results to a file
type Config ¶
type Config struct {
CPUProfile string
MemProfile string
GoroutineProf string
BlockProf string
MutexProf string
TraceFile string
MemProfileRate int
}
Config represents profiling configuration
type Profiler ¶
type Profiler struct {
// contains filtered or unexported fields
}
Profiler manages profiling operations
type ProfilingFlags ¶
type ProfilingFlags struct {
CPUProfile string
MemProfile string
GoroutineProf string
BlockProf string
MutexProf string
TraceFile string
MemProfileRate int
}
ProfilingFlags holds profiling flag values
func (*ProfilingFlags) IsEnabled ¶
func (f *ProfilingFlags) IsEnabled() bool
IsEnabled returns true if any profiling is enabled
func (*ProfilingFlags) ToConfig ¶
func (f *ProfilingFlags) ToConfig() Config
ToConfig converts flags to profiling config