rfmoz / tuptime

Report historical and statistical real time of the system, keeping it between restarts. Like uptime command but with more interesting output.
GNU General Public License v2.0
288 stars 40 forks source link

Add plot grid and show bad shutdown support. #48

Closed roachsinai closed 5 years ago

roachsinai commented 5 years ago

Hi @rfrail3 I made an update for the plot bar chart script.

  1. support plot grid, it will be helpful when you what know the start time and end time of a bar split.
  2. plot badtime state if an database entry's endst is BAD.
(nn) hmank ~/c/G/tuptime dev » tup -a 1 --lwidth 1.5

Figure_1

If we got an tuptime entry like this:

{'startup': 34,
  'btime': 1553735469,
  'uptime': 4.74,
  'offbtime': 1553735474,
  'endst': 0,
  'downtime': 9497.26,
  'kernel': 'Linux-4.20.17-1-MANJARO-x86_64-with-arch-Manjaro-Linux'},

All time consumed by startup and shutdown state will be added and turn to badtime meas bad shutdown time.


usage:

(nn) hmank ~/c/G/tuptime dev » tup -h               
usage: tuptime-barchart.py [-h] [-f FILE] [-b BEGIN_DATE] [-e END_DATE]
                           [-p PAST_DAYS] [--fwidth FIG_WIDTH]
                           [--fheight FIG_HEIGHT] [-w BAR_WIDTH]
                           [--lwidth LINE_WIDTH] [-a GRID_ALPHA]

optional arguments:
  -h, --help            show this help message and exit
  -f, --filedb FILE     database file
  -b, --bdate BEGIN_DATE
                        begin date to plot, format:Y-m-d.
  -e, --edate END_DATE  end date to plot, format:Y-m-d. Default edate is
                        today.
  -p, --pastdays PAST_DAYS
                        past days before edate to plot, will be ignored if set
                        bdate (default is 7).
  --fwidth FIG_WIDTH    figure width.
  --fheight FIG_HEIGHT  figure height.
  -w, --bwidth BAR_WIDTH
                        The width of the bars (default is 0.5).
  --lwidth LINE_WIDTH   line width of figure grid (default is 1).
  -a, --galpha GRID_ALPHA
                        alpha value of figure grid (default is 0).
rfrail3 commented 5 years ago

Nice to see how this small change produce more feedback to the user. Good work, thanks!