Skip to content

Commit

Permalink
Update formatted percentiles definitions and references
Browse files Browse the repository at this point in the history
  • Loading branch information
VirajP1002 committed Sep 23, 2024
1 parent d53cf05 commit 2a9ef0f
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions scripts/benchmark_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ def __init__(self, folder_paths: List[str]):
f"{percentile}th: {self.percentiles[percentile]}ms"
for percentile in self.PERCENTILES_TO_REPORT
)
self._formatted_metrics: Mapping = {
"average_get": self.formatted_percentile(self.average_get),
"average_post": self.formatted_percentile(self.average_post),
"pdf_percentile": self.formatted_percentile(self.average_pdf_percentile),
"session_percentile": self.formatted_percentile(
self.average_session_percentile
),
}

self.formatted_average_get: str = self.formatted_percentile(self.average_get)
self.formatted_average_post: str = self.formatted_percentile(self.average_post)
self.formatted_average_pdf_percentile: str = self.formatted_percentile(
self.average_pdf_percentile
)
self.formatted_average_session_percentile: str = self.formatted_percentile(
self.average_session_percentile
)

def __str__(self):
if self.output_to_github:
Expand All @@ -50,10 +51,10 @@ def __str__(self):
f"**Benchmark Results**<br /><br />"
f"Percentile Averages:<br />"
f"{formatted_percentiles}<br />"
f"GETs (99th): {self._formatted_metrics['average_get']}<br />"
f"POSTs (99th): {self._formatted_metrics['average_post']}<br /><br />"
f"PDF: {self._formatted_metrics['pdf_percentile']}<br />"
f"Session: {self._formatted_metrics['session_percentile']}<br /><br />"
f"GETs (99th): {self.formatted_average_get}<br />"
f"POSTs (99th): {self.formatted_average_post}<br /><br />"
f"PDF: {self.formatted_average_pdf_percentile}<br />"
f"Session: {self.formatted_average_session_percentile}<br /><br />"
f"Total Requests: {self.total_requests:,}<br />"
f"Total Failures: {self._total_failures:,}<br />"
f'Error Percentage: {(round(self.error_percentage, 2))}%<br />"}}'
Expand All @@ -63,11 +64,11 @@ def __str__(self):
f"Percentile Averages:\n"
f"{self._formatted_percentiles}\n"
f"---\n"
f"GETs (99th): {self._formatted_metrics['average_get']}\n"
f"POSTs (99th): {self._formatted_metrics['average_post']}\n"
f"GETs (99th): {self.formatted_average_get}\n"
f"POSTs (99th): {self.formatted_average_post}\n"
f"---\n"
f"PDF: {self._formatted_metrics['pdf_percentile']}\n"
f"Session: {self._formatted_metrics['session_percentile']}\n"
f"PDF: {self.formatted_average_pdf_percentile}\n"
f"Session: {self.formatted_average_session_percentile}\n"
f"---\n"
f"Total Requests: {self.total_requests:,}\n"
f"Total Failures: {self._total_failures:,}\n"
Expand Down

0 comments on commit 2a9ef0f

Please sign in to comment.