slige/surveys/flame_graph
2024-11-22 09:47:55 +01:00
..
program_flame_graph.png add surveys 2024-11-21 16:16:44 +01:00
README.md add main 2024-11-22 09:25:18 +01:00
survey.ods add answers 2024-11-22 09:47:55 +01:00

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.