diff --git a/README.md b/README.md index 95b6d7e63fe2cc81ad34f787a17a12dd8fb43656..869c358507fb7db92fb2cadaf7b05ef3f65c9439 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,22 @@ OPTIONS: -s|--overhead-stats 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: +-a|--amd-rapl + AMD RAPL -p|--perf-list <perf_list> performance counters perf_list is a coma separated list of performance counters. Ex: instructions,cache_misses -l|--list 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 system load -d|--net-dev <net_dev> diff --git a/configure.sh b/configure.sh index 196aaf8a9eac4b58680138b7fe7f94c081ce47a6..3f82c3b17822a60df8e959c4a019ac4aea52c862 100755 --- a/configure.sh +++ b/configure.sh @@ -26,18 +26,19 @@ debug=0 target_hdr=src/sensors.h target_mk=sensors.mk -nonsensor='counters_option|optparse|sensors|util|info_reader' +nonsensor='counters_option|sensors|util' hdr_blacklist=$nonsensor hdr_whitelist='' 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 -- '-i | --include : include sensor, can be called multiple times\n' >&2 printf -- '-l | --list-sensors : list all sensors and exit\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 -- '-a | --all : include all sensors, meant to be used only by the makefile\n' >&2 exit 1 } @@ -134,8 +135,15 @@ detect_caps() { [ $(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 case $1 in --include|-i) diff --git a/makefile b/makefile index 646a01531d8671313342535868e0c683bb4b107a..9d245420f3b6535abd443f5dd342045405dd9ffc 100644 --- a/makefile +++ b/makefile @@ -24,7 +24,7 @@ LDFLAGS = 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 $(CC) $(LDFLAGS) -o $(BIN_DIR)/$(BIN) $(OBJ) $(OBJ_DIR)/$(BIN).o @@ -51,7 +51,7 @@ debug: CFLAGS = $(CPPFLAGS) -DDEBUG -g -Og debug: $(BIN) 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 format: @@ -72,6 +72,6 @@ readme: $(BIN) man: $(BIN) awk -v "usage=$$($(BIN_DIR)/$(BIN) -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 diff --git a/tools/update-readme-usage.sh b/tools/update-readme-usage.sh index ad2f88f9b811b188d42acf22dc8662a88e81f05d..2c1950ec6ad9f5e2681e968b251d80f8c335969d 100755 --- a/tools/update-readme-usage.sh +++ b/tools/update-readme-usage.sh @@ -8,8 +8,24 @@ try() { "$@" || die "cannot $*"; } yell() { echo "$0: $*" >&2; } echo() { printf '%s\n' "$*"; } -usage=$(./bin/mojitos) -[ -n "$usage" ] || die 'empty usage. try to recompile mojitos.' +try ./configure.sh --all +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" ' /^Usage/ { @@ -17,7 +33,11 @@ try awk -v "usage=$usage" ' del = 1 } { - if (del == 1) { + if (del == 1 || del == 2) { + if (match($0, "^```")) { + del++ + } + } else if (del == 3) { if (match($0, "^```")) { del = 0 print $0