Remove -Zperf-stats
.
The included measurements have varied over the years. At one point there were quite a few more, but #49558 deleted a lot that were no longer used. Today there's just four, and it's a motley collection that doesn't seem particularly valuable. I think it has been well and truly subsumed by self-profiling, which collects way more data.
This commit is contained in:
parent
2b603f95a4
commit
aefbb616af
@ -496,10 +496,6 @@ fn run_compiler(
|
||||
linker.link()?
|
||||
}
|
||||
|
||||
if sess.opts.unstable_opts.perf_stats {
|
||||
sess.print_perf_stats();
|
||||
}
|
||||
|
||||
if sess.opts.unstable_opts.print_fuel.is_some() {
|
||||
eprintln!(
|
||||
"Fuel used by {}: {}",
|
||||
|
@ -13,7 +13,6 @@
|
||||
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||
use rustc_middle::ty::GenericArg;
|
||||
use rustc_middle::ty::{self, BoundVar, InferConst, List, Ty, TyCtxt, TypeFlags, TypeVisitableExt};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_index::Idx;
|
||||
@ -43,8 +42,6 @@ pub fn canonicalize_query<V>(
|
||||
where
|
||||
V: TypeFoldable<TyCtxt<'tcx>>,
|
||||
{
|
||||
self.tcx.sess.perf_stats.queries_canonicalized.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
Canonicalizer::canonicalize(value, self, self.tcx, &CanonicalizeAllFreeRegions, query_state)
|
||||
}
|
||||
|
||||
@ -62,8 +59,6 @@ pub fn canonicalize_query_preserving_universes<V>(
|
||||
where
|
||||
V: TypeFoldable<TyCtxt<'tcx>>,
|
||||
{
|
||||
self.tcx.sess.perf_stats.queries_canonicalized.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
Canonicalizer::canonicalize(
|
||||
value,
|
||||
self,
|
||||
@ -138,8 +133,6 @@ pub fn canonicalize_query_keep_static<V>(
|
||||
where
|
||||
V: TypeFoldable<TyCtxt<'tcx>>,
|
||||
{
|
||||
self.tcx.sess.perf_stats.queries_canonicalized.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
Canonicalizer::canonicalize(
|
||||
value,
|
||||
self,
|
||||
|
@ -691,7 +691,6 @@ macro_rules! untracked {
|
||||
untracked!(no_leak_check, true);
|
||||
untracked!(no_parallel_llvm, true);
|
||||
untracked!(parse_only, true);
|
||||
untracked!(perf_stats, true);
|
||||
// `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
|
||||
untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
|
||||
untracked!(print_codegen_stats, true);
|
||||
|
@ -1710,8 +1710,6 @@ pub(crate) fn parse_inlining_threshold(slot: &mut InliningThreshold, v: Option<&
|
||||
"panic strategy for panics in drops"),
|
||||
parse_only: bool = (false, parse_bool, [UNTRACKED],
|
||||
"parse only; do not compile, assemble, or link (default: no)"),
|
||||
perf_stats: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print some performance-related statistics (default: no)"),
|
||||
plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"whether to use the PLT when calling into shared libraries;
|
||||
only has effect for PIC code on systems with ELF binaries
|
||||
|
@ -15,10 +15,8 @@
|
||||
use rustc_data_structures::flock;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||
use rustc_data_structures::jobserver::{self, Client};
|
||||
use rustc_data_structures::profiling::{duration_to_secs_str, SelfProfiler, SelfProfilerRef};
|
||||
use rustc_data_structures::sync::{
|
||||
AtomicU64, AtomicUsize, Lock, Lrc, OneThread, Ordering, Ordering::SeqCst,
|
||||
};
|
||||
use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef};
|
||||
use rustc_data_structures::sync::{AtomicU64, Lock, Lrc, OneThread, Ordering::SeqCst};
|
||||
use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter;
|
||||
use rustc_errors::emitter::{DynEmitter, EmitterWriter, HumanReadableErrorType};
|
||||
use rustc_errors::json::JsonEmitter;
|
||||
@ -46,7 +44,6 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::sync::{atomic::AtomicBool, Arc};
|
||||
use std::time::Duration;
|
||||
|
||||
pub struct OptimizationFuel {
|
||||
/// If `-zfuel=crate=n` is specified, initially set to `n`, otherwise `0`.
|
||||
@ -157,9 +154,6 @@ pub struct Session {
|
||||
/// Used by `-Z self-profile`.
|
||||
pub prof: SelfProfilerRef,
|
||||
|
||||
/// Some measurements that are being gathered during compilation.
|
||||
pub perf_stats: PerfStats,
|
||||
|
||||
/// Data about code being compiled, gathered during compilation.
|
||||
pub code_stats: CodeStats,
|
||||
|
||||
@ -215,17 +209,6 @@ pub struct Session {
|
||||
pub expanded_args: Vec<String>,
|
||||
}
|
||||
|
||||
pub struct PerfStats {
|
||||
/// The accumulated time spent on computing symbol hashes.
|
||||
pub symbol_hash_time: Lock<Duration>,
|
||||
/// Total number of values canonicalized queries constructed.
|
||||
pub queries_canonicalized: AtomicUsize,
|
||||
/// Number of times this query is invoked.
|
||||
pub normalize_generic_arg_after_erasing_regions: AtomicUsize,
|
||||
/// Number of times this query is invoked.
|
||||
pub normalize_projection_ty: AtomicUsize,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum MetadataKind {
|
||||
None,
|
||||
@ -883,25 +866,6 @@ pub fn incr_comp_session_dir_opt(&self) -> Option<cell::Ref<'_, PathBuf>> {
|
||||
self.opts.incremental.as_ref().map(|_| self.incr_comp_session_dir())
|
||||
}
|
||||
|
||||
pub fn print_perf_stats(&self) {
|
||||
eprintln!(
|
||||
"Total time spent computing symbol hashes: {}",
|
||||
duration_to_secs_str(*self.perf_stats.symbol_hash_time.lock())
|
||||
);
|
||||
eprintln!(
|
||||
"Total queries canonicalized: {}",
|
||||
self.perf_stats.queries_canonicalized.load(Ordering::Relaxed)
|
||||
);
|
||||
eprintln!(
|
||||
"normalize_generic_arg_after_erasing_regions: {}",
|
||||
self.perf_stats.normalize_generic_arg_after_erasing_regions.load(Ordering::Relaxed)
|
||||
);
|
||||
eprintln!(
|
||||
"normalize_projection_ty: {}",
|
||||
self.perf_stats.normalize_projection_ty.load(Ordering::Relaxed)
|
||||
);
|
||||
}
|
||||
|
||||
/// We want to know if we're allowed to do an optimization for crate foo from -z fuel=foo=n.
|
||||
/// This expends fuel if applicable, and records fuel if applicable.
|
||||
pub fn consider_optimizing(
|
||||
@ -1515,12 +1479,6 @@ pub fn build_session(
|
||||
io,
|
||||
incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
|
||||
prof,
|
||||
perf_stats: PerfStats {
|
||||
symbol_hash_time: Lock::new(Duration::from_secs(0)),
|
||||
queries_canonicalized: AtomicUsize::new(0),
|
||||
normalize_generic_arg_after_erasing_regions: AtomicUsize::new(0),
|
||||
normalize_projection_ty: AtomicUsize::new(0),
|
||||
},
|
||||
code_stats: Default::default(),
|
||||
optimization_fuel,
|
||||
print_fuel,
|
||||
|
@ -4,7 +4,6 @@
|
||||
use rustc_middle::ty::print::{PrettyPrinter, Print, PrintError, Printer};
|
||||
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::ty::{GenericArg, GenericArgKind};
|
||||
use rustc_middle::util::common::record_time;
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use std::mem::{self, discriminant};
|
||||
@ -101,40 +100,38 @@ fn get_symbol_hash<'tcx>(
|
||||
tcx.with_stable_hashing_context(|mut hcx| {
|
||||
let mut hasher = StableHasher::new();
|
||||
|
||||
record_time(&tcx.sess.perf_stats.symbol_hash_time, || {
|
||||
// the main symbol name is not necessarily unique; hash in the
|
||||
// compiler's internal def-path, guaranteeing each symbol has a
|
||||
// truly unique path
|
||||
tcx.def_path_hash(def_id).hash_stable(&mut hcx, &mut hasher);
|
||||
// the main symbol name is not necessarily unique; hash in the
|
||||
// compiler's internal def-path, guaranteeing each symbol has a
|
||||
// truly unique path
|
||||
tcx.def_path_hash(def_id).hash_stable(&mut hcx, &mut hasher);
|
||||
|
||||
// Include the main item-type. Note that, in this case, the
|
||||
// assertions about `has_param` may not hold, but this item-type
|
||||
// ought to be the same for every reference anyway.
|
||||
assert!(!item_type.has_erasable_regions());
|
||||
hcx.while_hashing_spans(false, |hcx| {
|
||||
item_type.hash_stable(hcx, &mut hasher);
|
||||
// Include the main item-type. Note that, in this case, the
|
||||
// assertions about `has_param` may not hold, but this item-type
|
||||
// ought to be the same for every reference anyway.
|
||||
assert!(!item_type.has_erasable_regions());
|
||||
hcx.while_hashing_spans(false, |hcx| {
|
||||
item_type.hash_stable(hcx, &mut hasher);
|
||||
|
||||
// If this is a function, we hash the signature as well.
|
||||
// This is not *strictly* needed, but it may help in some
|
||||
// situations, see the `run-make/a-b-a-linker-guard` test.
|
||||
if let ty::FnDef(..) = item_type.kind() {
|
||||
item_type.fn_sig(tcx).hash_stable(hcx, &mut hasher);
|
||||
}
|
||||
// If this is a function, we hash the signature as well.
|
||||
// This is not *strictly* needed, but it may help in some
|
||||
// situations, see the `run-make/a-b-a-linker-guard` test.
|
||||
if let ty::FnDef(..) = item_type.kind() {
|
||||
item_type.fn_sig(tcx).hash_stable(hcx, &mut hasher);
|
||||
}
|
||||
|
||||
// also include any type parameters (for generic items)
|
||||
args.hash_stable(hcx, &mut hasher);
|
||||
// also include any type parameters (for generic items)
|
||||
args.hash_stable(hcx, &mut hasher);
|
||||
|
||||
if let Some(instantiating_crate) = instantiating_crate {
|
||||
tcx.def_path_hash(instantiating_crate.as_def_id())
|
||||
.stable_crate_id()
|
||||
.hash_stable(hcx, &mut hasher);
|
||||
}
|
||||
if let Some(instantiating_crate) = instantiating_crate {
|
||||
tcx.def_path_hash(instantiating_crate.as_def_id())
|
||||
.stable_crate_id()
|
||||
.hash_stable(hcx, &mut hasher);
|
||||
}
|
||||
|
||||
// We want to avoid accidental collision between different types of instances.
|
||||
// Especially, `VTableShim`s and `ReifyShim`s may overlap with their original
|
||||
// instances without this.
|
||||
discriminant(&instance.def).hash_stable(hcx, &mut hasher);
|
||||
});
|
||||
// We want to avoid accidental collision between different types of instances.
|
||||
// Especially, `VTableShim`s and `ReifyShim`s may overlap with their original
|
||||
// instances without this.
|
||||
discriminant(&instance.def).hash_stable(hcx, &mut hasher);
|
||||
});
|
||||
|
||||
// 64 bits should be enough to avoid collisions.
|
||||
|
@ -4,18 +4,12 @@
|
||||
use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt, TypeFoldable, TypeVisitableExt};
|
||||
use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
|
||||
use rustc_trait_selection::traits::{Normalized, ObligationCause};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
pub(crate) fn provide(p: &mut Providers) {
|
||||
*p = Providers {
|
||||
try_normalize_generic_arg_after_erasing_regions: |tcx, goal| {
|
||||
debug!("try_normalize_generic_arg_after_erasing_regions(goal={:#?}", goal);
|
||||
|
||||
tcx.sess
|
||||
.perf_stats
|
||||
.normalize_generic_arg_after_erasing_regions
|
||||
.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
try_normalize_after_erasing_regions(tcx, goal)
|
||||
},
|
||||
..*p
|
||||
|
@ -10,7 +10,6 @@
|
||||
use rustc_trait_selection::traits::{
|
||||
self, FulfillmentErrorCode, ObligationCause, SelectionContext,
|
||||
};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
pub(crate) fn provide(p: &mut Providers) {
|
||||
*p = Providers {
|
||||
@ -27,7 +26,6 @@ fn normalize_projection_ty<'tcx>(
|
||||
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
|
||||
debug!("normalize_provider(goal={:#?})", goal);
|
||||
|
||||
tcx.sess.perf_stats.normalize_projection_ty.fetch_add(1, Ordering::Relaxed);
|
||||
tcx.infer_ctxt().enter_canonical_trait_query(
|
||||
&goal,
|
||||
|ocx, ParamEnvAnd { param_env, value: goal }| {
|
||||
@ -78,7 +76,6 @@ fn normalize_weak_ty<'tcx>(
|
||||
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> {
|
||||
debug!("normalize_provider(goal={:#?})", goal);
|
||||
|
||||
tcx.sess.perf_stats.normalize_projection_ty.fetch_add(1, Ordering::Relaxed);
|
||||
tcx.infer_ctxt().enter_canonical_trait_query(
|
||||
&goal,
|
||||
|ocx, ParamEnvAnd { param_env, value: goal }| {
|
||||
|
Loading…
Reference in New Issue
Block a user