#include "nix/expr/eval-profiler-settings.hh" #include "nix/util/configuration.hh" #include "nix/util/logging.hh" /* Needs to be included before config-impl.hh */ #include "nix/util/config-impl.hh" #include "nix/util/abstract-setting-to-json.hh" #include namespace nix { template<> EvalProfilerMode BaseSetting::parse(const std::string & str) const { if (str == "disabled") return EvalProfilerMode::disabled; else if (str == "flamegraph") return EvalProfilerMode::flamegraph; else throw UsageError("option '%s' has invalid value '%s'", name, str); } template<> struct BaseSetting::trait { static constexpr bool appendable = false; }; template<> std::string BaseSetting::to_string() const { if (value == EvalProfilerMode::disabled) return "disabled"; else if (value == EvalProfilerMode::flamegraph) return "flamegraph"; else unreachable(); } NLOHMANN_JSON_SERIALIZE_ENUM( EvalProfilerMode, { {EvalProfilerMode::disabled, "disabled"}, {EvalProfilerMode::flamegraph, "flamegraph"}, }); /* Explicit instantiation of templates */ template class BaseSetting; } // namespace nix