2 //=============================================================================
6 * Utility Stats class that maintains the readings.
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
10 //=============================================================================
14 #include "ace/OS_NS_time.h"
15 #include "ace/Singleton.h"
16 #include "tao/orbconf.h"
17 #include "tao/debug.h"
18 #include "Kokyu_dsrt_schedulers_export.h"
23 * @brief maintains readings recorded by tasks.
25 class Kokyu_DSRT_Schedulers_Export Base_Time
29 ACE_hrtime_t base_time_
;
32 typedef ACE_Singleton
<Base_Time
, TAO_SYNCH_MUTEX
> BASE_TIME
;
37 * @brief maintains readings recorded by tasks.
39 class Kokyu_DSRT_Schedulers_Export Task_Stats
49 int init (size_t max_samples
);
51 /// Set the base time value.
52 void base_time (ACE_hrtime_t time
);
54 /// Set the end time value.
55 void end_time (ACE_hrtime_t time
);
58 int sample (ACE_UINT32 thr_run_time
, int thr_count
);
60 void dump_samples (const ACE_TCHAR
*file_name
, const ACE_TCHAR
*msg
);
62 void dump_latency_stats (ACE_TCHAR
*out_msg
, ACE_UINT32 sf
);
64 /// Base and end times
65 ACE_hrtime_t base_time_
;
66 ACE_hrtime_t end_time_
;
68 /// The maximum number of samples
69 ACE_UINT32 max_samples_
;
71 /// The number of samples
72 ACE_UINT32 samples_count_
;
74 /// The samples : the time of execution. and the recorded exec. time .
75 ACE_UINT32
*thr_run_time_
;
79 ACE_UINT64 exec_time_min_
;
81 /// The number of the sample that had the minimum value
82 ACE_UINT32 exec_time_min_at_
;
85 ACE_UINT64 exec_time_max_
;
87 /// The number of the sample that had the maximum value
88 ACE_UINT32 exec_time_max_at_
;
90 /// The sum of all the values
93 /// The sum of the square of all the values
97 typedef ACE_Singleton
<Task_Stats
, TAO_SYNCH_MUTEX
> TASK_STATS
;
99 #if defined (__ACE_INLINE__)
100 #include "Task_Stats.inl"
101 #endif /* __ACE_INLINE__ */
103 #endif /* TASK_STATS_H */