Skip to content
Snippets Groups Projects
Commit 1b6e208d authored by Edvin Åkerfeldt's avatar Edvin Åkerfeldt
Browse files

rtt_timing, B done

parent 2727ac01
No related branches found
No related tags found
No related merge requests found
...@@ -98,18 +98,42 @@ Because we need to acount for the fact that the counter might have wrapped aroun ...@@ -98,18 +98,42 @@ Because we need to acount for the fact that the counter might have wrapped aroun
// > cargo run --example rtt_timing --release // > cargo run --example rtt_timing --release
// //
// [Your answer here] // [Your answer here]
/*
70001 cycles
*/
// //
// B.2) How many cycles per iteration? // B.2) How many cycles per iteration?
// //
// [Your answer here] // [Your answer here]
/*
Only running timng for the content of the for loop:
let mut start: u32 = 0;
let mut end: u32 = 0;
for _ in 0..10000 {
start = DWT::get_cycle_count();
asm::nop();
end = DWT::get_cycle_count()
}
You get 6 cycles.
But the total number of cycles divided by the loop iterations is 7,0001 ~= 7 cycles.
*/
// //
// What is the speedup (A/B)? // What is the speedup (A/B)?
// //
// [Your answer here] // [Your answer here]
/*
A/B = 4790151/70001 = 68,429751 ~= 68
We get a speedup of about 68.
*/
// //
// Why do you think it differs that much? // Why do you think it differs that much?
// //
// [Your answer here] // [Your answer here]
/*
My guess is that there is a lot of code add in the compilation of the debug version that enables you to debug the code en a meaningfull way.
I.e there is no optimizations, no removal of uneccesary code no nothing.
*/
// //
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// In the loop there is just a single assembly instruction (nop). // In the loop there is just a single assembly instruction (nop).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment