-
Notifications
You must be signed in to change notification settings - Fork 85
Refactor traceAnalyzer to improve output handling and add popularity … #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -89,8 +89,76 @@ void traceAnalyzer::TraceAnalyzer::cleanup() { | |||||||||||||||||
| void traceAnalyzer::TraceAnalyzer::run() { | ||||||||||||||||||
| if (has_run_) return; | ||||||||||||||||||
|
|
||||||||||||||||||
| auto dump_outputs = [&]() { | ||||||||||||||||||
| ofstream ofs(output_path_ + ".stat", ios::out | ios::app); | ||||||||||||||||||
| ofs << gen_stat_str() << endl; | ||||||||||||||||||
| ofs.close(); | ||||||||||||||||||
|
Comment on lines
+94
to
+95
|
||||||||||||||||||
| ofs << gen_stat_str() << endl; | |
| ofs.close(); | |
| ofstream legacy_ofs("stat", ios::out | ios::app); | |
| auto stat_str = gen_stat_str(); | |
| ofs << stat_str << endl; | |
| legacy_ofs << stat_str << endl; | |
| ofs.close(); | |
| legacy_ofs.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line adds a trailing comma and space to the output string (e.g., 0(0.0000), 0(0.0000), ). To produce cleaner output, it's better to avoid adding the separator after the last element. A similar issue exists in the loop for track_n_popular_ below, and also in the loops that handle the case when n_req_ > 0.
stat_ss_ << "0(0.0000)" << (i < track_n_hit_ - 1 ? ", " : "");There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,7 @@ | ||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On traces with fewer than 200 distinct objects, Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| function help() { | ||||||||||||||||||||||||
| echo "Usage: $0 <tracepath> <trace_format> [<trace_format_parameters>]" | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
@@ -9,20 +11,33 @@ if [ $# -lt 2 ]; then | |||||||||||||||||||||||
| exit 1; | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| CURR_DIR=$(cd $(dirname $0); pwd) | ||||||||||||||||||||||||
| CURR_DIR=$(cd "$(dirname "$0")"; pwd) | ||||||||||||||||||||||||
| REPO_DIR=$(cd "${CURR_DIR}/.."; pwd) | ||||||||||||||||||||||||
| TRACE_ANALYZER="${REPO_DIR}/_build/bin/traceAnalyzer" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if [ ! -x "${TRACE_ANALYZER}" ]; then | ||||||||||||||||||||||||
| echo "traceAnalyzer binary not found at ${TRACE_ANALYZER}; build the project first" >&2 | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| tracepath=$1 | ||||||||||||||||||||||||
| trace_format=$2 | ||||||||||||||||||||||||
| trace_format_parameters=${@:3} | ||||||||||||||||||||||||
| shift 2 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| analyzer_args=("${tracepath}" "${trace_format}" "--common") | ||||||||||||||||||||||||
| if [ $# -gt 0 ]; then | ||||||||||||||||||||||||
| analyzer_args+=("--trace-type-params" "$*") | ||||||||||||||||||||||||
|
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This now rewrites every argument after Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+29
to
31
|
||||||||||||||||||||||||
| analyzer_args+=("--trace-type-params" "$*") | |
| fi | |
| # Treat the third positional argument as trace-type parameters | |
| analyzer_args+=("--trace-type-params" "$1") | |
| shift 1 | |
| fi | |
| # Forward any remaining arguments verbatim to traceAnalyzer | |
| if [ $# -gt 0 ]; then | |
| analyzer_args+=("$@") | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
mainfunction already writes the summary statistics (fromgen_stat_str()) to a.traceStatfile and to standard output. This code block duplicates that by writing the same information to a.statfile. To avoid redundancy and keep output handling centralized inmain, consider removing these lines. Thedump_outputsfunction would then be responsible only for dumping the detailed statistics from the individual analyzer components (likettl_stat_,req_rate_stat_, etc.).