int Senpai::init()

in src/oomd/plugins/Senpai.cpp [39:83]


int Senpai::init(
    const Engine::PluginArgs& args,
    const PluginConstructionContext& context) {
  argParser_.addArgumentCustom(
      "cgroup",
      cgroups_,
      [context](const std::string& cgroupStr) {
        return PluginArgParser::parseCgroup(context, cgroupStr);
      },
      true);
  argParser_.addArgument("limit_min_bytes", limit_min_bytes_);
  argParser_.addArgument("limit_max_bytes", limit_max_bytes_);
  argParser_.addArgument("interval", interval_);
  argParser_.addArgument("pressure_ms", pressure_ms_);
  argParser_.addArgument("pressure_pct", mem_pressure_pct_);
  argParser_.addArgument("io_pressure_pct", io_pressure_pct_);
  argParser_.addArgument("max_probe", max_probe_);
  argParser_.addArgument("max_backoff", max_backoff_);
  argParser_.addArgument("coeff_probe", coeff_probe_);
  argParser_.addArgument("coeff_backoff", coeff_backoff_);
  argParser_.addArgument("immediate_backoff", immediate_backoff_);
  argParser_.addArgument("memory_high_timeout_ms", memory_high_timeout_);
  argParser_.addArgument("swap_threshold", swap_threshold_);
  argParser_.addArgument("swapout_bps_threshold", swapout_bps_threshold_);
  argParser_.addArgument("swap_validation", swap_validation_);
  argParser_.addArgument("modulate_swappiness", modulate_swappiness_);
  argParser_.addArgument("log_interval", log_interval_);

  if (!argParser_.parse(args)) {
    return 1;
  }

  auto meminfo = Fs::getMeminfo();
  // TODO(dschatzberg): Report Error
  if (meminfo) {
    if (auto pos = meminfo->find("MemTotal"); pos != meminfo->end()) {
      host_mem_total_ = pos->second;
    }
  } else {
    OLOG << "Cannot read host MemTotal";
    return 1;
  }

  return 0;
}