Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C-API Function Call Speed
#1
The PPmac C-API has several functions to get or set data. Each function has advatages in ease-of-use and robustness and the tardeoff is usually with regards to speed. This is a chart giving some simple timing specifications for the common C-API function calls.

   

The test code used to generate this data is:
Code:
void user_plcc()
{
    char  szdata[100];
    double dAnswer;
    int i, j;

    pshm->P[1] = pshm->ClockSF*u64btod(fclock());  // start time

    for(i = 0; i < 1000; i++){
      //j = GetPmacVar("MyVar", &dAnswer);            // 940 usec
      //j = SetPmacVar("MyVar", 2.0);                // 850 usec
      //dAnswer = pshm->P[MyVar];                    // 23 usec
      //pshm->P[MyVar] = 3.0;                        // 23 usec
      //j = GetPmacNativeVar("P8192", &dAnswer);    // 264 usec
      //j = SetPmacNativeVar("P8192", 4.0);            // 295 usec
      //j = GetResponse("MyVar", szdata, 90, 7);    // 18325 usec
      //j = Command("MyVar=5");                        // 2465 usec
      //dAnswer = GetGlobalVar(MyVar);                // 54 usec
      //SetGlobalVar(MyVar, 1.0);                    // 46 usec
      //dAnswer = GetPtrVar(MyVar);                    // 130 usec
      //SetPtrVar(MyVar, 6.0);                        // 155 usec
      //dAnswer = GetCSGlobalVar(MyCsVar, 1);        // 60 usec
      //SetCSGlobalVar(MyCsVar, 1, 7.0);            // 53 usec
      //dAnswer = pshm->Coord[1].Q[1024];            // 23 usec
      pshm->Coord[1].Q[1024] = 8.0;                    // 23 usec
    }
    pshm->P[2] = pshm->ClockSF*u64btod(fclock()); // end time
    pshm->P[3] = pshm->P[2] - pshm->P[1];  // total in usec
    pshm->P[5] = (double) i;
    pshm->P[4] = dAnswer;

    sprintf(szdata,"%d\n", pshm->P[4]);
    Send(SEND1_PORT,szdata);

    Send(SEND1_PORT,szdata);
    usleep(1000000);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)