mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 18:16:31 +00:00
629 B
629 B
Flame graph survey
Look at the following code.
fn add(a, b) {
+ a b
}
fn main() {
let result = 0;
let i = 0;
loop {
if >= i 10 {
break;
}
result = add(result, 5);
i = + i 1;
}
}
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.