Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / examples / Kokyu_dsrt_schedulers / Task_Stats.h
blobcf8651bb6de4af1cd7ddab604c84b5b4c5e45b3c
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Task_Stats.h
6 * Utility Stats class that maintains the readings.
8 * @author Pradeep Gore <pradeep@cs.wustl.edu>
9 */
10 //=============================================================================
11 #ifndef TASK_STATS_H
12 #define TASK_STATS_H
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"
20 /**
21 * @class Base_Time
23 * @brief maintains readings recorded by tasks.
25 class Kokyu_DSRT_Schedulers_Export Base_Time
27 public:
28 Base_Time ();
29 ACE_hrtime_t base_time_;
32 typedef ACE_Singleton<Base_Time, TAO_SYNCH_MUTEX> BASE_TIME;
34 /**
35 * @class Task_Stats
37 * @brief maintains readings recorded by tasks.
39 class Kokyu_DSRT_Schedulers_Export Task_Stats
41 public:
42 /// Constructor
43 Task_Stats ();
45 /// Destructor
46 ~Task_Stats ();
48 /// Init
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);
57 /// Record a sample
58 int sample (ACE_UINT32 thr_run_time, int thr_count);
60 void dump_samples (const ACE_TCHAR *file_name, const ACE_TCHAR *msg);
61 protected:
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_;
76 int *thr_count_;
78 /// The minimum value
79 ACE_UINT64 exec_time_min_;
81 /// The number of the sample that had the minimum value
82 ACE_UINT32 exec_time_min_at_;
84 /// The maximum value
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
91 ACE_UINT64 sum_;
93 /// The sum of the square of all the values
94 ACE_UINT64 sum2_;
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 */