projects
/
experiments
/
fps-limit.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5d2f835
)
Make the example code clearer
author
Antonio Ospite <ospite@studenti.unina.it>
Tue, 17 Dec 2013 23:11:57 +0000
(
00:11
+0100)
committer
Antonio Ospite <ospite@studenti.unina.it>
Tue, 17 Dec 2013 23:11:57 +0000
(
00:11
+0100)
fps-limit.c
patch
|
blob
|
history
diff --git
a/fps-limit.c
b/fps-limit.c
index
bccb8a5
..
2c24807
100644
(file)
--- a/
fps-limit.c
+++ b/
fps-limit.c
@@
-28,11
+28,14
@@
int main(void)
fps_limit_init(&stats, FPS);
while (1) {
fps_limit_init(&stats, FPS);
while (1) {
- fps_limit_dbg("Doing some work, max: %d", NSEC_PER_SEC / FPS);
+ fps_limit_dbg("Doing some work, minimum: %dns", NSEC_PER_SEC / FPS);
+
+ /* simulate a shorter workload */
tmp.tv_sec = 0;
tmp.tv_nsec = (NSEC_PER_SEC / FPS) * 2 / 3;
nanosleep(&tmp, NULL);
tmp.tv_sec = 0;
tmp.tv_nsec = (NSEC_PER_SEC / FPS) * 2 / 3;
nanosleep(&tmp, NULL);
+ /* and wait for the delay imposed by the limit */
fps_limit_sleep(&stats);
}
fps_limit_sleep(&stats);
}