1 #ifndef __DALI_INTERNAL_ADAPTOR_FRAME_TIME_STATS_H__
2 #define __DALI_INTERNAL_ADAPTOR_FRAME_TIME_STATS_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/internal/system/common/frame-time-stamp.h>
23 #include <dali/public-api/common/dali-vector.h>
36 * Used to get statistics about time stamps over a period of time.
37 * E.g. the min, max, total and average time spent inside two markers,
38 * such as UPDATE_START and UPDATE_END
48 * Destructor, not intended as a base class
54 * @param timeStamp time stamp
56 void StartTime( const FrameTimeStamp& timeStamp );
60 * @param timeStamp time stamp
62 void EndTime( const FrameTimeStamp& timeStamp );
65 * Reset all internal counters / state except total time.
70 * @return maximum time in seconds
72 float GetMaxTime() const;
75 * @return minimum time in seconds
77 float GetMinTime() const;
80 * @return total time in second
82 float GetTotalTime() const;
85 * Get how many times the timer has been started /stopped
87 unsigned int GetRunCount() const;
90 * Calculate the mean and standard deviation
92 * @param[out] mean The return mean value
93 * @param[out] standardDeviation The return standard deviation value
95 void CalculateMean( float& meanOut, float& standardDeviationOut ) const;
100 * internal time state.
104 WAITING_FOR_START_TIME, ///< waiting for start time marker
105 WAITING_FOR_END_TIME ///< waiting for end time marker
108 typedef Dali::Vector< unsigned int > Samples;
111 unsigned int mMin; ///< current minimum value in microseconds
112 unsigned int mMax; ///< current maximum value in microseconds
113 unsigned int mTotal; ///< current total in in microseconds
114 unsigned int mRunCount; ///< how many times the timer has been start / stopped
115 FrameTimeStamp mStart; ///< start time stamp, to calculate the diff
116 TimeState mTimeState:1; ///< time state
117 bool mMinMaxTimeSet:1; ///< whether the min-max values have been configured
121 } // namespace Adaptor
123 } // namespace Internal
127 #endif // __DALI_INTERNAL_ADAPTOR_FRAME_TIME_STATS_H__