grim/youtrack-import
Clone
Summary
Browse
Changes
Graph
Handle comments that end up with no text after processing. This typically happens if it was a reply with the body removed
draft
2020-08-04, Gary Kramlich
45baf35db295
Handle comments that end up with no text after processing. This typically happens if it was a reply with the body removed
package
mem
import
(
"fmt"
"runtime"
)
func
PrintMemUsage
()
{
fmt
.
Printf
(
"%s\n"
,
MemUsage
())
}
func
MemUsage
()
string
{
var
m
runtime
.
MemStats
runtime
.
ReadMemStats
(
&
m
)
var
s
string
// For info on each, see: https://golang.org/pkg/runtime/#MemStats
s
+=
fmt
.
Sprintf
(
"Alloc = %v MiB"
,
bToMb
(
m
.
Alloc
))
s
+=
fmt
.
Sprintf
(
"\tTotalAlloc = %v MiB"
,
bToMb
(
m
.
TotalAlloc
))
s
+=
fmt
.
Sprintf
(
"\tSys = %v MiB"
,
bToMb
(
m
.
Sys
))
s
+=
fmt
.
Sprintf
(
"\tNumGC = %v\n"
,
m
.
NumGC
)
return
s
}
func
bToMb
(
b
uint64
)
uint64
{
return
b
/
1024
/
1024
}