cfaure

execution time

Discussion created by cfaure on Nov 14, 2014
Latest reply on Nov 17, 2014 by Gregor

Hello all,

 

 

 

I developped my own interface and I have the following problem :

 

 

 

1) The call of the following procedure takes more than 2,5 seconds :

 

ret = piPointInput.ArchiveStrVar(G_server_name);

 

2,5 seconds is the difference of the measure of the time before and after the call of the function.

 


 

2) The procedure contains the following code lines:

 

 

 

bool pi_pointInput::ArchiveStrVar(string serverName)
{
    
    bool ret = false;

    // pi_server
    pi_server piServer;     // refer to the pi_server class
    HRESULT errorNb;      // _com_err error number
    _bstr_t errorDescr;   // _com_err error description


    // SELECT PI SERVER
    errorNb = 0;
    ret = piServer.selectServer(serverName, errorDescr, errorNb);
  
    return ret;
} // end ArchiveStrVar

 


If I measure the time at the beginning of the function and just before the return of the function, the difference is about 300ms.

 


 

3) the content of selectServer is :

 

bool pi_server::selectServer(string serverName, _bstr_t &errorDescr, HRESULT &errorNb)
{
    IPISDKPtr pPISDK(__uuidof(PISDK));
    ServersPtr pServers;
    bool ret = TRUE;

    // select list of servers
    pServers = pPISDK->Servers;
   
    if(pPISDK != NULL) pPISDK.Release();
    if(pServers != NULL) pServers.Release();

 


    return ret;
}

 


 

Do you see something wrong ? perhaps in the release of the variables ?

 

If I comment the  pServers = pPISDK->Servers; line, the mesure in 1) is about 100 ms, instead of 2,5s.

 

 

 

Thank you for your help !

 

Cyril

Outcomes