示例#1
0
int main(int argc, const char **argv)
{
    PortalSocketParam paramSocket = {};
    PortalMuxParam param = {};

    Portal *mcommon = new Portal(0, sizeof(uint32_t), NULL, NULL, &socketfuncInit, &paramSocket, 0);
    param.pint = &mcommon->pint;
    EchoIndication *sIndication = new EchoIndication(IfcNames_EchoIndication, &muxfunc, &param);
    sEcho = new EchoRequestSWProxy(IfcNames_EchoRequest, &muxfunc, &param);
    SecondIndication *sSecondIndication = new SecondIndication(IfcNames_SecondIndication, &muxfunc, &param);
    sSecond = new SecondRequestProxy(IfcNames_SecondRequest, &muxfunc, &param);
    ThirdIndication *sThirdIndication = new ThirdIndication(IfcNames_ThirdIndication, &muxfunc, &param);
    sThird = new ThirdRequestProxy(IfcNames_ThirdRequest, &muxfunc, &param);

    portalExec_start();

    int v = 42;
    fprintf(stderr, "Saying %d\n", v);
    call_say(v);
sSecond->say(v*99, v * 1000000000L, v*55);
    call_say(v*5);
sThird->say();
    call_say(v*17);
    call_say(v*93);
    call_say2(v, v*3);
    printf("TEST TYPE: SEM\n");
    sEcho->setLeds(9);
    portalExec_end();
    return 0;
}
示例#2
0
文件: testecho.cpp 项目: chamdoo/xbsv
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;
}
示例#3
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;
}