Skip to content

Commit

Permalink
Improve summary
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Aug 2, 2020
1 parent 99ab460 commit 6216d04
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 15 deletions.
6 changes: 3 additions & 3 deletions docs/sphinx/ug_use_cases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Stress Tests
access.
- Optionally define ``monitor: true`` for selected activities, to collect extra
statistics.
- Pass ``--monitor`` to view live proogress.
- Pass ``--monitor`` to view live progress in a separate browser window.


CI Tests
Expand Down Expand Up @@ -63,8 +63,8 @@ Developing and Debugging Scripts
- Pass ``--single`` so ``duration`` and ``repeat`` options are ignored.
- Pass ``--verbose`` (``-v``) or even ``-vv`` to print more information about
requests and responses.
- Set the ``config.max_errors: 1`` option (or pass the``--max-errors=1`` argument),
so we fail on the first error.
- Set the ``config.max_errors: 1`` option (or pass the ``--max-errors=1``
argument), so we fail on the first error.
- Optionally define ``debug: true`` for selected activities, to print extra
information.

Expand Down
52 changes: 40 additions & 12 deletions stressor/run_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ def get_cli_summary(self):
cm = self.config_manager
lines = []
run_time = self.end_stamp - self.start_stamp
# run_time = self.end_dt - self.start_dt
user_count = len(self.session_list)
has_errors = self.has_errors()

ap = lines.append
col = red if has_errors else green
horz_line = col("=-" * 35 + "=")
horz_line = col("=-" * 38 + "=")

ap("Result Summary:")
ap(horz_line)
Expand All @@ -188,23 +188,51 @@ def get_cli_summary(self):
ap(" End: {}".format(self.end_dt.strftime("%Y-%m-%d %H:%M:%S")))
ap(
"Run time {}, net: {}.".format(
run_time, format_elap(self.stats["net_act_time"], high_prec=True),
format_elap(run_time, high_prec=True),
format_elap(self.stats["net_act_time"], high_prec=True),
)
)
ap(
"Executed {:,} activities in {:,} sequences, using {:,} parallel sessions.".format(
self.stats["act_count"],
self.stats["seq_count"],
len(self.session_list),
self.stats["act_count"], self.stats["seq_count"], user_count,
)
)
fact = run_time * len(self.session_list)
fact = 1.0 / fact if fact else 0.0
ap(
"Performance: {:,.3f} activities ({:,.3f} sequences) per sec./session.".format(
fact * self.stats["act_count"], fact * self.stats["seq_count"],
if run_time:
ap(
"Sequence duration: {} average.".format(
format_elap(run_time / self.stats["seq_count"], high_prec=True)
)
)
)
ap(
" rate: {:,.3f} sequences per minute (per user: {:,.3f}).".format(
60.0 * self.stats["seq_count"] / run_time,
60.0 * self.stats["seq_count"] / (run_time * user_count),
)
)
ap(
"Activity rate: {:,.3f} activities per second (per user: {:,.3f}).".format(
self.stats["act_count"] / run_time,
self.stats["act_count"] / (run_time * user_count),
)
)

# --- List of all activities that are marked `monitor: true`
if self.stats["monitored"]:
print(self.stats["monitored"])
ap("{} monitored activities:".format(len(self.stats["monitored"])))
for path, info in self.stats["monitored"].items():
errors = info.get("errors")
ap(" - {}".format(path))
ap(
" n: {:,}, min: {}, avg: {}, max: {}{}".format(
info["act_count"],
format_elap(info["act_time_min"], high_prec=True),
format_elap(info["act_time_avg"], high_prec=True),
format_elap(info["act_time_max"], high_prec=True),
red(", {} errors".format(errors)) if errors else "",
)
)

if has_errors:
pics = emoji(" 💥 💔 💥", "")
ap(
Expand Down

0 comments on commit 6216d04

Please sign in to comment.