change swap to M for consistency. Closes #63.

This commit is contained in:
Hisham Muhammad 2014-04-24 19:03:07 -03:00
parent ab118c2dbe
commit eb1cd4aca6
1 changed files with 2 additions and 6 deletions

View File

@ -30,18 +30,14 @@ int SwapMeter_attributes[] = {
/* NOTE: Value is in kilobytes */ /* NOTE: Value is in kilobytes */
static void SwapMeter_humanNumber(char* buffer, const long int* value) { static void SwapMeter_humanNumber(char* buffer, const long int* value) {
if (*value >= 10*GIGABYTE)
sprintf(buffer, "%ldG ", *value / GIGABYTE);
else if (*value >= 10*MEGABYTE)
sprintf(buffer, "%ldM ", *value / MEGABYTE); sprintf(buffer, "%ldM ", *value / MEGABYTE);
else
sprintf(buffer, "%ldK ", *value);
} }
static void SwapMeter_setValues(Meter* this, char* buffer, int len) { static void SwapMeter_setValues(Meter* this, char* buffer, int len) {
long int usedSwap = this->pl->usedSwap; long int usedSwap = this->pl->usedSwap;
this->total = this->pl->totalSwap; this->total = this->pl->totalSwap;
this->values[0] = usedSwap; this->values[0] = usedSwap;
snprintf(buffer, len, "%ld/%ldMB", (long int) usedSwap / MEGABYTE, (long int) this->total / MEGABYTE); snprintf(buffer, len, "%ld/%ldMB", (long int) usedSwap / MEGABYTE, (long int) this->total / MEGABYTE);
} }