@@ -223,7 +223,7 @@ std::string FortioOutputFormatterImpl::formatProto(const nighthawk::client::Outp
223223 fortio_output.set_jitter (output.options ().has_jitter_uniform ());
224224 fortio_output.set_runtype (" HTTP" );
225225
226- // The stock Envoy h2 pool doesn't offer supper for multiple connections here. So we must ignore
226+ // The stock Envoy h2 pool doesn't offer support for multiple connections here. So we must ignore
227227 // the connections setting when h2 is enabled and the experimental h2-pool which supports multiple
228228 // connections isn't enabled. Also, the number of workers acts as a multiplier.
229229 const uint32_t number_of_connections =
@@ -269,11 +269,9 @@ std::string FortioOutputFormatterImpl::formatProto(const nighthawk::client::Outp
269269 nighthawk::client::DurationHistogram fortio_histogram;
270270 uint64_t prev_fortio_count = 0 ;
271271 double prev_fortio_end = 0 ;
272- const int percentiles_size = nh_stat. percentiles (). size () ;
273- for (int i = 0 ; i < percentiles_size; i++ ) {
272+ int i = 0 ;
273+ for (const auto & nh_percentile : nh_stat. percentiles () ) {
274274 nighthawk::client::DataEntry fortio_data_entry;
275- const auto & nh_percentile = nh_stat.percentiles ().at (i);
276-
277275 // fortio_percent = 100 * nh_percentile
278276 fortio_data_entry.set_percent (nh_percentile.percentile () * 100 );
279277
@@ -285,7 +283,7 @@ std::string FortioOutputFormatterImpl::formatProto(const nighthawk::client::Outp
285283 fortio_data_entry.set_end (nh_percentile_duration_sec);
286284
287285 // fortio_start = prev_fortio_end
288- if (i == 0 ) {
286+ if (i++ == 0 ) {
289287 // If this is the first entry, force the start and end time to be the same.
290288 // This prevents it from starting at 0, making it disproportionally big in the UI.
291289 prev_fortio_end = nh_percentile_duration_sec;
0 commit comments