Hello Bhanu,

I'm extremely concerned that you are putting performance information into the code on a permanent basis - why do you need this?

John,





bhanu prakash <[EMAIL PROTECTED]>

26/03/2005 05:45

Please respond to
"Apache AXIS C Developers List"

To
Apache AXIS C Developers List <[email protected]>
cc
Subject
Re: Log times





Hi,

I have modified clientaxisengine.cpp such that it
writes these logging time info into a text file. and I
have installed AXIS as explained in install guide. I
am able to run the sample clients but it is not
writing any logging info into the text file that I
created. I am also attaching clientaxisengine.cpp with
my changes.

Any Ideas?

Thanks,
Bhanu
--- bhanu prakash <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to find the time taken for
> serialization,
> deserialization and handlers on both client and
> server. For this, Is it enough if we modify
> clientaxisengine.cpp and serveraxisengine.cpp files?
> If not, Can you let me know what other files needs
> modification.
>
> Thanks,
> Bhanu
>
>
>                                  
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
>


                                 
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ /* -*- C++ -*- */
/*
*   Copyright 2003-2004 The Apache Software Foundation.
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/

/*
* Revision 1.1  2004/08/26 roshan
* Added the method "releaseHandlers(string sSessionId)" in order to release the
*  Handlers once they are used.
*/


#include "ClientAxisEngine.h"
#include "../../wsdd/WSDDDeployment.h"
#include "../HandlerPool.h"
#include <axis/AxisException.hpp>
#include "../../common/AxisTrace.h"

extern AXIS_CPP_NAMESPACE_PREFIX WSDDDeployment* g_pWSDDDeployment;
extern AXIS_CPP_NAMESPACE_PREFIX HandlerPool* g_pHandlerPool;


/*******Bhanu****************************************************************/
#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
#include<sys/time.h>
#include"/usr/include/time.h"
#include<ctype.h>

struct timeval cStart,cStop,cReqHandlerStart,cReqHandlerStop,cResHandlerStart,cResHandlerStop;
struct cSerializerStart, cSerializerStop, cDeserializerStart, cDeserializerStop
fstream numberFile("/home/bhanu/clientNumbers.txt", ios::app);
/********Bhanu************************************************************/

AXIS_CPP_NAMESPACE_START

ClientAxisEngine::ClientAxisEngine ()
{

}

ClientAxisEngine::~ClientAxisEngine ()
{

}

MessageData* ClientAxisEngine::getMessageData ()
{
   return m_pMsgData;
}

int ClientAxisEngine::process (SOAPTransport* pSoap)
{



/********Bhanu************************************************************/
gettimeofday(&cStart, &tzp);
/********Bhanu************************************************************/



   int Status = AXIS_FAIL;
   const WSDDService* pService = NULL;

   try
   {
                    if (!pSoap)
                    {
                        return AXIS_FAIL;
                    }
                    m_pSoap = pSoap;
                    string sSessionId = m_pSoap->getSessionId();
               
                    do
                    {
                        const char* pchService = pSoap->getServiceName();
                       
                        if (pchService == NULL || strchr(pchService,'#') == NULL)
                        {
                                         pService = g_pWSDDDeployment->getService (pchService);
                        }
                        else
                        {
                                         char * pchTempService = new char [strlen(pchService)+1];
                                                                   // Skip the starting double quote
                                         strcpy(pchTempService, pchService+1);
                                 
                                         /* The String returned as the service name has the format "Calculator#add".
                                         So null terminate string at #.  */
                                         *(strchr(pchTempService, '#')) = '\0';

                                         /* get service description object from the WSDD Deployment object */
                                         pService = g_pWSDDDeployment->getService (pchTempService);
                                         delete pchTempService;
                        }

                        //Get Global and Transport Handlers
               
                        Status = initializeHandlers (sSessionId, pSoap->getProtocol());
                        if (AXIS_SUCCESS != Status)
                        {
                            throw AxisEngineException(SERVER_ENGINE_HANDLER_INIT_FAILED);
                            break;          //do .. while(0)
                        }
                        //Get Service specific Handlers from the pool if configured any
                        if (pService != NULL)
                        {
                            Status = g_pHandlerPool-> getRequestFlowHandlerChain (&m_pSReqFChain,
                                sSessionId, pService);
                            if (AXIS_SUCCESS != Status)
                            {
                                break;    //do .. while(0)
                            }
                            Status = g_pHandlerPool->
                                getResponseFlowHandlerChain (&m_pSResFChain, sSessionId,
                                pService);
                            if (AXIS_SUCCESS != Status)
                            {
                                break;    //do .. while(0)
                            }
                        }
               
                        // Invoke all handlers and then the remote webservice
                        Status = invoke (m_pMsgData); /* we generate response in the same way
                                                       * even if this has failed
                                                                                           */
                    }
                    while (0);
               
                    //release the handlers
                    releaseHandlers(sSessionId);                      
   }
   catch(AxisException& e)
   {
       e = e;

       throw;
   }


/********Bhanu************************************************************/
gettimeofday(&cStop, &tzp);
/********Bhanu************************************************************/

               
               
                return Status;
}

void ClientAxisEngine::releaseHandlers(string sSessionId)
{
   // Pool back the Service specific handlers
   if (m_pSReqFChain)
                g_pHandlerPool->poolHandlerChain(m_pSReqFChain, sSessionId);
   if (m_pSResFChain)
                g_pHandlerPool->poolHandlerChain(m_pSResFChain, sSessionId);

    // Pool back the Global and Transport handlers
    //UnInitializeHandlers(sSessionId, soap->trtype);                
}

