From 5200febaeabcd023ba1014cd68be15976a428fc3 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Wed, 4 Dec 2019 11:53:20 +0000 Subject: [PATCH] add stats debug interface --- debug/stats/stats.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 debug/stats/stats.go diff --git a/debug/stats/stats.go b/debug/stats/stats.go new file mode 100644 index 00000000..16e9faf3 --- /dev/null +++ b/debug/stats/stats.go @@ -0,0 +1,24 @@ +// Package stats provides runtime stats +package stats + +// Stats provides stats interface +type Stats interface { + // Read a stat snapshot + Read() (*Stat, error) + // Write a stat snapshot + Write(*Stat) error +} + +// A runtime stat +type Stat struct { + // Start time as unix timestamp + Started int64 + // Uptime in nanoseconds + Uptime int64 + // Memory usage in bytes + Memory uint64 + // Threads aka go routines + Threads uint64 + // Garbage collection in nanoseconds + GC uint64 +}