Changeset 927
- Timestamp:
- 03/10/08 07:09:44 (16 years ago)
- Files:
-
- trunk/libffado/tests/systemtests/realtimetools.cpp (modified) (2 diffs)
- trunk/libffado/tests/systemtests/realtimetools.h (modified) (1 diff)
- trunk/libffado/tests/systemtests/SConscript (modified) (1 diff)
- trunk/libffado/tests/systemtests/test-isorecv-1.cpp (modified) (3 diffs)
- trunk/libffado/tests/systemtests/test-isoxmit-1.cpp (modified) (2 diffs)
- trunk/libffado/tests/systemtests/test-sysload.cpp (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/tests/systemtests/realtimetools.cpp
r922 r927 30 30 #include <string.h> 31 31 #include <sched.h> 32 33 // needed for clock_nanosleep 34 #ifndef _GNU_SOURCE 35 #define _GNU_SOURCE 36 #endif 37 38 #include <time.h> 32 39 33 40 DECLARE_GLOBAL_DEBUG_MODULE; … … 63 70 return 0; 64 71 } 72 73 void 74 rt_sleep_relative_usecs(uint64_t usecs) { 75 //usleep(usecs); 76 struct timespec ts; 77 ts.tv_sec = usecs / (1000000LL); 78 ts.tv_nsec = (usecs % (1000000LL)) * 1000LL; 79 clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL); 80 } 81 82 void 83 rt_sleep_absolute_usecs(uint64_t wake_at_usec) { 84 struct timespec ts; 85 ts.tv_sec = wake_at_usec / (1000000LL); 86 ts.tv_nsec = (wake_at_usec % (1000000LL)) * 1000LL; 87 clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &ts, NULL); 88 } 89 90 uint64_t rt_gettime_usecs() { 91 struct timespec ts; 92 clock_gettime(CLOCK_REALTIME, &ts); 93 return (uint64_t)(ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL); 94 } 95 trunk/libffado/tests/systemtests/realtimetools.h
r922 r927 24 24 #define __REALTIMETOOLS_H__ 25 25 26 #include <inttypes.h> 27 26 28 int set_realtime_priority(unsigned int prio); 27 29 30 void rt_sleep_relative_usecs(uint64_t usecs); 31 void rt_sleep_absolute_usecs(uint64_t wake_at); 32 uint64_t rt_gettime_usecs(); 33 28 34 #endif trunk/libffado/tests/systemtests/SConscript
r922 r927 43 43 "test-isorecv-1" : ["test-isorecv-1.cpp", "realtimetools.cpp"], 44 44 "test-isoxmit-1" : ["test-isoxmit-1.cpp", "realtimetools.cpp"], 45 "test-sysload" : ["test-sysload.cpp", "realtimetools.cpp"], 45 46 } 46 47 trunk/libffado/tests/systemtests/test-isorecv-1.cpp
r925 r927 43 43 // Program documentation. 44 44 // Program documentation. 45 static char doc[] = "FFADO -- ISO transmit stalltest\n\n";45 static char doc[] = "FFADO -- ISO receive test\n\n"; 46 46 47 47 // A description of the arguments we accept. … … 169 169 arguments.countdown = 10000; 170 170 arguments.printinterval = 100; 171 arguments.rtprio = 0; 171 172 172 173 // Parse our arguments; every option seen by `parse_opt' will … … 222 223 } 223 224 224 debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority ...\n");225 debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority (%d)...\n", arguments.rtprio); 225 226 set_realtime_priority(arguments.rtprio); 226 227 trunk/libffado/tests/systemtests/test-isoxmit-1.cpp
r925 r927 222 222 arguments.countdown = 10000; 223 223 arguments.printinterval = 100; 224 arguments.rtprio = 0; 224 225 225 226 // Parse our arguments; every option seen by `parse_opt' will … … 268 269 raw1394_set_bus_reset_handler(handle, myResetHandler); 269 270 270 debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority ...\n");271 debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority (%d)...\n", arguments.rtprio); 271 272 set_realtime_priority(arguments.rtprio); 273 272 274 int countdown = arguments.countdown; 273 275 debugOutput(DEBUG_LEVEL_INFO, "Starting iterate loop...\n");