Allow to specify profiling data output directory as -Zself-profile argument.
This commit is contained in:
parent
837b72c805
commit
53f1c38734
3 changed files with 27 additions and 8 deletions
|
|
@ -1447,7 +1447,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
"don't interleave execution of lints; allows benchmarking individual lints"),
|
||||
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
|
||||
"inject the given attribute in the crate"),
|
||||
self_profile: bool = (false, parse_bool, [UNTRACKED],
|
||||
self_profile: PgoGenerate = (PgoGenerate::Disabled, parse_pgo_generate, [UNTRACKED],
|
||||
"run the self profiler and output the raw event data"),
|
||||
self_profile_events: Option<Vec<String>> = (None, parse_opt_comma_list, [UNTRACKED],
|
||||
"specifies which kinds of events get recorded by the self profiler"),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::lint;
|
|||
use crate::lint::builtin::BuiltinLintDiagnostics;
|
||||
use crate::middle::allocator::AllocatorKind;
|
||||
use crate::middle::dependency_format;
|
||||
use crate::session::config::OutputType;
|
||||
use crate::session::config::{OutputType, PgoGenerate};
|
||||
use crate::session::search_paths::{PathKind, SearchPath};
|
||||
use crate::util::nodemap::{FxHashMap, FxHashSet};
|
||||
use crate::util::common::{duration_to_secs_str, ErrorReported};
|
||||
|
|
@ -1137,8 +1137,18 @@ fn build_session_(
|
|||
driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
|
||||
) -> Session {
|
||||
let self_profiler =
|
||||
if sopts.debugging_opts.self_profile {
|
||||
let profiler = SelfProfiler::new(&sopts.debugging_opts.self_profile_events);
|
||||
if let PgoGenerate::Enabled(ref d) = sopts.debugging_opts.self_profile {
|
||||
let directory = if let Some(ref directory) = d {
|
||||
directory
|
||||
} else {
|
||||
std::path::Path::new(".")
|
||||
};
|
||||
|
||||
let profiler = SelfProfiler::new(
|
||||
directory,
|
||||
sopts.crate_name.as_ref().map(|s| &s[..]),
|
||||
&sopts.debugging_opts.self_profile_events
|
||||
);
|
||||
match profiler {
|
||||
Ok(profiler) => {
|
||||
crate::ty::query::QueryName::register_with_profiler(&profiler);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue