@@ -211,18 +211,29 @@ void measure_cpu_only_base::generate_summaries()
211211 if (m_max_time_exceeded)
212212 {
213213 const auto timeout = m_walltime_timer.get_duration ();
214- const auto max_noise = m_criterion_params.get_float64 (" max-noise" );
215- const auto min_time = m_criterion_params.get_float64 (" min-time" );
216214
217- if (cpu_noise > max_noise)
215+ auto get_param = [this ](std::optional<nvbench::float64_t > ¶m, const std::string &name) {
216+ if (m_criterion_params.has_value (name))
217+ {
218+ param = m_criterion_params.get_float64 (name);
219+ }
220+ };
221+
222+ std::optional<nvbench::float64_t > max_noise;
223+ get_param (max_noise, " max-noise" );
224+
225+ std::optional<nvbench::float64_t > min_time;
226+ get_param (min_time, " min-time" );
227+
228+ if (max_noise && cpu_noise > *max_noise)
218229 {
219230 printer.log (nvbench::log_level::warn,
220231 fmt::format (" Current measurement timed out ({:0.2f}s) "
221232 " while over noise threshold ({:0.2f}% > "
222233 " {:0.2f}%)" ,
223234 timeout,
224235 cpu_noise * 100 ,
225- max_noise * 100 ));
236+ * max_noise * 100 ));
226237 }
227238 if (m_total_samples < m_min_samples)
228239 {
@@ -233,15 +244,15 @@ void measure_cpu_only_base::generate_summaries()
233244 m_total_samples,
234245 m_min_samples));
235246 }
236- if (m_total_cpu_time < min_time)
247+ if (min_time && m_total_cpu_time < * min_time)
237248 {
238249 printer.log (nvbench::log_level::warn,
239250 fmt::format (" Current measurement timed out ({:0.2f}s) "
240251 " before accumulating min_time ({:0.2f}s < "
241252 " {:0.2f}s)" ,
242253 timeout,
243254 m_total_cpu_time,
244- min_time));
255+ * min_time));
245256 }
246257 }
247258
0 commit comments