Merge "atspi: remove undefined method" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / common / fps-tracker.h
1 #ifndef DALI_INTERNAL_FPS_TRACKER_H
2 #define DALI_INTERNAL_FPS_TRACKER_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 namespace Dali
22 {
23 namespace Internal
24 {
25 namespace Adaptor
26 {
27 class EnvironmentOptions;
28
29 /**
30  * Tracks the frames per second.
31  *
32  * Can also output the FPS to a file if required.
33  */
34 class FpsTracker
35 {
36 public:
37   /**
38    * Create the FPS Tracker.
39    * @param[in] environmentOptions environment options
40    */
41   FpsTracker(const EnvironmentOptions& environmentOptions);
42
43   /**
44    * Non-virtual destructor; UpdateThread is not suitable as a base class.
45    */
46   ~FpsTracker();
47
48   /**
49    * When DALI_FPS_TRACKING is enabled, this method calculates the frame rates for the specified time period
50    *
51    * @param[in] secondsFromLastFrame The time (in seconds) that has elapsed since the last frame.
52    */
53   void Track(float secondsFromLastFrame);
54
55   /**
56    * @return Whether FPS tracking is enabled.
57    */
58   bool Enabled() const;
59
60 private:
61   /**
62    * Output the FPS information
63    * when the FSP tracking is enabled,
64    * it is called when the specified tracking period is elapsed or in the destructor when the process finished beforehand
65    */
66   void OutputFPSRecord();
67
68 private:                     // Data
69   float mFpsTrackingSeconds; ///< fps tracking time length in seconds
70   float mFrameCount;         ///< how many frames occurred during tracking period
71   float mElapsedTime;        ///< time elapsed from previous fps tracking output
72 };
73
74 } // namespace Adaptor
75
76 } // namespace Internal
77
78 } // namespace Dali
79
80 #endif // DALI_INTERNAL_FPS_TRACKER_H