summaryrefslogtreecommitdiff
path: root/library/src/meta
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/meta
parent2fbb14f712708188649181525813b3ac5a02e0fb (diff)
Add instrumentation (Part 1) (#761)
Diffstat (limited to 'library/src/meta')
-rw-r--r--library/src/meta/bibliography.rs2
-rw-r--r--library/src/meta/context.rs3
-rw-r--r--library/src/meta/counter.rs3
-rw-r--r--library/src/meta/document.rs3
-rw-r--r--library/src/meta/figure.rs1
-rw-r--r--library/src/meta/heading.rs1
-rw-r--r--library/src/meta/link.rs1
-rw-r--r--library/src/meta/outline.rs1
-rw-r--r--library/src/meta/reference.rs1
-rw-r--r--library/src/meta/state.rs5
10 files changed, 21 insertions, 0 deletions
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())
}