Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-hwoo committed Jan 29, 2024
1 parent 457c245 commit 5063521
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/c++/perf_analyzer/report_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,17 @@ ReportWriter::CalculateLLMMetrics()

for (const auto& exp : experiments) {
for (const auto& req : exp.requests) {
for (size_t i = 0; i < req.response_times_.size(); i++) {
if (i == 0) {
const std::chrono::duration<double, std::micro> ttft{
req.response_times_[i] - req.start_time_};
first_token_latencies.push_back(ttft.count());
} else {
const std::chrono::duration<double, std::micro> t2t{
req.response_times_[i] - req.response_times_[i - 1]};
t2t_latencies.push_back(t2t.count());
}
// Collect first token latencies
if (!req.response_times_.empty()) {
const std::chrono::duration<double, std::micro> ttft{
req.response_times_.front() - req.start_time_};
first_token_latencies.push_back(ttft.count());
}
// Collect token-to-token (T2T) latencies
for (size_t i = 1; i < req.response_times_.size(); i++) {
const std::chrono::duration<double, std::micro> t2t{
req.response_times_[i] - req.response_times_[i - 1]};
t2t_latencies.push_back(t2t.count());
}
}
}
Expand Down

0 comments on commit 5063521

Please sign in to comment.