summaryrefslogtreecommitdiff
path: root/library/src/layout/mod.rs
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-04-23 14:33:56 +0200
committerGitHub <noreply@github.com>2023-04-23 14:33:56 +0200
commit561ff979d574f496415c0499345d41da2e1f6e1e (patch)
tree037479ac000bd87a1cb2149e5389b28f08d24051 /library/src/layout/mod.rs
parent2fbb14f712708188649181525813b3ac5a02e0fb (diff)
Add instrumentation (Part 1) (#761)
Diffstat (limited to 'library/src/layout/mod.rs')
-rw-r--r--library/src/layout/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/src/layout/mod.rs b/library/src/layout/mod.rs
index e84e35fc..25014498 100644
--- a/library/src/layout/mod.rs
+++ b/library/src/layout/mod.rs
@@ -68,6 +68,7 @@ pub trait LayoutRoot {
}
impl LayoutRoot for Content {
+ #[tracing::instrument(name = "Content::layout_root", skip_all)]
fn layout_root(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Document> {
#[comemo::memoize]
fn cached(
@@ -87,6 +88,8 @@ impl LayoutRoot for Content {
.layout_root(&mut vt, styles)
}
+ tracing::info!("Starting layout");
+
cached(
self,
vt.world,
@@ -126,6 +129,7 @@ pub trait Layout {
}
impl Layout for Content {
+ #[tracing::instrument(name = "Content::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -151,6 +155,8 @@ impl Layout for Content {
.layout(&mut vt, styles, regions)
}
+ tracing::info!("Layouting `Content`");
+
cached(
self,
vt.world,
@@ -164,6 +170,7 @@ impl Layout for Content {
}
/// Realize into an element that is capable of root-level layout.
+#[tracing::instrument(skip_all)]
fn realize_root<'a>(
vt: &mut Vt,
scratch: &'a Scratch<'a>,
@@ -245,6 +252,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
}
}
+ #[tracing::instrument(skip_all)]
fn accept(
&mut self,
mut content: &'a Content,
@@ -310,6 +318,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
}
}
+ #[tracing::instrument(skip_all)]
fn styled(
&mut self,
elem: &'a Content,
@@ -324,6 +333,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip(self, local, outer))]
fn interrupt_style(
&mut self,
local: &Styles,
@@ -358,6 +368,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip(self))]
fn interrupt_list(&mut self) -> SourceResult<()> {
if !self.list.items.is_empty() {
let staged = mem::take(&mut self.list.staged);
@@ -371,6 +382,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip(self))]
fn interrupt_par(&mut self) -> SourceResult<()> {
self.interrupt_list()?;
if !self.par.0.is_empty() {
@@ -382,6 +394,7 @@ impl<'a, 'v, 't> Builder<'a, 'v, 't> {
Ok(())
}
+ #[tracing::instrument(skip_all)]
fn interrupt_page(&mut self, styles: Option<StyleChain<'a>>) -> SourceResult<()> {
self.interrupt_par()?;
let Some(doc) = &mut self.doc else { return Ok(()) };