Tuning and Analysis Utilities

TAU

PRL

The Classic C++ port interface is given in TauMeasurement_CCA.h:



#ifndef TauMeasurement_CCA_H
#define TauMeasurement_CCA_H

#include "Measurement_CCA.h"
#include <TAU.h>

namespace performance
{


    /**
     * This class implements the performance Timer interface 
     */
    class TauTimer:
      public virtual performance::Timer
    {
    public:
      TauTimer ();
      TauTimer (string name);
      TauTimer (string name, string type);
      TauTimer (string name, string type, string group);
      ~TauTimer ();

      virtual void start(void);
      virtual void stop(void);

      virtual void setName(string name);
      virtual string getName(void);

      virtual void setType(string name);
      virtual string getType(void);

      virtual void setGroupName(string name);
      virtual string getGroupName(void);

      virtual void setGroupId(unsigned long group);
      virtual unsigned long getGroupId(void);

    private:
      TAU_MAPPING_OBJECT(tautimer)

    };


    /**
     * This class implements the performance Timer interface 
     */
    class TauPhase: public virtual performance::Phase {
    public:
      TauPhase ();
      TauPhase (string name);
      TauPhase (string name, string type);
      TauPhase (string name, string type, string group);
      ~TauPhase ();

      virtual void start(void);
      virtual void stop(void);

      virtual void setName(string name);
      virtual string getName(void);

      virtual void setType(string name);
      virtual string getType(void);

      virtual void setGroupName(string name);
      virtual string getGroupName(void);

      virtual void setGroupId(unsigned long group);
      virtual unsigned long getGroupId(void);

    private:
      TAU_MAPPING_OBJECT(tautimer)
    };



  /**
   * This class implements the MemoryTracker interface
   */
  class TauMemoryTracker: public virtual performance::MemoryTracker {
  public:
    TauMemoryTracker();
    ~TauMemoryTracker();
    
    
    virtual void trackHere();
    virtual void enableInterruptTracking();
    virtual void setInterruptInterval(int value);
    virtual void enable();
    virtual void disable();
  };


  /**
   * This class implements the MemoryTracker interface
   */
  class TauMemoryHeadroomTracker: public virtual performance::MemoryHeadroomTracker {
  public:
    TauMemoryHeadroomTracker();
    ~TauMemoryHeadroomTracker();
    
    
    virtual void trackHere();
    virtual void enableInterruptTracking();
    virtual void setInterruptInterval(int value);
    virtual void enable();
    virtual void disable();
  };



    /**
     * This class implements the Timer Query interface
     */
    class TauQuery:
      public virtual performance::Query
    {
    public:
      TauQuery ();
      ~TauQuery ();
      /** 
       * getTimerNames. Returns lists of Timers.
       */
      virtual void getTimerNames(const char **& timerList, int& numFuncs);

      /** 
       * getCounterNames. Returns lists of counters.
       */
      virtual void getCounterNames(const char **& counterList, 
		      int& numCounters);

      /** 
       * getTimerData. Returns lists of metrics.
       */
      virtual void getTimerData(const char **& inTimerList, 
		    int numTimers, double **& counterExclusive, 
		    double **& counterInclusive, int*& numCalls, 
		    int*& numChildCalls, const char **& counterNames, 
		    int& numCounters);


      /*
       * Get the list of User Event names
       */
      virtual void getEventNames(const char **& eventList, int& numEvents);

      /*
       * Get User Event data
       */
      virtual void getEventData(const char **&inEventList, int numEvents,
				int* &numSamples, double* &max,
				double* &min, double* &mean, double* &sumSqr);


      /** 
       * dumpProfileData. Writes the entire profile to disk in a dump file. 
       * It maintains a consistent state and represents the instantaneous 
       * profile data had the application terminated at the instance this call
       * is invoked.
       */
      virtual void dumpProfileData(void);

      /**
       * dumpProfileDataPrefix. Writes the entire profile to disk in a dump
       * file prefixed by 'prefix'.  It maintains a consistent state and 
       * represents the instantaneous profile data had the application 
       * terminated at the instance this call is invoked.
       */
      virtual void dumpProfileDataPrefix(const char *prefix);
  
      /** 
       * dumpProfileDataIncremental. Writes the entire profile to disk in a 
       * dump file whose name contains the current timestamp. 
       * It maintains a consistent state and represents the instantaneous 
       * profile data had the application terminated at the instance this call
       * is invoked. This call allows us to build a set of timestamped profile
       * files. 
       */
      virtual void dumpProfileDataIncremental(void);
  
      /** 
       * dumpTimerNames. Writes the list of timer names to a dump file on the 
       * disk.
       */
      virtual void dumpTimerNames(void);
  
      /** 
       * dumpTimerData. Writes the profile of the given set of timers to the 
       * disk. This allows the user to select the set of routines to dump and
       * periodically write the performance data of a subset of timers to disk
       * for monitoring purposes.
       */
      virtual void dumpTimerData(const char **& inTimerList, 
		      int numTimers);
  
      /** 
       * dumpTimerDataIncremental. 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. This allows the user to select the set of 
       * routines to dump and periodically write the performance data of a 
       * subset of timers to the disk and maintain a timestamped set of values 
       * for post-mortem analysis of how the performance data varied for a 
       * given set of routimes with time.
       */
      virtual void dumpTimerDataIncremental(const char **& 
		      inTimerList, int numTimers);
  
    };

