From 6489f95ed7386778c10eb6bb7d02433d7c1910b1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 02:13:10 +0000 Subject: [PATCH 1/2] fix(traceAnalyzer): accept --popularityDecay, keep --popularityDacay as alias The popularity decay option was registered as --popularityDacay, so the correctly spelled --popularityDecay failed with "unrecognized option" (exit 64), and --help printed the misspelling. Register the option as --popularityDecay and keep the old spelling as a hidden argp alias (OPTION_ALIAS | OPTION_HIDDEN) so existing scripts keep working. Update doc/quickstart_traceAnalyzer.md to use --popularityDecay and drop the note that documented the typo. Add testCLI cases that run both spellings against cloudPhysicsIO.vscsi, check each exits 0 and writes cloudPhysicsIO.vscsi.popularityDecay_w300_obj, and check that --help lists --popularityDecay but not the hidden alias. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015VD7LAJg16jcTU7MAhkm3G --- doc/quickstart_traceAnalyzer.md | 7 ++---- libCacheSim/bin/traceAnalyzer/cli_parser.cpp | 6 ++++- test/test_cli.sh | 26 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/doc/quickstart_traceAnalyzer.md b/doc/quickstart_traceAnalyzer.md index a72e17c32..a6c78ce61 100644 --- a/doc/quickstart_traceAnalyzer.md +++ b/doc/quickstart_traceAnalyzer.md @@ -54,10 +54,7 @@ The basic form is: | `--reuse` | Reuse time and reuse distance distribution, overall and over time | [reuse.py](/scripts/traceAnalysis/reuse.py), [reuse_heatmap.py](/scripts/traceAnalysis/reuse_heatmap.py) | | `--popularity` | Request count of each object, by rank | [popularity.py](/scripts/traceAnalysis/popularity.py) | | `--accessPattern` | A sample of which objects are accessed when | [access_pattern.py](/scripts/traceAnalysis/access_pattern.py) | -| `--popularityDacay` | How an object's popularity fades with age | [popularity_decay.py](/scripts/traceAnalysis/popularity_decay.py) | - -> [!NOTE] -> The popularity decay flag really is spelled `--popularityDacay`. That is a typo in the code. `--popularityDecay` is rejected as an unrecognized option. +| `--popularityDecay` | How an object's popularity fades with age | [popularity_decay.py](/scripts/traceAnalysis/popularity_decay.py) | Run `./bin/traceAnalyzer --help` for the full list of tasks and options. @@ -250,7 +247,7 @@ Pass these two scripts the base name, without the `_req`/`_obj` or `_rt`/`_vt` s This shows how likely an object is to be requested again as it gets older. You need a long trace, around a week, for a useful plot. Most block workloads do not have enough requests. ```bash -./bin/traceAnalyzer --popularityDacay +./bin/traceAnalyzer --popularityDecay python3 ../scripts/traceAnalysis/popularity_decay.py ${dataname}.popularityDecay_w300_obj ``` diff --git a/libCacheSim/bin/traceAnalyzer/cli_parser.cpp b/libCacheSim/bin/traceAnalyzer/cli_parser.cpp index 7251abc92..7fabb1dac 100644 --- a/libCacheSim/bin/traceAnalyzer/cli_parser.cpp +++ b/libCacheSim/bin/traceAnalyzer/cli_parser.cpp @@ -74,11 +74,15 @@ static struct argp_option options[] = { "enable popularity analysis, output freq:cnt in dataname.popularity file, " "and prints the skewness to stdout and stat file", 3}, - {"popularityDacay", OPTION_ENABLE_POPULARITY_DECAY, NULL, + {"popularityDecay", OPTION_ENABLE_POPULARITY_DECAY, NULL, OPTION_ARG_OPTIONAL, "enable popularity decay analysis, this calculates popularity fade as a " "heatmap. It is an expensive analysis, enable only when needed.", 3}, + /* misspelled name this option was originally registered under, kept so + * existing scripts do not break; hidden from --help */ + {"popularityDacay", OPTION_ENABLE_POPULARITY_DECAY, NULL, + OPTION_ALIAS | OPTION_HIDDEN, NULL, 0}, {"reuse", OPTION_ENABLE_REUSE, NULL, OPTION_ARG_OPTIONAL, "reuse analysis, output a reuse distribution (both real time and virtual " "time) in dataname.reuse file", diff --git a/test/test_cli.sh b/test/test_cli.sh index e938c0ef6..0bb125834 100755 --- a/test/test_cli.sh +++ b/test/test_cli.sh @@ -542,6 +542,32 @@ if [[ -x "${BIN_DIR}/traceAnalyzer" ]]; then "${BIN_DIR}/traceAnalyzer" --common -o out-common "${TRACE}" vscsi expect_ok "traceAnalyzer --num-req" \ "${BIN_DIR}/traceAnalyzer" --num-req=10000 -o out-nreq "${TRACE}" vscsi + + # The option was registered as --popularityDacay, so the documented + # --popularityDecay was rejected as unrecognized. The correct spelling must + # run the analysis and write its data file; the old spelling stays as a + # hidden alias for existing scripts. Each writes into its own directory so + # the output file check cannot be satisfied by the other run. + _trace_name=$(basename "${TRACE}") + for _spelling in popularityDecay popularityDacay; do + mkdir -p "pd-${_spelling}" + expect_ok "traceAnalyzer --${_spelling}" \ + "${BIN_DIR}/traceAnalyzer" "${TRACE}" vscsi "--${_spelling}" \ + -o "pd-${_spelling}/${_trace_name}" + if [[ -s "pd-${_spelling}/${_trace_name}.popularityDecay_w300_obj" ]]; then + _report 0 "" + else + _report 1 "traceAnalyzer --${_spelling} did not write ${_trace_name}.popularityDecay_w300_obj" + fi + done + # [-] keeps grep from reading a pattern that starts with -- as an option + expect_output "traceAnalyzer --help lists --popularityDecay" \ + "[-]-popularityDecay" "${BIN_DIR}/traceAnalyzer" --help + if "${BIN_DIR}/traceAnalyzer" --help 2>&1 | grep -q "popularityDacay"; then + _report 1 "traceAnalyzer --help shows the hidden --popularityDacay alias" + else + _report 0 "" + fi fi if [[ -x "${BIN_DIR}/mrcProfiler" ]]; then From b8431f99028abb7f2385d2096e6539f968d8d789 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 03:47:56 +0000 Subject: [PATCH 2/2] fix(traceAnalyzer): drop the --popularityDacay alias Only the correct spelling, --popularityDecay, is accepted now; the misspelled --popularityDacay is rejected as an unrecognized option. testCLI now covers just --popularityDecay and its --help entry. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015VD7LAJg16jcTU7MAhkm3G --- libCacheSim/bin/traceAnalyzer/cli_parser.cpp | 4 --- test/test_cli.sh | 30 +++++++------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/libCacheSim/bin/traceAnalyzer/cli_parser.cpp b/libCacheSim/bin/traceAnalyzer/cli_parser.cpp index 7fabb1dac..693ecbaa4 100644 --- a/libCacheSim/bin/traceAnalyzer/cli_parser.cpp +++ b/libCacheSim/bin/traceAnalyzer/cli_parser.cpp @@ -79,10 +79,6 @@ static struct argp_option options[] = { "enable popularity decay analysis, this calculates popularity fade as a " "heatmap. It is an expensive analysis, enable only when needed.", 3}, - /* misspelled name this option was originally registered under, kept so - * existing scripts do not break; hidden from --help */ - {"popularityDacay", OPTION_ENABLE_POPULARITY_DECAY, NULL, - OPTION_ALIAS | OPTION_HIDDEN, NULL, 0}, {"reuse", OPTION_ENABLE_REUSE, NULL, OPTION_ARG_OPTIONAL, "reuse analysis, output a reuse distribution (both real time and virtual " "time) in dataname.reuse file", diff --git a/test/test_cli.sh b/test/test_cli.sh index 0bb125834..8ff5d712d 100755 --- a/test/test_cli.sh +++ b/test/test_cli.sh @@ -545,29 +545,21 @@ if [[ -x "${BIN_DIR}/traceAnalyzer" ]]; then # The option was registered as --popularityDacay, so the documented # --popularityDecay was rejected as unrecognized. The correct spelling must - # run the analysis and write its data file; the old spelling stays as a - # hidden alias for existing scripts. Each writes into its own directory so - # the output file check cannot be satisfied by the other run. + # run the analysis and write its data file. It writes into its own + # directory so the output file check cannot be satisfied by another run. _trace_name=$(basename "${TRACE}") - for _spelling in popularityDecay popularityDacay; do - mkdir -p "pd-${_spelling}" - expect_ok "traceAnalyzer --${_spelling}" \ - "${BIN_DIR}/traceAnalyzer" "${TRACE}" vscsi "--${_spelling}" \ - -o "pd-${_spelling}/${_trace_name}" - if [[ -s "pd-${_spelling}/${_trace_name}.popularityDecay_w300_obj" ]]; then - _report 0 "" - else - _report 1 "traceAnalyzer --${_spelling} did not write ${_trace_name}.popularityDecay_w300_obj" - fi - done + mkdir -p pd-out + expect_ok "traceAnalyzer --popularityDecay" \ + "${BIN_DIR}/traceAnalyzer" "${TRACE}" vscsi --popularityDecay \ + -o "pd-out/${_trace_name}" + if [[ -s "pd-out/${_trace_name}.popularityDecay_w300_obj" ]]; then + _report 0 "" + else + _report 1 "traceAnalyzer --popularityDecay did not write ${_trace_name}.popularityDecay_w300_obj" + fi # [-] keeps grep from reading a pattern that starts with -- as an option expect_output "traceAnalyzer --help lists --popularityDecay" \ "[-]-popularityDecay" "${BIN_DIR}/traceAnalyzer" --help - if "${BIN_DIR}/traceAnalyzer" --help 2>&1 | grep -q "popularityDacay"; then - _report 1 "traceAnalyzer --help shows the hidden --popularityDacay alias" - else - _report 0 "" - fi fi if [[ -x "${BIN_DIR}/mrcProfiler" ]]; then