Auto merge of #13545 - epage:trace, r=weihanglo

fix(cli): Add traces to clarify where time is going

In looking at the traces, I had a couple of questions of where the time is going, like
- Why does writing a package file take so long
- How much of manifest parsing is TOML parsing vs target discovery vs other stuff

This adds traces to help answer those.
This commit is contained in:
bors 2024-03-06 03:06:41 +00:00
commit b1b52aafe6
5 changed files with 8 additions and 0 deletions

View File

@ -637,6 +637,7 @@ impl<'de> de::Deserialize<'de> for EncodablePackageId {
}
impl ser::Serialize for Resolve {
#[tracing::instrument(skip_all)]
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where
S: ser::Serializer,

View File

@ -31,6 +31,7 @@ struct Inner {
}
impl Summary {
#[tracing::instrument(skip_all)]
pub fn new(
pkg_id: PackageId,
dependencies: Vec<Dependency>,

View File

@ -112,6 +112,7 @@ fn resolve_to_string_orig(
(orig.ok(), out, lock_root)
}
#[tracing::instrument(skip_all)]
fn serialize_resolve(resolve: &Resolve, orig: Option<&str>) -> String {
let toml = toml::Table::try_from(resolve).unwrap();
@ -194,6 +195,7 @@ fn serialize_resolve(resolve: &Resolve, orig: Option<&str>) -> String {
out
}
#[tracing::instrument(skip_all)]
fn are_equal_lockfiles(orig: &str, current: &str, ws: &Workspace<'_>) -> bool {
// If we want to try and avoid updating the lock file, parse both and
// compare them; since this is somewhat expensive, don't do it in the

View File

@ -424,6 +424,7 @@ pub fn prepare_for_publish(
}
}
#[tracing::instrument(skip_all)]
pub fn to_real_manifest(
me: manifest::TomlManifest,
embedded: bool,
@ -723,6 +724,7 @@ pub fn to_real_manifest(
root: package_root,
};
#[tracing::instrument(skip(manifest_ctx, new_deps, workspace_config, inherit_cell))]
fn process_dependencies(
manifest_ctx: &mut ManifestContext<'_, '_>,
new_deps: Option<&BTreeMap<manifest::PackageName, manifest::InheritableDependency>>,
@ -1531,6 +1533,7 @@ fn default_readme_from_package_root(package_root: &Path) -> Option<String> {
/// Checks a list of build targets, and ensures the target names are unique within a vector.
/// If not, the name of the offending build target is returned.
#[tracing::instrument(skip_all)]
fn unique_build_targets(
targets: &[Target],
package_root: &Path,

View File

@ -32,6 +32,7 @@ const DEFAULT_BENCH_DIR_NAME: &'static str = "benches";
const DEFAULT_EXAMPLE_DIR_NAME: &'static str = "examples";
const DEFAULT_BIN_DIR_NAME: &'static str = "bin";
#[tracing::instrument(skip_all)]
pub(super) fn targets(
features: &Features,
manifest: &TomlManifest,