    /**
     * This class implements the performance user defined evevnt interface 
     */
    class TauEvent:
      public virtual performance::Event
    {
    public:
      /** 
       * Constructor
       */
      TauEvent ();

      /** 
       * Constructor with name
       */

      TauEvent (string name);

      /** 
       * Destructor
       */
      ~TauEvent ();

      /** 
       * Trigger the event and give it a value. (e.g., size of a message)
       */
      virtual void trigger(double data);
    private:
      TauUserEvent *event;

    };

    /**
     * This class implements the performance user defined evevnt interface 
     */
    class TauContextEvent:
      public virtual performance::ContextEvent
    {
    public:
      /** 
       * Constructor
       */
      TauContextEvent ();

      /** 
       * Constructor with name
       */

      TauContextEvent (string name);

      /** 
       * Destructor
       */
      ~TauContextEvent ();

      /** 
       * Trigger the event and give it a value. (e.g., size of a message)
       */
      virtual void trigger(double data);
      virtual void enable();
      virtual void disable();

    private:
      TauContextUserEvent *event;

    };


    /**
     * This class implements the TAU runtime instrumentation control feature
     */
    class TauControl:
      public virtual performance::Control
    {
    public:
      TauControl ();
      ~TauControl ();

      /** 
       * Control instrumentation. Enable group Id.
       */
      virtual void enableGroupId(unsigned long id);
      
      /** 
       * Control instrumentation. Disable group Id.
       */
      virtual void disableGroupId(unsigned long id);
  
      /** 
       * Control instrumentation. Enable group name.
       */
      virtual void enableGroupName(string name);
      
      /** 
       * Control instrumentation. Disable group name.
       */
      virtual void disableGroupName(string name);
  
      /** 
       * Control instrumentation. Enable all groups.
       */
      virtual void enableAllGroups(void);
  
      /** 
       * Control instrumentation. Disable all groups.
       */
      virtual void disableAllGroups(void);
    };

  namespace ccaimpl
  {

    /**
     * This class implements the CCA Measurement interface 
     */
    class TauMeasurement:
      public virtual performance::ccaports::Measurement,
      public virtual classic::gov::cca::Component
    {
    public:
      TauMeasurement ();
      ~TauMeasurement ();

      /* Timing measurements based on start/stop */
      virtual performance::Timer* createTimer(void); 
      virtual performance::Timer* createTimer(string name); 
      virtual performance::Timer* createTimer(string name, string type); 
      virtual performance::Timer* createTimer(string name, string type, 
		      	string group); 


      /* Timing measurements based on start/stop */
      virtual performance::Phase* createPhase(void); 
      virtual performance::Phase* createPhase(string name); 
      virtual performance::Phase* createPhase(string name, string type); 
      virtual performance::Phase* createPhase(string name, string type, 
		      	string group); 


      virtual performance::MemoryTracker* createMemoryTracker(void);
      virtual performance::MemoryHeadroomTracker* createMemoryHeadroomTracker(void);

      /* Query performance data */
      virtual performance::Query* createQuery(void); 

      /* User defined events for tracking application events */
      virtual performance::Event* createEvent(void); 
      virtual performance::Event* createEvent(string name); 

      /* User defined events for tracking application events */
      virtual performance::ContextEvent* createContextEvent(void); 
      virtual performance::ContextEvent* createContextEvent(string name); 

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

      virtual void setServices (classic::gov::cca::Services * services);

    private:
      classic::gov::cca::Services * frameworkServices;
    };
  }
}



extern "C" {

  /** Construct and return a TauMeasurement instance
      as a pointer to a CCA component.
  */
  classic::gov::cca::Component * create_TauMeasurement ();
  
#define TAUMEASUREMENT_ALIAS "TauMeasurement"
  
};



#endif                          // TauMeasurement_CCA_H