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 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/public-api/common/vector-wrapper.h>
45 class UpdateRenderSynchronization;
46 class AdaptorInternalServices;
47 class EnvironmentOptions;
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] environmentOptions environment options
63 UpdateThread(UpdateRenderSynchronization& sync,
64 AdaptorInternalServices& adaptorInterfaces,
65 const EnvironmentOptions& environmentOptions );
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 boost::thread* mThread; ///< The actual update-thread.
124 const EnvironmentOptions& mEnvironmentOptions; ///< environment options
125 }; // class UpdateThread
127 } // namespace Adaptor
129 } // namespace Internal
133 #endif // __DALI_INTERNAL_UPDATE_THREAD_H__