MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / init

Function init

internal/stats/bandwidth_stat_manager.go:28–47  ·  view source on GitHub ↗

N秒平均,更为精确

()

Source from the content-addressed store, hash-verified

26const bandwidthTimestampDelim = 2 // N秒平均,更为精确
27
28func init() {
29 if !teaconst.IsMain {
30 return
31 }
32
33 events.On(events.EventLoaded, func() {
34 goman.New(func() {
35 SharedBandwidthStatManager.Start()
36 })
37 })
38
39 events.OnClose(func() {
40 SharedBandwidthStatManager.Cancel()
41
42 err := SharedBandwidthStatManager.Save()
43 if err != nil {
44 remotelogs.Error("STAT", "save bandwidth stats failed: "+err.Error())
45 }
46 })
47}
48
49type BandwidthStat struct {
50 Day string `json:"day"`

Callers

nothing calls this directly

Calls 8

OnFunction · 0.92
NewFunction · 0.92
OnCloseFunction · 0.92
ErrorFunction · 0.92
CancelMethod · 0.80
StartMethod · 0.65
SaveMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected