Changeset 205f1add in mainline for uspace/app/tester/ipc/starve.c
- Timestamp:
- 2018-08-23T21:14:56Z (7 years ago)
- Children:
- f33c989e
- Parents:
- e2625b1a
- git-author:
- Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
- git-committer:
- Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/ipc/starve.c
re2625b1a r205f1add 29 29 #include <stdio.h> 30 30 #include <stdlib.h> 31 #include < sys/time.h>31 #include <time.h> 32 32 #include <io/console.h> 33 33 #include <async.h> … … 43 43 return "Failed to init connection with console."; 44 44 45 struct time valstart;46 get timeofday(&start, NULL);45 struct timespec start; 46 getuptime(&start); 47 47 48 48 TPRINTF("Intensive computation shall be imagined (for %ds)...\n", DURATION_SECS); 49 49 TPRINTF("Press a key to terminate prematurely...\n"); 50 50 while (true) { 51 struct time valnow;52 get timeofday(&now, NULL);51 struct timespec now; 52 getuptime(&now); 53 53 54 if ( tv_sub_diff(&now, &start) >= DURATION_SECS * 1000000L)54 if (NSEC2SEC(ts_sub_diff(&now, &start)) >= DURATION_SECS) 55 55 break; 56 56 57 57 cons_event_t ev; 58 suseconds_t timeout = 0;58 usec_t timeout = 0; 59 59 bool has_event = console_get_event_timeout(console, &ev, &timeout); 60 60 if (has_event && ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS) {
Note:
See TracChangeset
for help on using the changeset viewer.