Merge pull request #803 from vmarmol/mem-limit

Lower threshold for "unlimited".
This commit is contained in:
Rohit Jnagal 2015-07-07 08:52:52 -07:00
commit 44f86044e1

View File

@ -18,7 +18,6 @@ package pages
import (
"fmt"
"html/template"
"math"
"net/http"
"net/url"
"path"
@ -149,15 +148,19 @@ func toMegabytes(bytes uint64) float64 {
return float64(bytes) / (1 << 20)
}
// Size after which we consider memory to be "unlimited". This is not
// MaxInt64 due to rounding by the kernel.
const maxMemorySize = uint64(1 << 62)
func printSize(bytes uint64) string {
if bytes >= math.MaxInt64 {
if bytes >= maxMemorySize {
return "unlimited"
}
return ByteSize(bytes).Size()
}
func printUnit(bytes uint64) string {
if bytes >= math.MaxInt64 {
if bytes >= maxMemorySize {
return ""
}
return ByteSize(bytes).Unit()