Use MB instead of GB for pretty memory < 10GB. (Gerrit Slomma)

This commit is contained in:
Cole Robinson 2009-04-20 11:46:37 -04:00
parent 0f1a31c93a
commit 0f608da66c
3 changed files with 11 additions and 9 deletions

View File

@ -12,6 +12,7 @@ The user interaction / interface design and artwork is
done by:
Máirín Duffy <duffy-at-redhat-dot-com>
Jeremy Perry <jeperry-at-redhat-dot-com>
Further patches have been submitted by:
@ -52,6 +53,7 @@ Further patches have been submitted by:
Radek Hladik <radek-at-eadresa-dot-cz>
Michael Marineau (marineam-at-gentoo-dot-org)
Vitaly Mayatskikh <vmayatsk-at-redhat-dot-com>
Gerrit Slomma <roadrunner_gs-at-web-dot-de>
<...send a patch & get your name here...>

View File

@ -711,10 +711,10 @@ class vmmConnection(gobject.GObject):
if self.vmm is None:
return ""
mem = self.host_memory_size()
if mem > (1024*1024):
if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
return "%2.2f MB" % (mem/1024.0)
return "%2.0f MB" % (mem/1024.0)
def host_memory_size(self):
@ -1135,10 +1135,10 @@ class vmmConnection(gobject.GObject):
def pretty_current_memory(self):
mem = self.current_memory()
if mem > (1024*1024):
if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
return "%2.2f MB" % (mem/1024.0)
return "%2.0f MB" % (mem/1024.0)
def current_memory_percentage(self):
if len(self.record) == 0:

View File

@ -370,7 +370,7 @@ class vmmDomain(gobject.GObject):
def current_memory_pretty(self):
if self.get_id() == -1:
return "0.00 MB"
return "0 MB"
return self.get_memory_pretty()
@ -391,10 +391,10 @@ class vmmDomain(gobject.GObject):
def get_memory_pretty(self):
mem = self.get_memory()
if mem > (1024*1024):
if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
return "%2.2f MB" % (mem/1024.0)
return "%2.0f MB" % (mem/1024.0)
def maximum_memory(self):
@ -409,10 +409,10 @@ class vmmDomain(gobject.GObject):
def maximum_memory_pretty(self):
mem = self.maximum_memory()
if mem > (1024*1024):
if mem > (10*1024*1024):
return "%2.2f GB" % (mem/(1024.0*1024.0))
else:
return "%2.2f MB" % (mem/1024.0)
return "%2.0f MB" % (mem/1024.0)
def cpu_time(self):