mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-25 11:59:35 +00:00
37 lines
600 B
Go
37 lines
600 B
Go
package providers
|
|
|
|
import (
|
|
"reflect"
|
|
"time"
|
|
)
|
|
|
|
type GeneralStats struct {
|
|
EntriesCount int
|
|
FirstEntryTimestamp int
|
|
LastEntryTimestamp int
|
|
}
|
|
|
|
var generalStats = GeneralStats{}
|
|
|
|
func ResetGeneralStats() {
|
|
generalStats = GeneralStats{}
|
|
}
|
|
|
|
func GetGeneralStats() GeneralStats {
|
|
return generalStats
|
|
}
|
|
|
|
func EntryAdded() {
|
|
generalStats.EntriesCount++
|
|
|
|
currentTimestamp := int(time.Now().Unix())
|
|
|
|
if reflect.Value.IsZero(reflect.ValueOf(generalStats.FirstEntryTimestamp)) {
|
|
generalStats.FirstEntryTimestamp = currentTimestamp
|
|
}
|
|
|
|
generalStats.LastEntryTimestamp = currentTimestamp
|
|
}
|
|
|
|
|