summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-18 14:42:55 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-18 14:42:55 +0200
commit5785c4cea4eb1c4c5b42ed83b29a390e08060f30 (patch)
tree9e329e8db8e69a1f67354a47419ae6da465c5a6b
parenta2188217c7e1ac11c3b6c7f7c1b8ab838765ba67 (diff)
add --help option
-rwxr-xr-xbin/msp430-etv36
1 files changed, 35 insertions, 1 deletions
diff --git a/bin/msp430-etv b/bin/msp430-etv
index 8ed0c4f..b3eb2b6 100755
--- a/bin/msp430-etv
+++ b/bin/msp430-etv
@@ -20,15 +20,49 @@ def measure_data(time):
return res.stdout
+def show_help():
+ print('''msp430-etv - MSP430 EnergyTrace Visualizer
+
+USAGE
+
+msp430-etv [--load <file> | <measurement duration>] [--save <file>]
+ [--skip <count>] [--plot] [--stat]
+
+DESCRIPTION
+
+msp430-etv takes energy measurements from an MSP430 Launchpad or similar device
+using MSP430 EnergyTrace technology. Measurements can be taken directly (by
+specifying <measurement duration> in seconds) or loaded from a logfile using
+--load <file>. Data can be plotted or aggregated on stdout.
+
+OPTIONS
+
+ --load <file>
+ Load data from <file>
+ --save <file>
+ Save measurement data in <file>
+ --skip <count>
+ Skip <count> data samples. This is useful to avoid startup code
+ influencing the results of a long-running measurement
+ --plot
+ Show power/time plot
+ --stat
+ Show mean voltage, current, and power as well as total energy consumption.
+ ''')
+
if __name__ == '__main__':
try:
- optspec = ('load= save= skip= plot stat')
+ optspec = ('help load= save= skip= plot stat')
raw_opts, args = getopt.getopt(sys.argv[1:], "", optspec.split(' '))
for option, parameter in raw_opts:
optname = re.sub(r'^--', '', option)
opt[optname] = parameter
+ if 'help' in opt:
+ show_help()
+ sys.exit(0)
+
if not 'load' in opt:
duration = int(args[0])