[ace-users] : measuring the time necessary to run an method

Ricardo Perrone perrone at rocketmail.com
Thu Oct 4 12:07:11 CDT 2007


Hi,

    ACE 5.6.1, 
    TAO 1.6.1, 
    CIAO 0.6.1, 
    COSMIC 0.6, 
    GME 6.11.9

    HOST MACHINE and OPERATING SYSTEM:
        Centrino Duo 1,8 GHz, 1 GB, windows Vista Ultimate

    COMPILER NAME AND VERSION (AND PATCHLEVEL):
    VC8(2005) Express Edition, Microsoft Plataform SDK for Windows Server 2003 R2

    THE $ACE_ROOT/ace/config.h 
    #include "ace/config-win32.h"

    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
    ssl=0
    qos=1
    cidl=1
    rwho=0
    sctp=0
    zlib=1
    xsc=1

    SYNOPSIS:
    measuring the time necessary to run an method

    DESCRIPTION:
Hi,

I am trying to measure the time necessary to run one method, and to do this i adapted the example describe in 
(%ACE_ROOT%\TAO\CIAO\examples\Display, specifically the NavDisplay_exe.cpp). In this file was inserted two line codes with ACE_OS::gethrtime
to measure the elapsed time:

void MyImpl::NavDisplay_exec_impl::push_Refresh (HUDisplay::tick *ev)
{
  ACE_UNUSED_ARG (ev);
   
  // Refresh position
  HUDisplay::position_var loc = this->context_->get_connection_GPSLocation ();

  if (CORBA::is_nil (loc.in ()))
    {
      throw CORBA::BAD_INV_ORDER ();
    }
    
  ACE_hrtime_t start = ACE_OS::gethrtime (); // start time
         CORBA::Long x = loc->posx () % 500; // 
  ACE_hrtime_t end= ACE_OS::gethrtime (); //  end time
  
  ACE_DEBUG ((LM_DEBUG, "NAVDISPLAY: Current Location (X): (%d)\n", x));
  ACE_DEBUG ((LM_DEBUG, "MEASUREMENT: time (begin/end): (%d, %d)\n", start, end)); // print the measurement's time values 
  ACE_DEBUG ((LM_DEBUG, "EXECUTION NUMBER: %d\n", countern++));
}

The results captured in console were:

NAVDISPLAY: Current Location (X): (150)
MEASUREMENT: time (begin/end): (-440828064, 35)
EXECUTION NUMBER: 0
NAVDISPLAY: Current Location (X): (212)
MEASUREMENT: time (begin/end): (-433669044, 35)
EXECUTION NUMBER: 1
NAVDISPLAY: Current Location (X): (309)
MEASUREMENT: time (begin/end): (-426509450, 35)
EXECUTION NUMBER: 2
NAVDISPLAY: Current Location (X): (395)
MEASUREMENT: time (begin/end): (-419349856, 35)
EXECUTION NUMBER: 3
NAVDISPLAY: Current Location (X): (349)
MEASUREMENT: time (begin/end): (-412190573, 35)
EXECUTION NUMBER: 4
NAVDISPLAY: Current Location (X): (294)
MEASUREMENT: time (begin/end): (-405030795, 35)
EXECUTION NUMBER: 5
NAVDISPLAY: Current Location (X): (407)
MEASUREMENT: time (begin/end): (-397871511, 35)
EXECUTION NUMBER: 6
NAVDISPLAY: Current Location (X): (12)
MEASUREMENT: time (begin/end): (-390712060, 35)
EXECUTION NUMBER: 7
NAVDISPLAY: Current Location (X): (63)
MEASUREMENT: time (begin/end): (-383552615, 35)
EXECUTION NUMBER: 8
NAVDISPLAY: Current Location (X): (154)
MEASUREMENT: time (begin/end): (-376393020, 35)
EXECUTION NUMBER: 9
NAVDISPLAY: Current Location (X): (161)
MEASUREMENT: time (begin/end): (-369233577, 35)
EXECUTION NUMBER: 10

Questions about:
1- O noted that all times appears with negative signal ("start" variable), why? is it related to %d format parameter? how to correct this?
2- The time related to "end" variable appears to be constant for every execution, why this happen?
3- Is the time returned by ACE_OS::gethrtime in nanoseconds scale for default? 
   How can i handle this scale to move for others scales like microseconds or miliseconds? have i to use global_scale_factor manually to do it?
4- If i need an more portable measurment method, is ACE_OS::gethrtime more suitable than ACE_High_Res_Timer ? for example:  port the  same  code to run on linux environment.
5- Now i am runnig the test in centrino duo core and the time that i measures has some range error because of cores. How can i adjust the measurement to consider only one core?

if somebody have suggestions on how to run the measurement in more suitable way, i will appreciate...

Thanks
Ricardo






       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=list&sid=396545433



More information about the Ace-users mailing list