From c10ff6a81ea94891071497b3b452836550d769b8 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 25 Jan 2021 00:35:43 +0800 Subject: [PATCH] feat: add statictics --- statistics/main.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 statistics/main.go diff --git a/statistics/main.go b/statistics/main.go new file mode 100644 index 0000000..197fe0b --- /dev/null +++ b/statistics/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + "sync" +) + +type ChannelItem struct { + tag string + upBytes uint64 + downBytes uint64 +} + +type DurationChannelItems struct { + durationTag string + channelItemMap map[string]ChannelItem +} + +var durationChannelItemsMap = map[string]DurationChannelItems{} +var durationChannelItemsMapLock = sync.RWMutex{} + +type CountItem struct { + tag string + timestamp uint64 + upBytes uint64 + downBytes uint64 +} + +var countItemChan = make(chan CountItem) + +// var countItemChan = make(ChannelItem, 0) + +func main() { + +} + +func collectCountItem() { + for { + countItem := <-countItemChan + // TODO ... + fmt.Printf("%v\n", countItem) + } +}