2 //=============================================================================
6 * Utility Stats class that maintains the readings.
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
10 //=============================================================================
14 #include "rtschedtestlib_export.h"
16 #include "tao/orbconf.h"
17 #include "tao/debug.h"
19 #include "ace/OS_NS_time.h"
20 #include "ace/Singleton.h"
25 * @brief maintains readings recorded by tasks.
27 class RTSCHEDTESTLIB_Export Base_Time
31 ACE_hrtime_t base_time_
;
34 typedef ACE_Singleton
<Base_Time
, TAO_SYNCH_MUTEX
> BASE_TIME
;
39 * @brief maintains readings recorded by tasks.
41 class RTSCHEDTESTLIB_Export Task_Stats
51 int init (size_t max_samples
);
53 /// Set the base time value.
54 void base_time (ACE_hrtime_t time
);
56 /// Set the end time value.
57 void end_time (ACE_hrtime_t time
);
60 int sample (time_t thr_run_time
, int thr_count
);
62 void dump_samples (const ACE_TCHAR
*file_name
, const ACE_TCHAR
*msg
);
64 void dump_latency_stats (ACE_TCHAR
*out_msg
, ACE_UINT32 sf
);
66 /// Base and end times
67 ACE_hrtime_t base_time_
;
68 ACE_hrtime_t end_time_
;
70 /// The maximum number of samples
71 ACE_UINT32 max_samples_
;
73 /// The number of samples
74 ACE_UINT32 samples_count_
;
76 /// The samples : the time of execution. and the recorded exec. time .
77 time_t *thr_run_time_
;
81 ACE_UINT64 exec_time_min_
;
83 /// The number of the sample that had the minimum value
84 ACE_UINT32 exec_time_min_at_
;
87 ACE_UINT64 exec_time_max_
;
89 /// The number of the sample that had the maximum value
90 ACE_UINT32 exec_time_max_at_
;
92 /// The sum of all the values
95 /// The sum of the square of all the values
99 typedef ACE_Singleton
<Task_Stats
, TAO_SYNCH_MUTEX
> TASK_STATS
;
101 #if defined (__ACE_INLINE__)
102 #include "Task_Stats.inl"
103 #endif /* __ACE_INLINE__ */
105 #endif /* TASK_STATS_H */