Time how long it takes to render HTML
This commit is contained in:
parent
d213784887
commit
2934fd0a48
@ -280,7 +280,9 @@ where
|
|||||||
(lint_opts, lint_caps)
|
(lint_opts, lint_caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOptions) {
|
pub fn run_core(
|
||||||
|
options: RustdocOptions,
|
||||||
|
) -> (clean::Crate, RenderInfo, RenderOptions, Lrc<Session>) {
|
||||||
// Parse, resolve, and typecheck the given crate.
|
// Parse, resolve, and typecheck the given crate.
|
||||||
|
|
||||||
let RustdocOptions {
|
let RustdocOptions {
|
||||||
@ -457,7 +459,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
|
|
||||||
let mut global_ctxt = abort_on_err(queries.global_ctxt(), sess).take();
|
let mut global_ctxt = abort_on_err(queries.global_ctxt(), sess).take();
|
||||||
|
|
||||||
sess.time("run_global_ctxt", || {
|
let (krate, render_info, opts) = sess.time("run_global_ctxt", || {
|
||||||
global_ctxt.enter(|tcx| {
|
global_ctxt.enter(|tcx| {
|
||||||
run_global_ctxt(
|
run_global_ctxt(
|
||||||
tcx,
|
tcx,
|
||||||
@ -468,7 +470,8 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
output_format,
|
output_format,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
(krate, render_info, opts, Lrc::clone(sess))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ fn main_options(options: config::Options) -> MainResult {
|
|||||||
let crate_name = options.crate_name.clone();
|
let crate_name = options.crate_name.clone();
|
||||||
let crate_version = options.crate_version.clone();
|
let crate_version = options.crate_version.clone();
|
||||||
let output_format = options.output_format;
|
let output_format = options.output_format;
|
||||||
let (mut krate, renderinfo, renderopts) = core::run_core(options);
|
let (mut krate, renderinfo, renderopts, sess) = core::run_core(options);
|
||||||
|
|
||||||
info!("finished with rustc");
|
info!("finished with rustc");
|
||||||
|
|
||||||
@ -524,11 +524,11 @@ fn main_options(options: config::Options) -> MainResult {
|
|||||||
let (error_format, edition, debugging_options) = diag_opts;
|
let (error_format, edition, debugging_options) = diag_opts;
|
||||||
let diag = core::new_handler(error_format, None, &debugging_options);
|
let diag = core::new_handler(error_format, None, &debugging_options);
|
||||||
match output_format {
|
match output_format {
|
||||||
None | Some(config::OutputFormat::Html) => {
|
None | Some(config::OutputFormat::Html) => sess.time("render html", || {
|
||||||
run_renderer::<html::render::Context>(krate, renderopts, renderinfo, &diag, edition)
|
run_renderer::<html::render::Context>(krate, renderopts, renderinfo, &diag, edition)
|
||||||
}
|
}),
|
||||||
Some(config::OutputFormat::Json) => {
|
Some(config::OutputFormat::Json) => sess.time("render json", || {
|
||||||
run_renderer::<json::JsonRenderer>(krate, renderopts, renderinfo, &diag, edition)
|
run_renderer::<json::JsonRenderer>(krate, renderopts, renderinfo, &diag, edition)
|
||||||
}
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user