slige/surveys/flame_graph/README.md

41 lines
629 B
Markdown
Raw Normal View History

2024-11-21 15:16:30 +00:00
# Flame graph survey
Look at the following code.
```rs
fn add(a, b) {
+ a b
}
2024-11-22 08:25:03 +00:00
fn main() {
let result = 0;
let i = 0;
loop {
if >= i 10 {
break;
}
result = add(result, 5);
i = + i 1;
2024-11-21 15:16:30 +00:00
}
}
```
Imagine you were to run the code.
```
slige --run program.slg
```
What percantage distribution of the total execution time is spent in `main` and in `add`? Remember that all time spent in `add` is also time spent in `main`.
Examples:
Total program | Inside `main` | Inside `add`
---|---|---
100% | 80% | 40%
100% | 90% | 10%
100% | 96% | 70%
Note down the guesses.