Skip to content

Commit

Permalink
Merge pull request #1811 from locustio/auto-shrink-request-statistics…
Browse files Browse the repository at this point in the history
…-table-to-fit-terminal-size

Auto shrink request stats table to fit terminal
  • Loading branch information
cyberw authored Jul 12, 2021
2 parents fd9f5c4 + 2dba4c2 commit bd292f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from collections import namedtuple, OrderedDict
from copy import copy
from itertools import chain
import os
import csv

import gevent
Expand All @@ -14,7 +15,11 @@

console_logger = logging.getLogger("locust.stats_logger")

STATS_NAME_WIDTH = 60
"""Space in table for request name. Auto shrink it if terminal is small (<160 characters)"""
try:
STATS_NAME_WIDTH = max(min(os.get_terminal_size()[0] - 80, 80), 0)
except OSError: # not a real terminal
STATS_NAME_WIDTH = 80
STATS_TYPE_WIDTH = 8

"""Default interval for how frequently results are written to console."""
Expand Down

0 comments on commit bd292f2

Please sign in to comment.