Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rtic_f4xx_nucleo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Edvin Åkerfeldt
rtic_f4xx_nucleo
Commits
1b6e208d
Commit
1b6e208d
authored
Dec 2, 2020
by
Edvin Åkerfeldt
Browse files
Options
Downloads
Patches
Plain Diff
rtt_timing, B done
parent
2727ac01
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/rtt_timing.rs
+24
-0
24 additions, 0 deletions
examples/rtt_timing.rs
with
24 additions
and
0 deletions
examples/rtt_timing.rs
+
24
−
0
View file @
1b6e208d
...
@@ -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).
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment