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
Niklas Lundberg
rtic_f4xx_nucleo
Commits
50dbe97e
Commit
50dbe97e
authored
4 years ago
by
Blinningjr
Browse files
Options
Downloads
Patches
Plain Diff
Fixed my answere for question 2 in timing_exam
parent
df457cd3
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/timing_exam.rs
+12
-5
12 additions, 5 deletions
examples/timing_exam.rs
with
12 additions
and
5 deletions
examples/timing_exam.rs
+
12
−
5
View file @
50dbe97e
...
...
@@ -176,8 +176,11 @@ const APP: () = {
// `cx.schedule.t1(cx.scheduled + 100_000.cycles()).unwrap();`
//
// [Your answer here]
// Instant::now() may have drift/jitter, meaning that it is not completely accurate.
// cx.scheduled has zero drift/jitter, thus it is accurate.
// The main difference is that `Instant::now()` returns the current time in cycles and
// `cx.scheduled` returns the time the task is scheduled for in cycles.
//
// Another difference is that `Instant::now()` may have drift/jitter, meaning that it is not completely accurate.
// `cx.scheduled` has zero drift/jitter, thus it is accurate.
//
//
// Source: https://rtic.rs/0.5/book/en/by-example/timer-queue.html
...
...
@@ -187,9 +190,13 @@ const APP: () = {
// in order to generate a periodic task.
//
// [Your answer here]
// If we would use Instant::now() the timing of the periodic tasks would be a little inaccurate
// because Instant::now() has a little drift/jitter. cx.scheduled has zero drift/jitter and thus
// will have accurate timing of the periodic tasks.
// The main reason is that `Instant::now()` returns the current time which will not be equal to the
// start time of the task if the task is preempted by other tasks. But `cx.scheduled` returns the
// scheduled time of the task thus it will always return the correct value, even if the task is
// preempted.
//
// Another reason is that `Instant:now()` has some drift/jitter which causes the timing of the periods to be inaccurate.
// But `cx.scheduled` has zero drift/jitter, thus making it better.
//
//
// Hint, look at https://rtic.rs/0.5/book/en/by-example/timer-queue.html
...
...
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