-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add some performance instrumentation to our code #1972
Add some performance instrumentation to our code #1972
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.
Thanks for doing this!
I only had a few minor comments.
@@ -490,3 +503,14 @@ where | |||
serde_json::to_writer(writer, &source).unwrap(); | |||
} | |||
} | |||
|
|||
pub fn with_timer<T, F>(func: F, description: &str) -> T |
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.
Please add documentation
@@ -82,58 +83,66 @@ impl CodegenBackend for GotocCodegenBackend { | |||
check_options(tcx.sess, need_metadata_module); | |||
check_crate_items(&gcx); | |||
|
|||
let items = collect_codegen_items(&gcx); | |||
let items = with_timer(|| collect_codegen_items(&gcx), "reachability analysis"); |
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.
Can we be more specific, e.g. "codegen items reachability analysis"?
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 changed it to be "codegen reachability analysis". Let me know if that's OK.
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.
Sounds good.
@@ -191,6 +203,19 @@ impl KaniSession { | |||
|
|||
Ok(Some(process)) | |||
} | |||
|
|||
pub fn with_timer<T, F>(&self, func: F, description: &str) -> T |
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.
Might be worth creating a "common" or "utils" crate at some point that includes this function (and similar ones) to avoid 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 totally agree. Not sure it's worth it in this PR though
9ca5528
to
2fcd508
Compare
@@ -117,6 +117,9 @@ impl KaniSession { | |||
|
|||
if self.args.debug { | |||
flags.push("--log-level=debug".into()); | |||
} else if self.args.verbose { | |||
// Print the symtab command being invoked. | |||
flags.push("--log-level=info".into()); |
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 was removed in #1730 is the underlying issue fixed there?
Description of changes:
For runs using
--verbose
, Kani will now print the time spent in some parts of the code. This include calls to all CProver utilities and a few other places in the compiler.Resolved issues:
N/A
Related RFC:
Call-outs:
Note that the time measured in
run_cbmc
includes parsing the results. This is similar to the "Verification Time" we print, but it can be misleading when we are usingdebug
mode, since it can more than double the actual time we report to be the verification time. We should probably improve that, but it's out of the scope of this PR. The overhead is also small when running a release build.Testing:
How is this change tested?
Is this a refactor change?
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.