MCPcopy Create free account
hub / github.com/PasarGuard/node / buildDeltaStats

Function buildDeltaStats

pkg/stats/interface_counters.go:51–75  ·  view source on GitHub ↗
(name, link string, rx, tx int64)

Source from the content-addressed store, hash-verified

49}
50
51func buildDeltaStats(name, link string, rx, tx int64) []*common.Stat {
52 if rx == 0 && tx == 0 {
53 return nil
54 }
55
56 stats := make([]*common.Stat, 0, 2)
57 if tx > 0 {
58 stats = append(stats, &common.Stat{
59 Name: name,
60 Type: "uplink",
61 Link: link,
62 Value: tx,
63 })
64 }
65 if rx > 0 {
66 stats = append(stats, &common.Stat{
67 Name: name,
68 Type: "downlink",
69 Link: link,
70 Value: rx,
71 })
72 }
73
74 return stats
75}
76
77func BuildInterfaceStats(name, link string, rx, tx int64) []*common.Stat {
78 return buildDeltaStats(name, link, rx, tx)

Callers 3

BuildInterfaceStatsFunction · 0.85
GetStatsMethod · 0.85
GetUsersStatsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected