Skip to content

Commit 2d9823c

Browse files
committed
Refactor logging output in testProviderMetrics for clarity; enhance markdown report generation to include performance leaderboard sorted by E2E latency
1 parent 22b9c9e commit 2d9823c

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

main.go

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ func testProviderMetrics(config ProviderConfig, tke *tiktoken.Tiktoken, wg *sync
223223
providerLogger.Printf(" Model: %s", config.Model)
224224
providerLogger.Printf(" Total Output Tokens: %d", completionTokens)
225225
providerLogger.Println("----------------------------------------------")
226-
providerLogger.Printf(" End-to-End Latency: %v", e2eLatency)
227-
providerLogger.Printf(" Latency (TTFT): %v", ttft)
228-
providerLogger.Printf(" Throughput (Tokens/sec): %.2f tokens/s", throughput)
226+
providerLogger.Printf(" End-to-End Latency: %v", e2eLatency)
227+
providerLogger.Printf(" Latency (TTFT): %v", ttft)
228+
providerLogger.Printf(" Throughput (Tokens/sec): %.2f tokens/s", throughput)
229229
providerLogger.Println("==============================================")
230230
// Uncomment to see the full response
231231
// providerLogger.Printf("[%s] Full Response:\n%s\n", config.Name, fullResponse)
@@ -337,7 +337,7 @@ func generateMarkdownReport(resultsDir string, results []TestResult, sessionTime
337337

338338
// Leaderboard (sorted by throughput)
339339
if successful > 0 {
340-
report.WriteString("## 🏆 Performance Leaderboard\n\n")
340+
report.WriteString("## Performance Leaderboard\n\n")
341341
report.WriteString("### By Throughput (Tokens/sec)\n\n")
342342

343343
// Sort by throughput
@@ -393,6 +393,30 @@ func generateMarkdownReport(resultsDir string, results []TestResult, sessionTime
393393
r.E2ELatency))
394394
}
395395
report.WriteString("\n")
396+
397+
// Sort by E2E Latency
398+
report.WriteString("### By End-to-End Latency\n\n")
399+
400+
for i := 0; i < len(successfulResults); i++ {
401+
for j := i + 1; j < len(successfulResults); j++ {
402+
if successfulResults[j].E2ELatency < successfulResults[i].E2ELatency {
403+
successfulResults[i], successfulResults[j] = successfulResults[j], successfulResults[i]
404+
}
405+
}
406+
}
407+
408+
report.WriteString("| Rank | Provider | E2E Latency | TTFT | Throughput |\n")
409+
report.WriteString("|------|----------|-------------|------|------------|\n")
410+
411+
for i, r := range successfulResults {
412+
report.WriteString(fmt.Sprintf("| %d | %s | %v | %v | %.2f tok/s |\n",
413+
i+1,
414+
r.Provider,
415+
r.E2ELatency,
416+
r.TTFT,
417+
r.Throughput))
418+
}
419+
report.WriteString("\n")
396420
}
397421

398422
report.WriteString("---\n\n")

0 commit comments

Comments
 (0)