Time how long it takes to render HTML

This commit is contained in:
Joshua Nelson 2020-08-16 18:41:13 -04:00
parent d213784887
commit 2934fd0a48
2 changed files with 11 additions and 8 deletions

View File

@ -280,7 +280,9 @@ where
(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.
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();
sess.time("run_global_ctxt", || {
let (krate, render_info, opts) = sess.time("run_global_ctxt", || {
global_ctxt.enter(|tcx| {
run_global_ctxt(
tcx,
@ -468,7 +470,8 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
output_format,
)
})
})
});
(krate, render_info, opts, Lrc::clone(sess))
})
})
}

View File

@ -501,7 +501,7 @@ fn main_options(options: config::Options) -> MainResult {
let crate_name = options.crate_name.clone();
let crate_version = options.crate_version.clone();
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");
@ -524,11 +524,11 @@ fn main_options(options: config::Options) -> MainResult {
let (error_format, edition, debugging_options) = diag_opts;
let diag = core::new_handler(error_format, None, &debugging_options);
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)
}
Some(config::OutputFormat::Json) => {
}),
Some(config::OutputFormat::Json) => sess.time("render json", || {
run_renderer::<json::JsonRenderer>(krate, renderopts, renderinfo, &diag, edition)
}
}),
}
}