feat: add statictics
This commit is contained in:
43
statistics/main.go
Normal file
43
statistics/main.go
Normal file
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user