2019-11-07 19:05:39 +00:00
|
|
|
package lint
|
|
|
|
|
2020-02-26 18:46:17 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"golang.org/x/tools/go/analysis"
|
|
|
|
)
|
|
|
|
|
2019-11-07 19:05:39 +00:00
|
|
|
const (
|
|
|
|
StateInitializing = 0
|
|
|
|
StateGraph = 1
|
|
|
|
StateProcessing = 2
|
|
|
|
StateCumulative = 3
|
|
|
|
)
|
|
|
|
|
|
|
|
type Stats struct {
|
|
|
|
State uint32
|
|
|
|
|
|
|
|
InitialPackages uint32
|
|
|
|
TotalPackages uint32
|
|
|
|
ProcessedPackages uint32
|
|
|
|
ProcessedInitialPackages uint32
|
|
|
|
Problems uint32
|
|
|
|
ActiveWorkers uint32
|
|
|
|
TotalWorkers uint32
|
2020-02-26 18:46:17 +00:00
|
|
|
PrintAnalyzerMeasurement func(*analysis.Analyzer, *Package, time.Duration)
|
|
|
|
}
|
|
|
|
|
|
|
|
type AnalysisMeasurementKey struct {
|
|
|
|
Analysis string
|
|
|
|
Pkg string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Stats) MeasureAnalyzer(analysis *analysis.Analyzer, pkg *Package, d time.Duration) {
|
|
|
|
if s.PrintAnalyzerMeasurement != nil {
|
|
|
|
s.PrintAnalyzerMeasurement(analysis, pkg, d)
|
|
|
|
}
|
2019-11-07 19:05:39 +00:00
|
|
|
}
|