## NAME

ACE_Profile_Timer - This class provides both a timing mechanism and a mechanism for reporting the resource usage of a process.

## SYNOPSIS

    #include <ace/Profile_Timer.h>

    class ACE_Profile_Timer
    {
      public:
        typedef ACE_Rusage Rusage;
        ACE_Profile_Timer (void);
        ~ACE_Profile_Timer (void);
        int start (void);
        int stop (void);
        int elapsed_time (ACE_Elapsed_Time &et);
        void elapsed_rusage (ACE_Profile_Timer::Rusage &rusage);
        void get_rusage (ACE_Profile_Timer::Rusage &rusage);
        void dump (void) const;
        ACE_ALLOC_HOOK_DECLARE;
      private:
        void compute_times (ACE_Elapsed_Time &et);
        ACE_Profile_Timer::Rusage begin_usage_;
        ACE_Profile_Timer::Rusage end_usage_;
        ACE_Profile_Timer::Rusage last_usage_;
        void subtract (timespec_t &tdiff, timespec_t &t0, timespec_t &t1);
        ACE_HANDLE proc_handle_;
        void subtract (timeval &tdiff, timeval &t0, timeval &t1);
        timeval begin_time_;
        timeval end_time_;
        timeval last_time_;
        ACE_High_Res_Timer timer_;
    };

## Initialization and termination methods.

    ACE_Profile_Timer (void);

Default constructor.

    ~ACE_Profile_Timer (void);

Shutdown the timer.

## Timer methods.

    int start (void);

Activate the timer.

    int stop (void);

Stop the timer.

## Resource utilization methods.

    int elapsed_time (ACE_Elapsed_Time &et);

Compute the time elapsed since `start`.

    void elapsed_rusage (ACE_Profile_Timer::Rusage &rusage);

Compute the amount of resource utilization since the start time.

    void get_rusage (ACE_Profile_Timer::Rusage &rusage);

Return the resource utilization (don't recompute it).

    void dump (void) const;

Dump the state of an object.

    ACE_ALLOC_HOOK_DECLARE;

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace