This source file includes following definitions.
- GetUnitDetails
#include "chrome/browser/ui/webui/performance_monitor/performance_monitor_ui_constants.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "chrome/browser/performance_monitor/constants.h"
namespace performance_monitor {
namespace {
const UnitDetails kUnitDetailsList[] = {
{ UNIT_BYTES, MEASUREMENT_TYPE_MEMORY, 1 },
{ UNIT_KILOBYTES, MEASUREMENT_TYPE_MEMORY, kBytesPerKilobyte },
{ UNIT_MEGABYTES, MEASUREMENT_TYPE_MEMORY, kBytesPerMegabyte },
{ UNIT_GIGABYTES, MEASUREMENT_TYPE_MEMORY, kBytesPerGigabyte },
{ UNIT_TERABYTES, MEASUREMENT_TYPE_MEMORY, kBytesPerTerabyte },
{ UNIT_MICROSECONDS, MEASUREMENT_TYPE_TIME, 1 },
{ UNIT_MILLISECONDS, MEASUREMENT_TYPE_TIME,
base::Time::kMicrosecondsPerMillisecond },
{ UNIT_SECONDS, MEASUREMENT_TYPE_TIME, base::Time::kMicrosecondsPerSecond },
{ UNIT_MINUTES, MEASUREMENT_TYPE_TIME, base::Time::kMicrosecondsPerMinute },
{ UNIT_HOURS, MEASUREMENT_TYPE_TIME, base::Time::kMicrosecondsPerHour },
{ UNIT_DAYS, MEASUREMENT_TYPE_TIME, base::Time::kMicrosecondsPerDay },
{ UNIT_WEEKS, MEASUREMENT_TYPE_TIME, base::Time::kMicrosecondsPerWeek },
{ UNIT_MONTHS, MEASUREMENT_TYPE_TIME, kMicrosecondsPerMonth },
{ UNIT_YEARS, MEASUREMENT_TYPE_TIME, kMicrosecondsPerYear },
{ UNIT_PERCENT, MEASUREMENT_TYPE_PERCENT, 1 },
};
COMPILE_ASSERT(ARRAYSIZE_UNSAFE(kUnitDetailsList) == UNIT_UNDEFINED,
unit_details_doesnt_match_unit_types);
}
const UnitDetails* GetUnitDetails(Unit unit) {
if (unit == UNIT_UNDEFINED) {
LOG(ERROR) << "Request for undefined unit";
return NULL;
}
return &kUnitDetailsList[unit];
}
}