int ClientAxisEngine::invoke (MessageData* pMsg)
{
   enum AE_LEVEL
   { AE_START = 1, AE_SERH, AE_GLH, AE_TRH, AE_SERV };
   int Status = AXIS_FAIL;
   int level = AE_START;

   do
   {



/********Bhanu************************************************************/
gettimeofday(&cReqHandlerStart, &tzp);
/********Bhanu************************************************************/



       // Invoke client side service specific request handlers
       if (m_pSReqFChain)
       {
           if (AXIS_SUCCESS != (Status = m_pSReqFChain->invoke (pMsg)))
           {
               // m_pSZ->setSoapFault(SoapFault::getSoapFault(CLIENT_ENGINE_CLIENTHANDLERFAILED));
               break;    //do .. while (0)
           }
       }
       // AXISTRACE1("AFTER invoke service specific request handlers");
       level++; //AE_SERH              

       // Invoke global request handlers
       if (m_pGReqFChain)
       {
           if (AXIS_SUCCESS != (Status = m_pGReqFChain->invoke (pMsg)))
           {
               // m_pSZ->setSoapFault(SoapFault::getSoapFault(CLIENT_ENGINE_CLIENTHANDLERFAILED));
               break;    //do .. while (0)
           }
       }
       // AXISTRACE1("AFTER invoke global request handlers");
       level++; //AE_GLH      

       // Invoke transport request handlers
       if (m_pTReqFChain)
       {
           if (AXIS_SUCCESS != (Status = m_pTReqFChain->invoke (pMsg)))
           {
               // m_pSZ->setSoapFault(SoapFault::getSoapFault(CLIENT_ENGINE_CLIENTHANDLERFAILED));
               break;    //do .. while (0)
           }
       }

                                 
/********Bhanu************************************************************/
gettimeofday(&cReqHandlerStop, &tzp);
gettimeofday(&cSerializerStart, &tzp);
/********Bhanu************************************************************/

                                 
                                 
                                 // AXISTRACE1("AFTER invoke transport request handlers");
       level++; // AE_TRH
                                 
                                 if (AXIS_SUCCESS != (Status = m_pSZ->setOutputStream (m_pSoap)))
           break;


       m_pSZ->markEndOfStream ();

       level++; // AE_SERV

               
/********Bhanu************************************************************/
gettimeofday(&cSerializerStop, &tzp);
/********Bhanu************************************************************/



                                 
                                 
                                 pMsg->setPastPivotState (true);

               
                                 
/********Bhanu************************************************************/
gettimeofday(&cDeserializerStart, &tzp);
/********Bhanu************************************************************/

                                 if (AXIS_SUCCESS != (Status = m_pDZ->setInputStream (m_pSoap)))
           break;

       int nSoapVersion = m_pDZ->getVersion ();
       if (nSoapVersion == VERSION_LAST)     /* version not supported */
       {
           Status = AXIS_FAIL;
           // return AXIS_FAIL;
       }

       m_pDZ->getHeader ();

/********Bhanu************************************************************/
gettimeofday(&cDeserializerStop, &tzp);
/********Bhanu************************************************************/


   }
   while (0);


/********Bhanu************************************************************/
gettimeofday(&cResHandlerStart, &tzp);
/********Bhanu************************************************************/

   /*
    *  The case clauses in this switch statement have no breaks.
    *  Hence, if Everything up to web service invocation was successful
    *  then all response handlers are invoked. If there was a failure
    *  at some point the response handlers from that point onwards
    *  are invoked.
    */
   switch (level)
   {
       case AE_SERV: // everything success
           Status = AXIS_SUCCESS;
           // no break;
       case AE_TRH: /* after invoking the transport handlers
                     * (at actual service invokation) it has failed
                                       */
           if (m_pTResFChain)
           {
               m_pTResFChain->invoke (pMsg);
           }
           // no break;
       case AE_GLH: // transport handlers have failed
           // invoke global response handlers
           if (m_pGResFChain)
           {
               m_pGResFChain->invoke (pMsg);
           }
           //no break;
       case AE_SERH: // global handlers have failed
           // invoke web service specific response handlers
           if (m_pSResFChain)
           {
               m_pSResFChain->invoke (pMsg);
           }
           // no break;
       case AE_START:; // service specific handlers have failed
   };


/********Bhanu************************************************************/
gettimeofday(&cResHandlerStop, &tzp);
numberFile<< (cStop.tv_usec - cStart.tv_usec);
numberFile<< "'";
numberFile<< (cReqHandlerStop.tv_usec - cReqHandlerStart.tv_usec);
numberFile<< "'";
numberFile<< (cSerializerStop.tv_usec - cSerializerStart.tv_usec);
numberFile<< "'";
numberFile<< (cResHandlerStop.tv_usec - cResHandlerStart.tv_usec);
numberFile<< "'";
numberFile<< (cDeserializerStop.tv_usec - cDeserializerStart.tv_usec);
numberFile<< ".";
numberFile.close();
/********Bhanu************************************************************/

   return Status;
}

void ClientAxisEngine::onFault (MessageData* pMsg)
{

}

AXIS_CPP_NAMESPACE_END

Reply via email to