Tuning and Analysis Utilities

TAU

PRL

The TAU performance component provides a generic interface to performance tools for component based software. Following is the interface given as a SIDL file.


package Performance version 1.7.0 
{
  interface Timer 
  { /* Start/stop the Timer */ 
    void start(); 
    void stop();

    /* Set/get the Timer name */ 
    void setName(in string name);
    string getName();

    /* Set/get Timer type information (e.g., signature of the routine) */ 
    void setType(in string name);
    string getType();

    /* Set/get the group name associated with the Timer */
    void setGroupName(in string name);
    string getGroupName();

    /* Set/get the group id associated with the Timer */ 
    void setGroupId(in long group);
    long getGroupId();
  }

  interface Phase 
  { /* Start/stop the Phase */ 
    void start(); 
    void stop();

    /* Set/get the Phase name */ 
    void setName(in string name);
    string getName();

    /* Set/get Phase type information (e.g., signature of the routine) */ 
    void setType(in string name);
    string getType();

    /* Set/get the group name associated with the Phase */
    void setGroupName(in string name);
    string getGroupName();

    /* Set/get the group id associated with the Phase */ 
    void setGroupId(in long group);
    long getGroupId();
  }

  /* Query interface to obtain timing information */ 
  interface Query
  { 
    /* Get the list of Timer and Counter names */ 
    array<string> getTimerNames();
    array<string> getCounterNames();
 
    /* Get the timer data */
    void getTimerData(in array<string> timerList, 
      out array<double, 2> counterExclusive, 
      out array<double, 2> counterInclusive, out array<int> numCalls, 
      out array<int> numChildCalls, out array<string> counterNames,
      out int numCounters);

    /* User Event query interface */
    array<string> getEventNames();
    void getEventData(in array<string> eventList, out array<int> numSamples,
		      out array<double> max, out array<double> min,
		      out array<double> mean, out array<double> sumSqr);

    /* Writes instantaneous profile to disk in a dump file. */
    void dumpProfileData();

    /* Writes instantaneous profile to disk in a dump file with a specified prefix. */
    void dumpProfileDataPrefix(in string prefix);
  

    /* Writes the instantaneous profile to disk in a dump file whose name
     * contains the current timestamp. */
     void dumpProfileDataIncremental();
  
    /* Writes the list of timer names to a dump file on the disk */
     void dumpTimerNames();
  
    /* Writes the profile of the given set of timers to the disk. */
    void dumpTimerData(in array<string> timerList);
  
    /* Writes the profile of the given set of timers to the disk. The dump
     * file name contains the current timestamp when the data was dumped. */
    void dumpTimerDataIncremental(in array<string> timerList);


  }


  /* Memory Tracker interface */
  interface MemoryTracker 
  {
      /* track heap memory at a given place */
      void trackHere();
      /* enable interrupt driven memory tracking */
      void enableInterruptTracking();
      /* set the interrupt interval, default is 10 seconds */
      void setInterruptInterval(in int value);
      /* disable tracking (both interrupt driven and manual) */
      void enable();
      /* enable tracking (both interrupt driven and manual)*/
      void disable();
  }

  /* Memory Headroom Tracker interface */
  interface MemoryHeadroomTracker 
  {
      /* track heap memory at a given place */
      void trackHere();
      /* enable interrupt driven memory tracking */
      void enableInterruptTracking();
      /* set the interrupt interval, default is 10 seconds */
      void setInterruptInterval(in int value);
      /* disable tracking (both interrupt driven and manual) */
      void enable();
      /* enable tracking (both interrupt driven and manual)*/
      void disable();
  }

  /* User defined event profiles for application specific events */ 
  interface Event
  { /* Set the name of the event */ 
    void setName(in string name);

    /* Trigger the event */ 
    void trigger(in double data);
  }

  /* User defined context events for application specific events */ 
  interface ContextEvent
  {
    /* Trigger the event */ 
    void trigger(in double data);

    /* Enable the context tracking on this event */ 
    void enable();

    /* Disable the context tracking on this event */ 
    void disable();
  }


  /* Interface for runtime instrumentation control based on groups */
  interface Control
  { /* Enable/disable group id */
    void enableGroupId(in long id);
    void disableGroupId(in long id);
  
    /* Enable/disable group name */
    void enableGroupName(in string name);
    void disableGroupName(in string name);
  
    /* Enable/disable all groups */
    void enableAllGroups();
    void disableAllGroups();
  }

  /* Interface to create performance component instances */
  interface Measurement extends gov.cca.Port
  { /* Create a Timer */ 
    Timer createTimer(); 
    Timer createTimerWithName(in string name); 
    Timer createTimerWithNameType(in string name, in string type); 
    Timer createTimerWithNameTypeGroup(in string name, in string type, in string group);


    Phase createPhase(); 
    Phase createPhaseWithName(in string name); 
    Phase createPhaseWithNameType(in string name, in string type); 
    Phase createPhaseWithNameTypeGroup(in string name, in string type, in string group);
      
    /* Create a Query interface */ 
    Query createQuery(); 

    /* Create a MemoryTracker interface */ 
    MemoryTracker createMemoryTracker(); 

    /* Create a MemoryHeadroomTracker interface */ 
    MemoryHeadroomTracker createMemoryHeadroomTracker(); 

    /* Create a User Defined Event interface */ 
    Event createEvent(); 
    Event createEventWithName(in string name); 

    /* Create a User Defined Context Event interface */
    ContextEvent createContextEventWithName(in string name); 

    /* Create a Control interface for selectively enabling and disabling
     * the instrumentation based on groups */ 
    Control createControl(); 
  }

  /* Monitor Port for MasterMind component */
  interface Monitor extends gov.cca.Port {
    void startMonitoring(in string rname);
    void stopMonitoring(in string rname, in array<string> paramNames, in array<double> paramValues);
    void setFileName(in string rname, in string fname);
    void dumpData(in string rname);
    void dumpDataFileName(in string rname, in string fname);
    void destroyRecord(in string rname);
  }

  interface PerfParam extends gov.cca.Port {
    int getPerformanceData(in string rname, out array<double, 2> data, in bool reset);
    int getCompMethNames(out array<string> cm_names); 
  }
}

