#include <cstdint>
#include <iostream>
#include <limits>
#include <optional>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_executor.h"
#include "base/timer/timer.h"
#include "tools/memory/simulator/memory_simulator.h"
#include "tools/memory/simulator/metrics_printer.h"
#include "tools/memory/simulator/simulator_metrics_provider.h"
#include "tools/memory/simulator/utils.h"
#if BUILDFLAG(IS_MAC)
#include "tools/memory/simulator/process_metrics_provider_mac.h"
#include "tools/memory/simulator/system_metrics_provider_mac.h"
#endif
namespace {
void InitLogging() { … }
constexpr char kSwitchHelp[] = …;
constexpr char kSwitchAllocPerSec[] = …;
constexpr char kSwitchReadPerSec[] = …;
constexpr char kSwitchWritePerSec[] = …;
constexpr char kSwitchAllocLimit[] = …;
constexpr char kSwitchStartTimeout[] = …;
constexpr char kSwitchReadTimeout[] = …;
constexpr char kSwitchWriteTimeout[] = …;
constexpr char kSwitchFreeTimeout[] = …;
constexpr char kSwitchExitTimeout[] = …;
constexpr char kUsageString[] = …;
void PrintUsageError(const std::string error) { … }
enum StatusCode { … };
std::optional<int64_t> GetInt64Switch(const base::CommandLine& command_line,
const std::string& switch_name,
int64_t default_value) { … }
std::optional<base::TimeDelta> GetSecondsSwitch(
const base::CommandLine& command_line,
const std::string& switch_name,
int64_t default_value) { … }
}
int main(int argc, char** argv) { … }