Skip to content

Commit

Permalink
flame: fix folded formatting (#2710)
Browse files Browse the repository at this point in the history
## Motivation

The `.folded` format expects a `;`-separated list of the stack function,
optionally followed up by a sample count.

The implementation before this commit added a blank space after each `;`
which made parsers, such as `inferno-flamegraph` mis-interpret the data.

Furthermore, normally one wouldn't expect the filename and line-number
in such stack trace.

## Solution

Remove white-space between `;` for the generated file and remove
filename and line-number by default.
  • Loading branch information
conectado authored Sep 5, 2023
1 parent 9a7257d commit bab2e29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tracing-flame/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Default for Config {
empty_samples: true,
threads_collapsed: false,
module_path: true,
file_and_line: true,
file_and_line: false,
}
}
}
Expand Down Expand Up @@ -404,7 +404,7 @@ where

if let Some(second) = first.parent() {
for parent in second.scope().from_root() {
stack += "; ";
stack += ";";
write(&mut stack, parent, &self.config)
.expect("expected: write to String never fails");
}
Expand Down Expand Up @@ -446,7 +446,7 @@ where
}

for parent in first.scope().from_root() {
stack += "; ";
stack += ";";
expect!(
write(&mut stack, parent, &self.config),
"expected: write to String never fails"
Expand Down

0 comments on commit bab2e29

Please sign in to comment.