Example: Following is an excerpt from integrators_MonteCarloIntegrator_Impl.cc which uses the TAU performance component.


double
integrators::MonteCarloIntegrator_impl::integrate (
  /*in*/ double lowBound,
  /*in*/ double upBound,
  /*in*/ int32_t count ) 
throw () 
{
  // DO-NOT-DELETE splicer.begin(integrators.MonteCarloIntegrator.integrate)
  // insert implementation here
  
   gov::cca::Port port;
   double sum = 0.0;
   functions::Function function_m;
   static performance::Measurement measurement_m;
   randomgen::RandomGenerator random_m;

     // Get RandomGenerator port  

   port = frameworkServices.getPort ("RandomGeneratorPort");
   if (port._not_nil ())
      random_m = port;
   if (random_m._is_nil ()) {
      cerr << "Connected to something other than a RandomGenerator port" << endl;
      return -1;
   }

         // Get Function port
   port = frameworkServices.getPort ("FunctionPort");
   if (port._not_nil ())
      function_m = port;

   if (function_m._is_nil ()) {
      cerr << "Connected to something other than a Function port" << endl;
      return -1;
   }
   
         // Get Measurement port
   port = frameworkServices.getPort ("MeasurementPort");
   if (port._not_nil ())
      measurement_m = port;

   if (measurement_m._is_nil ()) {
      cerr << "Connected to something other than a Measurement port" << endl;
      return -1;
   }

   static performance::Timer top = measurement_m.createTimerWithNameTypeGroup("Top Level", "Type", "TAU_GROUP_CCA");

   static performance::Timer line = measurement_m.createTimerWithNameTypeGroup("loop", "", "TAU_GROUP_CCA");
   static performance::Query query = measurement_m.createQuery();
   static performance::Timer third = measurement_m.createTimerWithNameTypeGroup("Third", "", "TAU_GROUP_CCA");

   top.start(); 
   for (int i = 0; i < count; i++) { double x = random_m.getRandomNumber ();
      line.start();
      x =  lowBound + (upBound - lowBound) * x;
      sum = sum + function_m.evaluate (x);
      line.stop();
   }
   ::sidl::array< ::std::string> nm = query.getTimerNames();
   ::sidl::array< ::std::string> ct = query.getCounterNames();
   cout <<"Name of counter 0 : "<<ct.get(0)<<endl;
   for (int j = nm.lower(0); j < nm.upper(0)+1; j++)
   {
      cout <<"Name of Timer "<< j << " = " <<nm.get(j)<<endl;
   }
   ::sidl::array< double> ex, in;
   ::sidl::array< int> numCalls, numChildCalls;
   ::sidl::array< ::std::string> counterNames;
   int numCounters; 
   query.getTimerData(nm, ex, in, numCalls, numChildCalls, counterNames, 
		   numCounters);
   cout <<"Num of Counters = "<< numCounters <<endl;
   cout <<"Calls for loop func: "<<numCalls.get(1)<<endl;
   cout <<"Counter 0 name = "<<counterNames.get(0) <<endl;
   //query.dumpTimerDataIncremental(nm);
   top.stop(); 

   query.dumpTimerNames();

   // Release ports
   frameworkServices.releasePort ("RandomGeneratorPort");
   frameworkServices.releasePort ("FunctionPort");
   frameworkServices.releasePort ("MeasurementPort");

   return (upBound - lowBound) * sum / count;
  
  // DO-NOT-DELETE splicer.end(integrators.MonteCarloIntegrator.integrate)
}