1 #ifndef __DALI_INTERNAL_UPDATE_THREAD_H__
2 #define __DALI_INTERNAL_UPDATE_THREAD_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/public-api/common/vector-wrapper.h>
44 class UpdateRenderSynchronization;
45 class AdaptorInternalServices;
46 class TriggerEventInterface;
50 * The update-thread is responsible for calling Core::Update(), and
51 * for triggering the render-thread after each update.
58 * Create the update-thread; this will not do anything until Start() is called.
59 * @param[in] sync An object used to synchronize update & render threads.
60 * @param[in] adaptorInterfaces base adaptor interface
61 * @param[in] LogOptions log functions
63 UpdateThread(UpdateRenderSynchronization& sync,
64 AdaptorInternalServices& adaptorInterfaces,
65 const LogOptions& logOptions );
68 * Non-virtual destructor; UpdateThread is not suitable as a base class.
73 * Starts the update-thread
78 * Stops the update-thread
85 * This method is used by the update-thread for calling Core::Update().
86 * @return true, if the thread finishes properly.
91 * When DALI_FPS_TRACKING is enabled, this method calculates the frame rates for the specified time period
93 void FPSTracking(float secondsFromLastFrame);
96 * Output the FPS information
97 * when the FSP tracking is enabled,
98 * it is called when the specified tracking period is elapsed or in the destructor when the process finished beforehand
100 void OutputFPSRecord();
103 * Optionally output the update thread status.
104 * @param[in] keepUpdatingStatus Whether the update-thread requested further updates.
105 * @param[in] renderNeedsUpdate Whether the render-thread requested another update.
107 void UpdateStatusLogging( unsigned int keepUpdatingStatus, bool renderNeedsUpdate );
111 UpdateRenderSynchronization& mUpdateRenderSync; ///< Used to synchronize the update & render threads
113 Dali::Integration::Core& mCore; ///< Dali core reference
115 unsigned int mFpsTrackingSeconds; ///< fps tracking time length in seconds
116 std::vector<float> mFpsRecord; ///< Record of frame rate
117 float mElapsedTime; ///< time elapsed within current second
118 unsigned int mElapsedSeconds; ///< seconds elapsed since the fps tracking started
120 unsigned int mStatusLogInterval; ///< Interval in frames between status debug prints
121 unsigned int mStatusLogCount; ///< Used to count frames between status debug prints
123 TriggerEventInterface& mNotificationTrigger; ///< Reference to notification event trigger
125 boost::thread* mThread; ///< The actual update-thread.
126 const LogOptions& mLogOptions; ///< Log options
127 }; // class UpdateThread
129 } // namespace Adaptor
131 } // namespace Internal
135 #endif // __DALI_INTERNAL_UPDATE_THREAD_H__