-
Notifications
You must be signed in to change notification settings - Fork 246
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
analyze: add scripts for computing pointwise metrics #1074
Conversation
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.
Deduplicate the nearly-identical scripts somehow, otherwise looks good.
d="$(dirname "$f")" | ||
f="$d/${name}_safe_${func}.rs" | ||
cp "$d/$name.rs" "$f" |
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.
These are the only difference between these two scripts--it would be good to just make these conditional and avoid the duplication.
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.
I've updated this to deduplicate the similar scripts.
63ce33e
to
d85b4d0
Compare
ef5fa94
to
08fb475
Compare
In #1074, I had commented out a line to speed up testing, and accidentally left it that way when I merged the branch.
Adds scripts for computing "pointwise success rate" metrics. For each function, we run the static analysis and rewrite that function in isolation, producing a new
.rs
file where that function has been rewritten but all other code remains the same. Then we remove theunsafe
qualifier from the target function and try to compile the code. The "pointwise success rate" is the number of functions on which this procedure succeeds.The main entry point is
c2rust-analyze/scripts/run_pointwise_metrics_lighttpd.sh
(as the name suggests, this is designed to compute the success rate on lighttpd specifically). It uses a few helpers:pointwise_try_build.sh
tries to removeunsafe
and compile the rewritten code for a specific function,pointwise_try_build_unmodified.sh
does the same but on the unmodified, non-rewritten code (used for computing a baseline success rate), andpointwise_metrics.py
tallies up the results and prints overall counts.Current output on lighttpd:
This PR depends on #1073, which implements the
pointwise
rewrite mode inc2rust-analyze
.