Stats files

This commit is contained in:
Jakob Borg
2015-05-31 13:31:28 +02:00
parent 9d06132743
commit 860fbe48dd
2 changed files with 72 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ var (
limitBurst = 20
dbConn = getEnvDefault("DISCOSRV_DB", "postgres://user:password@localhost/discosrv")
globalStats stats
statsFile string
)
func main() {
@@ -38,6 +39,7 @@ func main() {
flag.IntVar(&lruSize, "limit-cache", lruSize, "Limiter cache entries")
flag.IntVar(&limitAvg, "limit-avg", limitAvg, "Allowed average package rate, per 10 s")
flag.IntVar(&limitBurst, "limit-burst", limitBurst, "Allowed burst size, packets")
flag.StringVar(&statsFile, "stats-file", statsFile, "File to write periodic operation stats to")
flag.Parse()
addr, _ := net.ResolveUDPAddr("udp", listen)
@@ -74,6 +76,8 @@ func main() {
main.Add(&statssrv{
intv: statsIntv,
file: statsFile,
db: db,
})
globalStats.Reset()