Skip to content
Snippets Groups Projects
Commit 4691e8d7 authored by ghuter's avatar ghuter
Browse files

the README.md file now present all sensors

- add `--all` option to configure.sh
- makefile: readme is no longer a "all" dependency
- plus some minor changes
parent 290c3cfe
Branches
Tags
3 merge requests!9fix sensor example (doc),!4Amd, Tests, Doc, CI/CD,!3Amd, tests, doc...
...@@ -21,13 +21,22 @@ OPTIONS: ...@@ -21,13 +21,22 @@ OPTIONS:
-s|--overhead-stats -s|--overhead-stats
enable overhead statistics (nanoseconds). enable overhead statistics (nanoseconds).
```
The following is an exhaustive list of all the sensors (it is very likely
that one will not have all the sensors activated in his build):
```bash
SENSORS: SENSORS:
-a|--amd-rapl
AMD RAPL
-p|--perf-list <perf_list> -p|--perf-list <perf_list>
performance counters performance counters
perf_list is a coma separated list of performance counters. perf_list is a coma separated list of performance counters.
Ex: instructions,cache_misses Ex: instructions,cache_misses
-l|--list -l|--list
list the available performance counters and quit list the available performance counters and quit
-i|--monitor-infiniband <infiniband_path>
infiniband monitoring (if infiniband_path is X, tries to detect it automatically)
-u|--sysload -u|--sysload
system load system load
-d|--net-dev <net_dev> -d|--net-dev <net_dev>
......
...@@ -26,18 +26,19 @@ debug=0 ...@@ -26,18 +26,19 @@ debug=0
target_hdr=src/sensors.h target_hdr=src/sensors.h
target_mk=sensors.mk target_mk=sensors.mk
nonsensor='counters_option|optparse|sensors|util|info_reader' nonsensor='counters_option|sensors|util'
hdr_blacklist=$nonsensor hdr_blacklist=$nonsensor
hdr_whitelist='' hdr_whitelist=''
usage() { usage() {
printf -- 'Usage: %s [-l] [-e <sensor>] [-i <sensor>] [-u <sensor>]\n' "$(basename "$0")" >&2 printf -- 'Usage: %s [-la] [-e <sensor>] [-i <sensor>] [-u <sensor>]\n' "$(basename "$0")" >&2
printf -- '-e | --exclude : exclude sensor, can be called multiple times\n' >&2 printf -- '-e | --exclude : exclude sensor, can be called multiple times\n' >&2
printf -- '-i | --include : include sensor, can be called multiple times\n' >&2 printf -- '-i | --include : include sensor, can be called multiple times\n' >&2
printf -- '-l | --list-sensors : list all sensors and exit\n' >&2 printf -- '-l | --list-sensors : list all sensors and exit\n' >&2
printf -- '-u | --unique : only include the specified sensor\n' >&2 printf -- '-u | --unique : only include the specified sensor\n' >&2
printf -- ' if this option is used, any usage of `-e` or `-i` will be ignored\n' >&2 printf -- ' if this option is used, any usage of `-e` or `-i` will be ignored\n' >&2
printf -- '-a | --all : include all sensors, meant to be used only by the makefile\n' >&2
exit 1 exit 1
} }
...@@ -134,8 +135,15 @@ detect_caps() { ...@@ -134,8 +135,15 @@ detect_caps() {
[ $(ls -1 /sys/class/hwmon | wc -l) -gt 0 ] && hdr_whitelist="${hdr_whitelist}|temperature" [ $(ls -1 /sys/class/hwmon | wc -l) -gt 0 ] && hdr_whitelist="${hdr_whitelist}|temperature"
} }
detect_caps case $1 in
--all|-a)
all=1
;;
esac
[ "$all" ] || detect_caps
[ "$all" ] ||
while [ "$1" ]; do while [ "$1" ]; do
case $1 in case $1 in
--include|-i) --include|-i)
......
...@@ -24,7 +24,7 @@ LDFLAGS = ...@@ -24,7 +24,7 @@ LDFLAGS =
ASTYLE = astyle --style=kr -xf -s4 -k3 -n -Z -Q ASTYLE = astyle --style=kr -xf -s4 -k3 -n -Z -Q
all: $(BIN) readme man all: $(BIN) man
$(BIN): $(BIN_DIR) $(OBJ) $(OBJ_DIR)/$(BIN).o $(BIN): $(BIN_DIR) $(OBJ) $(OBJ_DIR)/$(BIN).o
$(CC) $(LDFLAGS) -o $(BIN_DIR)/$(BIN) $(OBJ) $(OBJ_DIR)/$(BIN).o $(CC) $(LDFLAGS) -o $(BIN_DIR)/$(BIN) $(OBJ) $(OBJ_DIR)/$(BIN).o
...@@ -51,7 +51,7 @@ debug: CFLAGS = $(CPPFLAGS) -DDEBUG -g -Og ...@@ -51,7 +51,7 @@ debug: CFLAGS = $(CPPFLAGS) -DDEBUG -g -Og
debug: $(BIN) debug: $(BIN)
tests: tests:
gcc $(CPPFLAGS) $(TESTS_DIR)/main.c $(SRC_DIR)/util.c -o $(TESTS_DIR)/run $(CC) $(CPPFLAGS) $(TESTS_DIR)/main.c $(SRC_DIR)/util.c -o $(TESTS_DIR)/run
$(TESTS_DIR)/run $(TESTS_DIR)/run
format: format:
...@@ -72,6 +72,6 @@ readme: $(BIN) ...@@ -72,6 +72,6 @@ readme: $(BIN)
man: $(BIN) man: $(BIN)
awk -v "usage=$$($(BIN_DIR)/$(BIN) -1)" \ awk -v "usage=$$($(BIN_DIR)/$(BIN) -1)" \
'/^USAGE/ { $$0=usage } 1' \ '/^USAGE/ { $$0=usage } 1' \
doc/mojitos.pre.1 > doc/mojitos.1 2>/dev/null doc/$(BIN).pre.1 > doc/$(BIN).1 2>/dev/null
.PHONY: all clean mojitos debug format tests readme man .PHONY: all clean mojitos debug format tests readme man
...@@ -8,8 +8,24 @@ try() { "$@" || die "cannot $*"; } ...@@ -8,8 +8,24 @@ try() { "$@" || die "cannot $*"; }
yell() { echo "$0: $*" >&2; } yell() { echo "$0: $*" >&2; }
echo() { printf '%s\n' "$*"; } echo() { printf '%s\n' "$*"; }
usage=$(./bin/mojitos) try ./configure.sh --all
[ -n "$usage" ] || die 'empty usage. try to recompile mojitos.' try make mojitos
usage=$(
./bin/mojitos |
awk '
/^SENSORS/ {
$0 = ""
printf "```\n"
printf "\n"
printf "The following is an exhaustive list of all the sensors (it is very likely\n"
printf "that one will not have all the sensors activated in his build):\n"
printf "```bash\n"
printf "SENSORS:"
}
{ print }
'
)
[ -n "$usage" ] || die 'empty usage. cannot continue.'
try awk -v "usage=$usage" ' try awk -v "usage=$usage" '
/^Usage/ { /^Usage/ {
...@@ -17,7 +33,11 @@ try awk -v "usage=$usage" ' ...@@ -17,7 +33,11 @@ try awk -v "usage=$usage" '
del = 1 del = 1
} }
{ {
if (del == 1) { if (del == 1 || del == 2) {
if (match($0, "^```")) {
del++
}
} else if (del == 3) {
if (match($0, "^```")) { if (match($0, "^```")) {
del = 0 del = 0
print $0 print $0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment