From e634f4672260dac9c086a06bfe10e4e3859c77a1 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 15 Apr 2024 14:54:55 +0200 Subject: vm: export VM output metric VM output we receive on the host is effectively equivalent to RPC recv metric. If we stop printing programs in the fuzzer, traffic will move from output to RPC. It will be useful to see this change via metrics. --- pkg/stats/set.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg/stats') diff --git a/pkg/stats/set.go b/pkg/stats/set.go index 54e44e457..f5671148d 100644 --- a/pkg/stats/set.go +++ b/pkg/stats/set.go @@ -190,6 +190,11 @@ func LenOf(containerPtr any, mu *sync.RWMutex) func() int { } } +func FormatMB(v int, period time.Duration) string { + const KB, MB = 1 << 10, 1 << 20 + return fmt.Sprintf("%v MB (%v kb/sec)", (v+MB/2)/MB, (v+KB/2)/KB/int(period/time.Second)) +} + // Addittionally a custom 'func() int' can be passed to read the metric value from the function. // and 'func(int, time.Duration) string' can be passed for custom formatting of the metric value. -- cgit mrf-deployment