Changeset 927

Show
Ignore:
Timestamp:
03/10/08 07:09:44 (16 years ago)
Author:
ppalmers
Message:

add some new system tests and tools

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/tests/systemtests/realtimetools.cpp

    r922 r927  
    3030#include <string.h> 
    3131#include <sched.h> 
     32 
     33// needed for clock_nanosleep 
     34#ifndef _GNU_SOURCE 
     35    #define _GNU_SOURCE 
     36#endif 
     37 
     38#include <time.h> 
    3239 
    3340DECLARE_GLOBAL_DEBUG_MODULE; 
     
    6370  return 0; 
    6471} 
     72 
     73void 
     74rt_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 
     82void 
     83rt_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 
     90uint64_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  
    2424#define __REALTIMETOOLS_H__ 
    2525 
     26#include <inttypes.h> 
     27 
    2628int set_realtime_priority(unsigned int prio); 
    2729 
     30void rt_sleep_relative_usecs(uint64_t usecs); 
     31void rt_sleep_absolute_usecs(uint64_t wake_at); 
     32uint64_t rt_gettime_usecs(); 
     33 
    2834#endif 
  • trunk/libffado/tests/systemtests/SConscript

    r922 r927  
    4343        "test-isorecv-1" : ["test-isorecv-1.cpp", "realtimetools.cpp"], 
    4444        "test-isoxmit-1" : ["test-isoxmit-1.cpp", "realtimetools.cpp"], 
     45        "test-sysload" : ["test-sysload.cpp", "realtimetools.cpp"], 
    4546} 
    4647 
  • trunk/libffado/tests/systemtests/test-isorecv-1.cpp

    r925 r927  
    4343// Program documentation. 
    4444// Program documentation. 
    45 static char doc[] = "FFADO -- ISO transmit stall test\n\n"; 
     45static char doc[] = "FFADO -- ISO receive test\n\n"; 
    4646 
    4747// A description of the arguments we accept. 
     
    169169    arguments.countdown = 10000; 
    170170    arguments.printinterval = 100; 
     171    arguments.rtprio = 0; 
    171172 
    172173    // Parse our arguments; every option seen by `parse_opt' will 
     
    222223    } 
    223224 
    224     debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority...\n"); 
     225    debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority (%d)...\n", arguments.rtprio); 
    225226    set_realtime_priority(arguments.rtprio); 
    226227 
  • trunk/libffado/tests/systemtests/test-isoxmit-1.cpp

    r925 r927  
    222222    arguments.countdown = 10000; 
    223223    arguments.printinterval = 100; 
     224    arguments.rtprio = 0; 
    224225 
    225226    // Parse our arguments; every option seen by `parse_opt' will 
     
    268269    raw1394_set_bus_reset_handler(handle, myResetHandler); 
    269270 
    270     debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority...\n"); 
     271    debugOutput(DEBUG_LEVEL_INFO, "Setting RT priority (%d)...\n", arguments.rtprio); 
    271272    set_realtime_priority(arguments.rtprio); 
     273 
    272274    int countdown = arguments.countdown; 
    273275    debugOutput(DEBUG_LEVEL_INFO, "Starting iterate loop...\n");