Esempio n. 1
0
void call_swallowlll(void)
{
  DEBUGWHERE();
  portalTimerStart(0);
  portalTimerCatch(0);
  portalPerfRequestProxy->swallowlll(vl1, vl2, vl3);
  portalTimerCatch(19);
}
Esempio n. 2
0
static void call_say2(int v, int v2)
{
    portalTimerStart(0);
    PREPAREWAIT(sem_heard2);
    portalTimerCatch(0);
    echoRequestProxy->say2(v, v2);
    portalTimerCatch(19);
    SEMWAIT(&sem_heard2);
    portalTimerCatch(30);
}
Esempio n. 3
0
int main(int argc, const char **argv)
{
    poller = new PortalPoller();
    EchoIndication *echoIndication = new EchoIndication(IfcNames_EchoIndication, poller);
    DisplayInd *dispIndication = new DisplayInd(IfcNames_DisplayInd, poller);
    // these use the default poller
    SwallowProxy *swallowProxy = new SwallowProxy(IfcNames_Swallow);
    echoRequestProxy = new EchoRequestProxy(IfcNames_EchoRequest);

    poller->portalExec_init();
    init_thread();
    portalExec_start();

#if 0
    printf("Timer tests\n");
    portalTimerInit();
    for (int i = 0; i < 1000; i++) {
      portalTimerStart(0);
      portalTimerCatch(1);
      portalTimerCatch(2);
      portalTimerCatch(3);
      portalTimerCatch(4);
      portalTimerCatch(5);
      portalTimerCatch(6);
      portalTimerCatch(7);
      portalTimerCatch(8);
    }
    portalTimerPrint(1000);
#endif

    int v = 42;
    fprintf(stderr, "Saying %d\n", v);
    call_say(v);
    call_say(v*5);
    call_say(v*17);
    call_say(v*93);
    printf("[%s:%d] run %d loops\n\n", __FUNCTION__, __LINE__, LOOP_COUNT);
    portalTimerInit();
    portalTimerStart(1);
    for (int i = 0; i < LOOP_COUNT; i++)
        call_say2(v, v*3);
uint64_t elapsed = portalTimerLap(1);
    printf("TEST TYPE: "
#ifndef SEPARATE_EVENT_THREAD
       "INLINE"
#elif defined(USE_MUTEX_SYNC)
       "MUTEX"
#else
       "SEM"
#endif
       "\n");
    portalTimerPrint(LOOP_COUNT);
    printf("call_say: elapsed %g average %g\n", (double) elapsed, (double) elapsed/ (double) LOOP_COUNT);
    echoRequestProxy->setLeds(9);
    poller->portalExec_end();
    portalExec_end();
    return 0;
}
Esempio n. 4
0
void dotestin(const char *testname, int which)
{
  uint64_t elapsed;
  heard_count = 0;
  printf("starting test %s, which %d\n", testname, which);
  portalTimerInit();
  portalTimerStart(1);
  portalTimerStart(0);
  portalTimerCatch(0);
  portalPerfRequestProxy->startspit(which, LOOP_COUNT);
  portalTimerCatch(19);
  wait_for(LOOP_COUNT);
  portalTimerCatch(21);
  elapsed = portalTimerLap(1);
  printf("test %s: heard %d elapsed %g average %g\n", testname, heard_count, (double) elapsed, (double) elapsed/ (double) LOOP_COUNT);
  portalTimerPrint(1);
}
Esempio n. 5
0
int main(int argc, const char **argv)
{
    PortalPerfIndication *portalPerfIndication = new PortalPerfIndication(IfcNames_PortalPerfIndication);

    portalPerfRequestProxy = new PortalPerfRequestProxy(IfcNames_PortalPerfRequest);

    portalExec_init();

    printf("Timer tests\n");
    portalTimerInit();
    for (int i = 0; i < 1000; i++) {
      portalTimerStart(0);
      portalTimerCatch(1);
      portalTimerCatch(2);
      portalTimerCatch(3);
      portalTimerCatch(4);
      portalTimerCatch(5);
      portalTimerCatch(6);
      portalTimerCatch(7);
      portalTimerCatch(8);
    }
    printf("Each line 1-8 is one more call to portalTimerCatch()\n");
    portalTimerPrint(1000);

    vl1 = 0xfeed000000000011;
    vl2 = 0xface000000000012;
    vl3 = 0xdead000000000013;
    vl4 = 0xbeef000000000014;
    vd1 = 0xfeed0000000000000021LL;
    vd2 = 0xface0000000000000022LL;
    vd3 = 0xdead0000000000000023LL;
    vd4 = 0xbeef0000000000000024LL;

    dotestout("swallow", call_swallow);
    dotestout("swallowl", call_swallowl);
    dotestout("swallowll", call_swallowll);
    dotestout("swallowlll", call_swallowlll);
    dotestout("swallowllll", call_swallowllll);
    dotestout("swallowd", call_swallowd);
    dotestout("swallowdd", call_swallowdd);
    dotestout("swallowddd", call_swallowddd);
    dotestout("swallowdddd", call_swallowdddd);
    dotestin("spitl", 1);
    dotestin("spit", 0);
    dotestin("spitll", 2);
    dotestin("spitlll", 3);
    dotestin("spitllll", 4);
    dotestin("spitd", 5);
    dotestin("spitdd", 6);
    dotestin("spitddd", 7);
    dotestin("spitdddd", 8);

    portalExec_end();
    return 0;
}
Esempio n. 6
0
 virtual void heard2(uint32_t a, uint32_t b) {
     portalTimerCatch(20);
     SEMPOST(&sem_heard2);
     //fprintf(stderr, "heard an echo2: %ld %ld\n", a, b);
     //portalTimerCatch(25);
 }