slige/surveys/flame_graph/README.md
2024-11-22 09:25:18 +01:00

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.