107 lines
2.3 KiB
Bash
107 lines
2.3 KiB
Bash
|
#!/bin/bash
|
||
|
# gen_metrics_names.sh: create metrics name arrays suitable for ROM placement
|
||
|
|
||
|
|
||
|
# Configuration:
|
||
|
|
||
|
PACK_CNT=1
|
||
|
PACK_METRICS="\
|
||
|
volt.min volt.max volt.watches volt.alerts volt.stddev.max \
|
||
|
temp.min temp.max temp.watches temp.alerts temp.stddev.max \
|
||
|
c.volt.min c.volt.max c.volt.avg c.volt.stddev \
|
||
|
m.temp.min m.temp.max m.temp.avg m.temp.stddev"
|
||
|
|
||
|
CMOD_CNT=8
|
||
|
CMOD_METRICS="temp.act temp.min temp.max temp.maxdev"
|
||
|
|
||
|
CELL_CNT=16
|
||
|
CELL_METRICS="volt.act volt.min volt.max volt.maxdev"
|
||
|
|
||
|
SPEED_CNT=3
|
||
|
declare -a SPEED_NAMES=("cst" "acc" "dec")
|
||
|
SPEED_METRICS="dist used recd spdavg"
|
||
|
|
||
|
LEVEL_CNT=2
|
||
|
declare -a LEVEL_NAMES=("lup" "ldn")
|
||
|
LEVEL_METRICS="dist used recd hsum"
|
||
|
|
||
|
|
||
|
# Generate battery metrics:
|
||
|
|
||
|
echo
|
||
|
echo '// BEGIN Battery metrics names'
|
||
|
echo '// DO NOT EDIT -- generated by gen_metrics_names.sh'
|
||
|
|
||
|
for f in $PACK_METRICS ; do
|
||
|
fu=${f//\./_}
|
||
|
printf 'const char* const x_rt_b_pack_%s[] = { ' "$fu"
|
||
|
sep=""
|
||
|
for ((i = 0; i < $PACK_CNT; i++)) ; do
|
||
|
ih=$((i + 1))
|
||
|
printf '%s"xrt.b.p.%d.%s"' "$sep" "$ih" "$f"
|
||
|
sep=", "
|
||
|
done
|
||
|
echo ' };'
|
||
|
done
|
||
|
|
||
|
for f in $CMOD_METRICS ; do
|
||
|
fu=${f//\./_}
|
||
|
printf 'const char* const x_rt_b_cmod_%s[] = { ' "$fu"
|
||
|
sep=""
|
||
|
for ((i = 0; i < $CMOD_CNT; i++)) ; do
|
||
|
ih=$((i + 1))
|
||
|
printf '%s"xrt.b.m.%02d.%s"' "$sep" "$ih" "$f"
|
||
|
sep=", "
|
||
|
done
|
||
|
echo ' };'
|
||
|
done
|
||
|
|
||
|
for f in $CELL_METRICS ; do
|
||
|
fu=${f//\./_}
|
||
|
printf 'const char* const x_rt_b_cell_%s[] = { ' "$fu"
|
||
|
sep=""
|
||
|
for ((i = 0; i < $CELL_CNT; i++)) ; do
|
||
|
ih=$((i + 1))
|
||
|
printf '%s"xrt.b.c.%02d.%s"' "$sep" "$ih" "$f"
|
||
|
sep=", "
|
||
|
done
|
||
|
echo ' };'
|
||
|
done
|
||
|
|
||
|
echo '// END Battery metrics names'
|
||
|
echo
|
||
|
|
||
|
|
||
|
# Generate power metrics:
|
||
|
|
||
|
echo
|
||
|
echo '// BEGIN Power metrics names'
|
||
|
echo '// DO NOT EDIT -- generated by gen_metrics_names.sh'
|
||
|
|
||
|
for f in $SPEED_METRICS ; do
|
||
|
fu=${f//\./_}
|
||
|
printf 'const char* const x_rt_p_stats_speed_%s[] = { ' "$fu"
|
||
|
sep=""
|
||
|
for ((i = 0; i < $SPEED_CNT; i++)) ; do
|
||
|
ih=$((i + 1))
|
||
|
printf '%s"xrt.p.stats.%s.%s"' "$sep" "${SPEED_NAMES[$i]}" "$f"
|
||
|
sep=", "
|
||
|
done
|
||
|
echo ' };'
|
||
|
done
|
||
|
|
||
|
for f in $LEVEL_METRICS ; do
|
||
|
fu=${f//\./_}
|
||
|
printf 'const char* const x_rt_p_stats_level_%s[] = { ' "$fu"
|
||
|
sep=""
|
||
|
for ((i = 0; i < $LEVEL_CNT; i++)) ; do
|
||
|
ih=$((i + 1))
|
||
|
printf '%s"xrt.p.stats.%s.%s"' "$sep" "${LEVEL_NAMES[$i]}" "$f"
|
||
|
sep=", "
|
||
|
done
|
||
|
echo ' };'
|
||
|
done
|
||
|
|
||
|
echo '// END Power metrics names'
|
||
|
echo
|