MilhouseVH / bcmstat

Simple Raspberry Pi monitoring tool
GNU General Public License v2.0
263 stars 36 forks source link

Added a -k flag for human readable values on RX/TX and CPU Mem #14

Closed oboote closed 6 years ago

oboote commented 6 years ago

(Actually this pull request also includes my previous one adding the r/R flags for simpler CPU stats - haven't quite got my head round this whole pulling/branching)

Added a -k flag which does some unit conversions before displaying the results:

RX / TX: From Bytes to kBytes CPU Mem: From kBytes to MBytes

MilhouseVH commented 6 years ago

bcmstat.sh rx will crash:

Traceback (most recent call last):
  File "./x", line 1695, in <module>
    main(sys.argv[1:])
  File "./x", line 1674, in main
    ShowStats(display_flags, sysinfo, UFT[0][1], BCM[0][1], IRQ[0][1], NET[0][1], CPU[0][1], MEM[0][1], GPU[0][1], CORE[0][1], DELTAS[0][1])
  File "./x", line 1035, in ShowStats
    colourise(cpuload[4], "%6.2f",     2,  5, 10, False),
IndexError: list index out of range

so you probably need:

    elif a1 == "x":
      STATS_CPU_MEM = True
      STATS_UTILISATION = True
      SIMPLE_UTILISATION = False
    elif a1 == "X":
      STATS_CPU_MEM = False
      STATS_UTILISATION = False

    elif a1 == "r":
      STATS_CPU_MEM = True
      SIMPLE_UTILISATION = True
      STATS_UTILISATION = False
    elif a1 == "R":
      STATS_CPU_MEM = False
      SIMPLE_UTILISATION = False

so that r overrides x (and vice versa).

Thanks for this btw. :)

MilhouseVH commented 6 years ago

Thanks