#include "components/memory_pressure/system_memory_pressure_evaluator_linux.h"
#include "base/functional/bind.h"
#include "base/numerics/safe_conversions.h"
#include "base/process/process_metrics.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/time/time.h"
#include "components/memory_pressure/multi_source_memory_pressure_monitor.h"
namespace {
constexpr int kKiBperMiB = …;
int GetAvailableSystemMemoryMiB(const base::SystemMemoryInfoKB& mem_info) { … }
}
namespace memory_pressure {
namespace os_linux {
const base::TimeDelta SystemMemoryPressureEvaluator::kMemorySamplingPeriod = …;
const base::TimeDelta SystemMemoryPressureEvaluator::kModeratePressureCooldown = …;
const int SystemMemoryPressureEvaluator::kDefaultModerateThresholdPc = …;
const int SystemMemoryPressureEvaluator::kDefaultCriticalThresholdPc = …;
SystemMemoryPressureEvaluator::SystemMemoryPressureEvaluator(
std::unique_ptr<MemoryPressureVoter> voter)
: … { … }
SystemMemoryPressureEvaluator::SystemMemoryPressureEvaluator(
int moderate_threshold_mb,
int critical_threshold_mb,
std::unique_ptr<MemoryPressureVoter> voter)
: … { … }
void SystemMemoryPressureEvaluator::StartObserving() { … }
void SystemMemoryPressureEvaluator::StopObserving() { … }
bool SystemMemoryPressureEvaluator::GetSystemMemoryInfo(
base::SystemMemoryInfoKB* mem_info) { … }
void SystemMemoryPressureEvaluator::CheckMemoryPressure() { … }
bool SystemMemoryPressureEvaluator::InferThresholds() { … }
base::MemoryPressureListener::MemoryPressureLevel
SystemMemoryPressureEvaluator::CalculateCurrentPressureLevel() { … }
}
}