diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2023-04-23 14:33:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-23 14:33:56 +0200 |
| commit | 561ff979d574f496415c0499345d41da2e1f6e1e (patch) | |
| tree | 037479ac000bd87a1cb2149e5389b28f08d24051 /library/src | |
| parent | 2fbb14f712708188649181525813b3ac5a02e0fb (diff) | |
Add instrumentation (Part 1) (#761)
Diffstat (limited to 'library/src')
49 files changed, 114 insertions, 2 deletions
diff --git a/library/src/layout/align.rs b/library/src/layout/align.rs index c2f8262e..b8f7a086 100644 --- a/library/src/layout/align.rs +++ b/library/src/layout/align.rs @@ -58,6 +58,7 @@ pub struct AlignElem { } impl Show for AlignElem { + #[tracing::instrument(name = "AlignElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { Ok(self .body() diff --git a/library/src/layout/columns.rs b/library/src/layout/columns.rs index 3a1b012a..2a587907 100644 --- a/library/src/layout/columns.rs +++ b/library/src/layout/columns.rs @@ -50,6 +50,7 @@ pub struct ColumnsElem { } impl Layout for ColumnsElem { + #[tracing::instrument(name = "ColumnsElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs index 9bf1bf87..ae6a094c 100644 --- a/library/src/layout/container.rs +++ b/library/src/layout/container.rs @@ -99,6 +99,7 @@ pub struct BoxElem { } impl Layout for BoxElem { + #[tracing::instrument(name = "BoxElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -326,6 +327,7 @@ pub struct BlockElem { } impl Layout for BlockElem { + #[tracing::instrument(name = "BlockElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs index ce65b14c..76942c27 100644 --- a/library/src/layout/enum.rs +++ b/library/src/layout/enum.rs @@ -154,6 +154,7 @@ pub struct EnumElem { } impl Layout for EnumElem { + #[tracing::instrument(name = "EnumElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs index b45c39c2..64d1d509 100644 --- a/library/src/layout/flow.rs +++ b/library/src/layout/flow.rs @@ -19,6 +19,7 @@ pub struct FlowElem { } impl Layout for FlowElem { + #[tracing::instrument(name = "FlowElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -122,6 +123,7 @@ impl<'a> FlowLayouter<'a> { } /// Layout vertical spacing. + #[tracing::instrument(name = "FlowLayouter::layout_spacing", skip_all)] fn layout_spacing(&mut self, v: &VElem, styles: StyleChain) { self.layout_item(match v.amount() { Spacing::Rel(rel) => FlowItem::Absolute( @@ -133,6 +135,7 @@ impl<'a> FlowLayouter<'a> { } /// Layout a paragraph. + #[tracing::instrument(name = "FlowLayouter::layout_par", skip_all)] fn layout_par( &mut self, vt: &mut Vt, @@ -179,6 +182,7 @@ impl<'a> FlowLayouter<'a> { } /// Layout into a single region. + #[tracing::instrument(name = "FlowLayouter::layout_single", skip_all)] fn layout_single( &mut self, vt: &mut Vt, @@ -237,6 +241,7 @@ impl<'a> FlowLayouter<'a> { } /// Layout a finished frame. + #[tracing::instrument(name = "FlowLayouter::layout_item", skip_all)] fn layout_item(&mut self, item: FlowItem) { match item { FlowItem::Absolute(v, _) => self.regions.size.y -= v, diff --git a/library/src/layout/grid.rs b/library/src/layout/grid.rs index 01bf7e30..63183e1d 100644 --- a/library/src/layout/grid.rs +++ b/library/src/layout/grid.rs @@ -102,6 +102,7 @@ pub struct GridElem { } impl Layout for GridElem { + #[tracing::instrument(name = "GridElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -289,6 +290,7 @@ impl<'a, 'v> GridLayouter<'a, 'v> { } /// Determines the columns sizes and then layouts the grid row-by-row. + #[tracing::instrument(name = "grid layout", skip(self))] pub fn layout(mut self) -> SourceResult<GridLayout> { self.measure_columns()?; diff --git a/library/src/layout/hide.rs b/library/src/layout/hide.rs index d9bee317..a65616a0 100644 --- a/library/src/layout/hide.rs +++ b/library/src/layout/hide.rs @@ -23,6 +23,7 @@ pub struct HideElem { } impl Show for HideElem { + #[tracing::instrument(name = "HideElem::show", skip(self))] fn show(&self, _: &mut Vt, _: StyleChain) -> SourceResult<Content> { Ok(self.body().styled(MetaElem::set_data(vec![Meta::Hide]))) } diff --git a/library/src/layout/list.rs b/library/src/layout/list.rs index 6cb1bc7e..c8aeaa06 100644 --- a/library/src/layout/list.rs +++ b/library/src/layout/list.rs @@ -112,6 +112,7 @@ pub struct ListElem { } impl Layout for ListElem { + #[tracing::instrument(name = "ListElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, 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(()) }; diff --git a/library/src/layout/pad.rs b/library/src/layout/pad.rs index 441aa211..a4e79e36 100644 --- a/library/src/layout/pad.rs +++ b/library/src/layout/pad.rs @@ -60,6 +60,7 @@ pub struct PadElem { } impl Layout for PadElem { + #[tracing::instrument(name = "PadElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs index 0c70282d..7fa0bc5e 100644 --- a/library/src/layout/page.rs +++ b/library/src/layout/page.rs @@ -272,7 +272,10 @@ pub struct PageElem { impl PageElem { /// Layout the page run into a sequence of frames, one per page. + #[tracing::instrument(skip_all)] pub fn layout(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Fragment> { + tracing::info!("Page layout"); + // When one of the lengths is infinite the page fits its content along // that axis. let width = self.width(styles).unwrap_or(Abs::inf()); @@ -330,12 +333,20 @@ impl PageElem { ); // Realize overlays. - for frame in &mut fragment { + for (i, frame) in fragment.iter_mut().enumerate() { + tracing::info!("Layouting page #{i}"); frame.prepend(Point::zero(), numbering_meta.clone()); let size = frame.size(); let pad = padding.resolve(styles).relative_to(size); let pw = size.x - pad.left - pad.right; - for marginal in [&header, &footer, &background, &foreground] { + for (name, marginal) in [ + ("header", &header), + ("footer", &footer), + ("background", &background), + ("foreground", &foreground), + ] { + tracing::info!("Layouting {name}"); + let Some(content) = marginal else { continue }; let (pos, area, align); diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 8bede473..b186bb19 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -126,6 +126,7 @@ impl Construct for ParElem { impl ParElem { /// Layout the paragraph into a collection of lines. + #[tracing::instrument(name = "ParElement::layout", skip_all)] pub fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/place.rs b/library/src/layout/place.rs index 057278df..2a671628 100644 --- a/library/src/layout/place.rs +++ b/library/src/layout/place.rs @@ -54,6 +54,7 @@ pub struct PlaceElem { } impl Layout for PlaceElem { + #[tracing::instrument(name = "PlaceElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/repeat.rs b/library/src/layout/repeat.rs index 4a05500e..384995a4 100644 --- a/library/src/layout/repeat.rs +++ b/library/src/layout/repeat.rs @@ -34,6 +34,7 @@ pub struct RepeatElem { } impl Layout for RepeatElem { + #[tracing::instrument(name = "RepeatElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/stack.rs b/library/src/layout/stack.rs index b1f7f59d..80145567 100644 --- a/library/src/layout/stack.rs +++ b/library/src/layout/stack.rs @@ -38,6 +38,7 @@ pub struct StackElem { } impl Layout for StackElem { + #[tracing::instrument(name = "StackElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -161,6 +162,7 @@ impl<'a> StackLayouter<'a> { } /// Add spacing along the spacing direction. + #[tracing::instrument(name = "StackLayouter::layout_spacing", skip_all)] fn layout_spacing(&mut self, spacing: Spacing) { match spacing { Spacing::Rel(v) => { @@ -184,6 +186,7 @@ impl<'a> StackLayouter<'a> { } /// Layout an arbitrary block. + #[tracing::instrument(name = "StackLayouter::layout_block", skip_all)] fn layout_block( &mut self, vt: &mut Vt, diff --git a/library/src/layout/table.rs b/library/src/layout/table.rs index acababb8..9ca6a137 100644 --- a/library/src/layout/table.rs +++ b/library/src/layout/table.rs @@ -122,6 +122,7 @@ pub struct TableElem { } impl Layout for TableElem { + #[tracing::instrument(name = "TableElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/terms.rs b/library/src/layout/terms.rs index 45ba82b5..ecda7668 100644 --- a/library/src/layout/terms.rs +++ b/library/src/layout/terms.rs @@ -92,6 +92,7 @@ pub struct TermsElem { } impl Layout for TermsElem { + #[tracing::instrument(name = "TermsElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/layout/transform.rs b/library/src/layout/transform.rs index b57ca41e..2fb9c191 100644 --- a/library/src/layout/transform.rs +++ b/library/src/layout/transform.rs @@ -37,6 +37,7 @@ pub struct MoveElem { } impl Layout for MoveElem { + #[tracing::instrument(name = "MoveElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -105,6 +106,7 @@ pub struct RotateElem { } impl Layout for RotateElem { + #[tracing::instrument(name = "RotateElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -173,6 +175,7 @@ pub struct ScaleElem { } impl Layout for ScaleElem { + #[tracing::instrument(name = "ScaleElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/lib.rs b/library/src/lib.rs index 3254dfd8..98ec121a 100644 --- a/library/src/lib.rs +++ b/library/src/lib.rs @@ -29,6 +29,7 @@ pub fn build() -> Library { } /// Construct the module with global definitions. +#[tracing::instrument(skip_all)] fn global(math: Module, calc: Module) -> Module { let mut global = Scope::deduplicating(); diff --git a/library/src/math/accent.rs b/library/src/math/accent.rs index 03263c3c..1cd84429 100644 --- a/library/src/math/accent.rs +++ b/library/src/math/accent.rs @@ -52,6 +52,7 @@ pub struct AccentElem { } impl LayoutMath for AccentElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { ctx.style(ctx.style.with_cramped(true)); let base = ctx.layout_fragment(&self.base())?; diff --git a/library/src/math/align.rs b/library/src/math/align.rs index 03abeac2..bbdda5fd 100644 --- a/library/src/math/align.rs +++ b/library/src/math/align.rs @@ -8,6 +8,7 @@ use super::*; pub struct AlignPointElem {} impl LayoutMath for AlignPointElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { ctx.push(MathFragment::Align); Ok(()) diff --git a/library/src/math/attach.rs b/library/src/math/attach.rs index c90b4945..dcf7fb78 100644 --- a/library/src/math/attach.rs +++ b/library/src/math/attach.rs @@ -27,6 +27,7 @@ pub struct AttachElem { } impl LayoutMath for AttachElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let base = self.base(); let display_limits = base.is::<LimitsElem>(); @@ -83,6 +84,7 @@ pub struct ScriptsElem { } impl LayoutMath for ScriptsElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { self.body().layout_math(ctx) } @@ -105,6 +107,7 @@ pub struct LimitsElem { } impl LayoutMath for LimitsElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { self.body().layout_math(ctx) } diff --git a/library/src/math/delimited.rs b/library/src/math/delimited.rs index fe7d2d1e..3726aa15 100644 --- a/library/src/math/delimited.rs +++ b/library/src/math/delimited.rs @@ -39,6 +39,7 @@ pub struct LrElem { } impl LayoutMath for LrElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let mut body = self.body(); if let Some(elem) = body.to::<LrElem>() { diff --git a/library/src/math/frac.rs b/library/src/math/frac.rs index 7520e10d..f93ee888 100644 --- a/library/src/math/frac.rs +++ b/library/src/math/frac.rs @@ -30,6 +30,7 @@ pub struct FracElem { } impl LayoutMath for FracElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout(ctx, &self.num(), &self.denom(), false, self.span()) } diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index 368cd5c4..2243eb38 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -33,6 +33,7 @@ pub struct VecElem { } impl LayoutMath for VecElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let delim = self.delim(ctx.styles()); let frame = layout_vec_body(ctx, &self.children(), Align::Center)?; @@ -115,6 +116,7 @@ pub struct MatElem { } impl LayoutMath for MatElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let delim = self.delim(ctx.styles()); let frame = layout_mat_body(ctx, &self.rows())?; @@ -161,6 +163,7 @@ pub struct CasesElem { } impl LayoutMath for CasesElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let delim = self.delim(ctx.styles()); let frame = layout_vec_body(ctx, &self.children(), Align::Left)?; diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index 48fe52d2..63bfdbbe 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -173,6 +173,7 @@ impl Synthesize for EquationElem { } impl Show for EquationElem { + #[tracing::instrument(name = "EquationElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { let mut realized = self.clone().pack().guarded(Guard::Base(Self::func())); if self.block(styles) { @@ -193,6 +194,7 @@ impl Finalize for EquationElem { } impl Layout for EquationElem { + #[tracing::instrument(name = "EquationElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -340,12 +342,14 @@ pub trait LayoutMath { } impl LayoutMath for EquationElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { self.body().layout_math(ctx) } } impl LayoutMath for Content { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { // Directly layout the body of nested equations instead of handling it // like a normal equation so that things like this work: diff --git a/library/src/math/op.rs b/library/src/math/op.rs index 5ea4519c..699d326a 100644 --- a/library/src/math/op.rs +++ b/library/src/math/op.rs @@ -34,6 +34,7 @@ pub struct OpElem { } impl LayoutMath for OpElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let fragment = ctx.layout_text(&TextElem::new(self.text()).spanned(self.span()))?; diff --git a/library/src/math/root.rs b/library/src/math/root.rs index cc48cd74..8b272160 100644 --- a/library/src/math/root.rs +++ b/library/src/math/root.rs @@ -39,6 +39,7 @@ pub struct RootElem { } impl LayoutMath for RootElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout(ctx, self.index(ctx.styles()).as_ref(), &self.radicand(), self.span()) } diff --git a/library/src/math/style.rs b/library/src/math/style.rs index 2cd29175..eb6472ee 100644 --- a/library/src/math/style.rs +++ b/library/src/math/style.rs @@ -199,6 +199,7 @@ pub struct MathStyleElem { } impl LayoutMath for MathStyleElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { let mut style = ctx.style; if let Some(variant) = self.variant(StyleChain::default()) { diff --git a/library/src/math/underover.rs b/library/src/math/underover.rs index a8d7b71c..5282c6dc 100644 --- a/library/src/math/underover.rs +++ b/library/src/math/underover.rs @@ -21,6 +21,7 @@ pub struct UnderlineElem { } impl LayoutMath for UnderlineElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout(ctx, &self.body(), &None, '\u{305}', LINE_GAP, false, self.span()) } @@ -43,6 +44,7 @@ pub struct OverlineElem { } impl LayoutMath for OverlineElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout(ctx, &self.body(), &None, '\u{332}', LINE_GAP, true, self.span()) } @@ -69,6 +71,7 @@ pub struct UnderbraceElem { } impl LayoutMath for UnderbraceElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout( ctx, @@ -103,6 +106,7 @@ pub struct OverbraceElem { } impl LayoutMath for OverbraceElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout( ctx, @@ -137,6 +141,7 @@ pub struct UnderbracketElem { } impl LayoutMath for UnderbracketElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout( ctx, @@ -171,6 +176,7 @@ pub struct OverbracketElem { } impl LayoutMath for OverbracketElem { + #[tracing::instrument(skip(ctx))] fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { layout( ctx, diff --git a/library/src/meta/bibliography.rs b/library/src/meta/bibliography.rs index 2f9a099e..f35264af 100644 --- a/library/src/meta/bibliography.rs +++ b/library/src/meta/bibliography.rs @@ -140,6 +140,7 @@ impl Synthesize for BibliographyElem { } impl Show for BibliographyElem { + #[tracing::instrument(name = "BibliographyElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { const COLUMN_GUTTER: Em = Em::new(0.65); const INDENT: Em = Em::new(1.5); @@ -336,6 +337,7 @@ impl Synthesize for CiteElem { } impl Show for CiteElem { + #[tracing::instrument(name = "CiteElem::show", skip(self, vt))] fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> { if !vt.introspector.init() { return Ok(Content::empty()); diff --git a/library/src/meta/context.rs b/library/src/meta/context.rs index 710347f4..7bc57e97 100644 --- a/library/src/meta/context.rs +++ b/library/src/meta/context.rs @@ -72,6 +72,7 @@ struct LocateElem { } impl Show for LocateElem { + #[tracing::instrument(name = "LocateElem::show", skip(self, vt))] fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> { if !vt.introspector.init() { return Ok(Content::empty()); @@ -127,6 +128,7 @@ struct StyleElem { } impl Show for StyleElem { + #[tracing::instrument(name = "StyleElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { Ok(self.func().call_vt(vt, [styles.to_map().into()])?.display()) } @@ -204,6 +206,7 @@ struct LayoutElem { } impl Layout for LayoutElem { + #[tracing::instrument(name = "LayoutElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/meta/counter.rs b/library/src/meta/counter.rs index b1d2e3bd..394c4656 100644 --- a/library/src/meta/counter.rs +++ b/library/src/meta/counter.rs @@ -302,6 +302,7 @@ impl Counter { } /// Call a method on counter. + #[tracing::instrument(skip(vm))] pub fn call_method( self, vm: &mut Vm, @@ -618,6 +619,7 @@ struct DisplayElem { } impl Show for DisplayElem { + #[tracing::instrument(name = "DisplayElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { if !vt.introspector.init() { return Ok(Content::empty()); @@ -669,6 +671,7 @@ struct UpdateElem { } impl Show for UpdateElem { + #[tracing::instrument(name = "UpdateElem::show", skip(self))] fn show(&self, _: &mut Vt, _: StyleChain) -> SourceResult<Content> { Ok(Content::empty()) } diff --git a/library/src/meta/document.rs b/library/src/meta/document.rs index bb42faaf..5319eefa 100644 --- a/library/src/meta/document.rs +++ b/library/src/meta/document.rs @@ -43,7 +43,10 @@ impl Construct for DocumentElem { impl LayoutRoot for DocumentElem { /// Layout the document into a sequence of frames, one per page. + #[tracing::instrument(name = "DocumentElem::layout_root", skip_all)] fn layout_root(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Document> { + tracing::info!("Document layout"); + let mut pages = vec![]; for mut child in &self.children() { diff --git a/library/src/meta/figure.rs b/library/src/meta/figure.rs index 1f1499fc..d86625b7 100644 --- a/library/src/meta/figure.rs +++ b/library/src/meta/figure.rs @@ -237,6 +237,7 @@ impl Synthesize for FigureElem { } impl Show for FigureElem { + #[tracing::instrument(name = "FigureElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { // We build the body of the figure. let mut realized = self.body(); diff --git a/library/src/meta/heading.rs b/library/src/meta/heading.rs index f3d0e337..ad836363 100644 --- a/library/src/meta/heading.rs +++ b/library/src/meta/heading.rs @@ -108,6 +108,7 @@ impl Synthesize for HeadingElem { } impl Show for HeadingElem { + #[tracing::instrument(name = "HeadingElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { let mut realized = self.body(); if let Some(numbering) = self.numbering(styles) { diff --git a/library/src/meta/link.rs b/library/src/meta/link.rs index 135ce0af..aaf2476a 100644 --- a/library/src/meta/link.rs +++ b/library/src/meta/link.rs @@ -88,6 +88,7 @@ impl LinkElem { } impl Show for LinkElem { + #[tracing::instrument(name = "LinkElem::show", skip(self, vt))] fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> { let body = self.body(); let dest = match self.dest() { diff --git a/library/src/meta/outline.rs b/library/src/meta/outline.rs index f65168c7..a5c7a5de 100644 --- a/library/src/meta/outline.rs +++ b/library/src/meta/outline.rs @@ -131,6 +131,7 @@ pub struct OutlineElem { } impl Show for OutlineElem { + #[tracing::instrument(name = "OutlineElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { let mut seq = vec![ParbreakElem::new().pack()]; // Build the outline title. diff --git a/library/src/meta/reference.rs b/library/src/meta/reference.rs index 4e1cfa7f..adbc9f57 100644 --- a/library/src/meta/reference.rs +++ b/library/src/meta/reference.rs @@ -146,6 +146,7 @@ impl Synthesize for RefElem { } impl Show for RefElem { + #[tracing::instrument(name = "RefElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { if !vt.introspector.init() { return Ok(Content::empty()); diff --git a/library/src/meta/state.rs b/library/src/meta/state.rs index 781d4294..dc67e2c4 100644 --- a/library/src/meta/state.rs +++ b/library/src/meta/state.rs @@ -256,6 +256,7 @@ pub struct State { impl State { /// Call a method on a state. + #[tracing::instrument(skip(vm))] pub fn call_method( self, vm: &mut Vm, @@ -280,6 +281,7 @@ impl State { } /// Get the value of the state at the given location. + #[tracing::instrument(skip(self, vt))] pub fn at(self, vt: &mut Vt, location: Location) -> SourceResult<Value> { let sequence = self.sequence(vt)?; let offset = vt @@ -290,6 +292,7 @@ impl State { } /// Get the value of the state at the final location. + #[tracing::instrument(skip(self, vt))] pub fn final_(self, vt: &mut Vt, _: Location) -> SourceResult<Value> { let sequence = self.sequence(vt)?; Ok(sequence.last().unwrap().clone()) @@ -395,6 +398,7 @@ struct DisplayElem { } impl Show for DisplayElem { + #[tracing::instrument(name = "DisplayElem::show", skip(self, vt))] fn show(&self, vt: &mut Vt, _: StyleChain) -> SourceResult<Content> { if !vt.introspector.init() { return Ok(Content::empty()); @@ -425,6 +429,7 @@ struct UpdateElem { } impl Show for UpdateElem { + #[tracing::instrument(name = "UpdateElem::show")] fn show(&self, _: &mut Vt, _: StyleChain) -> SourceResult<Content> { Ok(Content::empty()) } diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs index 7b90b22f..49bd3971 100644 --- a/library/src/text/deco.rs +++ b/library/src/text/deco.rs @@ -66,6 +66,7 @@ pub struct UnderlineElem { } impl Show for UnderlineElem { + #[tracing::instrument(name = "UnderlineElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { Ok(self.body().styled(TextElem::set_deco(Decoration { line: DecoLine::Underline, @@ -145,6 +146,7 @@ pub struct OverlineElem { } impl Show for OverlineElem { + #[tracing::instrument(name = "OverlineElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { Ok(self.body().styled(TextElem::set_deco(Decoration { line: DecoLine::Overline, @@ -209,6 +211,7 @@ pub struct StrikeElem { } impl Show for StrikeElem { + #[tracing::instrument(name = "StrikeElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { Ok(self.body().styled(TextElem::set_deco(Decoration { line: DecoLine::Strikethrough, diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs index a707d130..fa3a99fa 100644 --- a/library/src/text/misc.rs +++ b/library/src/text/misc.rs @@ -105,6 +105,7 @@ pub struct StrongElem { } impl Show for StrongElem { + #[tracing::instrument(name = "StrongElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { Ok(self.body().styled(TextElem::set_delta(Delta(self.delta(styles))))) } @@ -165,6 +166,7 @@ pub struct EmphElem { } impl Show for EmphElem { + #[tracing::instrument(name = "EmphElem::show", skip(self))] fn show(&self, _: &mut Vt, _: StyleChain) -> SourceResult<Content> { Ok(self.body().styled(TextElem::set_emph(Toggle))) } diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs index 6d90bc5b..6cd1fc12 100644 --- a/library/src/text/raw.rs +++ b/library/src/text/raw.rs @@ -129,6 +129,7 @@ impl Synthesize for RawElem { } impl Show for RawElem { + #[tracing::instrument(name = "RawElem::show", skip_all)] fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> { let text = self.text(); let lang = self.lang(styles).as_ref().map(|s| s.to_lowercase()); diff --git a/library/src/text/shift.rs b/library/src/text/shift.rs index 26978b87..4eac5897 100644 --- a/library/src/text/shift.rs +++ b/library/src/text/shift.rs @@ -45,6 +45,7 @@ pub struct SubElem { } impl Show for SubElem { + #[tracing::instrument(name = "SubElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { let body = self.body(); let mut transformed = None; @@ -107,6 +108,7 @@ pub struct SuperElem { } impl Show for SuperElem { + #[tracing::instrument(name = "SuperElem::show", skip_all)] fn show(&self, vt: &mut Vt, styles: StyleChain) -> SourceResult<Content> { let body = self.body(); let mut transformed = None; diff --git a/library/src/visualize/image.rs b/library/src/visualize/image.rs index 86f87931..3d51743a 100644 --- a/library/src/visualize/image.rs +++ b/library/src/visualize/image.rs @@ -52,6 +52,7 @@ pub struct ImageElem { } impl Layout for ImageElem { + #[tracing::instrument(name = "ImageElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs index 362f1a89..0555ddec 100644 --- a/library/src/visualize/line.rs +++ b/library/src/visualize/line.rs @@ -73,6 +73,7 @@ pub struct LineElem { } impl Layout for LineElem { + #[tracing::instrument(name = "LineElem::layout", skip_all)] fn layout( &self, _: &mut Vt, diff --git a/library/src/visualize/path.rs b/library/src/visualize/path.rs index db062093..2ef2bc1a 100644 --- a/library/src/visualize/path.rs +++ b/library/src/visualize/path.rs @@ -60,6 +60,7 @@ pub struct PathElem { } impl Layout for PathElem { + #[tracing::instrument(name = "PathElem::layout", skip_all)] fn layout( &self, _: &mut Vt, diff --git a/library/src/visualize/polygon.rs b/library/src/visualize/polygon.rs index 559ebec3..ee2a6b51 100644 --- a/library/src/visualize/polygon.rs +++ b/library/src/visualize/polygon.rs @@ -49,6 +49,7 @@ pub struct PolygonElem { } impl Layout for PolygonElem { + #[tracing::instrument(name = "PolygonElem::layout", skip_all)] fn layout( &self, _: &mut Vt, diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs index 48c4d7a3..e9697676 100644 --- a/library/src/visualize/shape.rs +++ b/library/src/visualize/shape.rs @@ -154,6 +154,7 @@ pub struct RectElem { } impl Layout for RectElem { + #[tracing::instrument(name = "RectElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -264,6 +265,7 @@ pub struct SquareElem { } impl Layout for SquareElem { + #[tracing::instrument(name = "SquareElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -346,6 +348,7 @@ pub struct EllipseElem { } impl Layout for EllipseElem { + #[tracing::instrument(name = "EllipseElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -453,6 +456,7 @@ pub struct CircleElem { } impl Layout for CircleElem { + #[tracing::instrument(name = "CircleElem::layout", skip_all)] fn layout( &self, vt: &mut Vt, @@ -477,6 +481,7 @@ impl Layout for CircleElem { } /// Layout a shape. +#[tracing::instrument(name = "shape::layout", skip_all)] #[allow(clippy::too_many_arguments)] fn layout( vt: &mut Vt, |
