Documentation
¶
Overview ¶
Package stats provides performance tracking and statistics for link checking operations. It captures timing information for each phase of execution, memory usage, and throughput metrics to help identify bottlenecks and optimize performance.
Index ¶
- func FormatBytes(bytes uint64) string
- func FormatDuration(d time.Duration) string
- type Stats
- func (s *Stats) AvgResponseTime() time.Duration
- func (s *Stats) CheckDuration() time.Duration
- func (s *Stats) EndCheck()
- func (s *Stats) EndParse(linksFound, uniqueURLs, duplicates, ignored int)
- func (s *Stats) EndScan(filesFound int)
- func (s *Stats) ParseDuration() time.Duration
- func (s *Stats) ScanDuration() time.Duration
- func (s *Stats) StartCheck()
- func (s *Stats) StartParse()
- func (s *Stats) StartScan()
- func (s *Stats) String() string
- func (s *Stats) ToJSON() map[string]any
- func (s *Stats) TotalDuration() time.Duration
- func (s *Stats) URLsPerSecond() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBytes ¶
FormatBytes formats bytes for human-readable display.
func FormatDuration ¶
FormatDuration formats a duration for display.
Types ¶
type Stats ¶
type Stats struct {
// Timing for each phase
ScanStart time.Time
ScanEnd time.Time
ParseStart time.Time
ParseEnd time.Time
CheckStart time.Time
CheckEnd time.Time
// Counts
FilesScanned int
LinksFound int
UniqueURLs int
Duplicates int
Ignored int
// Memory stats (captured at end)
HeapAlloc uint64
TotalAlloc uint64
NumGC uint32
NumGoroutine int
}
Stats holds performance metrics for a link checking session.
func (*Stats) AvgResponseTime ¶
AvgResponseTime returns the average time per URL check.
func (*Stats) CheckDuration ¶
CheckDuration returns the time spent checking URLs.
func (*Stats) EndCheck ¶
func (s *Stats) EndCheck()
EndCheck marks the end of the URL checking phase and captures memory stats.
func (*Stats) ParseDuration ¶
ParseDuration returns the time spent parsing links from files.
func (*Stats) ScanDuration ¶
ScanDuration returns the time spent scanning for files.
func (*Stats) StartCheck ¶
func (s *Stats) StartCheck()
StartCheck marks the beginning of the URL checking phase.
func (*Stats) StartParse ¶
func (s *Stats) StartParse()
StartParse marks the beginning of the link parsing phase.
func (*Stats) StartScan ¶
func (s *Stats) StartScan()
StartScan marks the beginning of the file scanning phase.
func (*Stats) TotalDuration ¶
TotalDuration returns the total time from scan start to check end.
func (*Stats) URLsPerSecond ¶
URLsPerSecond returns the throughput of URL checking.