$(platform_abstraction_src_dir)/core.cpp \
$(platform_abstraction_src_dir)/glyph-set.cpp \
$(platform_abstraction_src_dir)/debug.cpp \
+ $(platform_abstraction_src_dir)/profiling.cpp \
$(platform_abstraction_src_dir)/shader-data.cpp \
$(platform_abstraction_src_dir)/system-overlay.cpp \
$(platform_abstraction_src_dir)/common/lockless-buffer.cpp \
$(platform_abstraction_src_dir)/core.h \
$(platform_abstraction_src_dir)/glyph-set.h \
$(platform_abstraction_src_dir)/debug.h \
+ $(platform_abstraction_src_dir)/profiling.h \
$(platform_abstraction_src_dir)/bitmap.h \
$(platform_abstraction_src_dir)/resource-types.h \
$(platform_abstraction_src_dir)/resource-request.h \
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// CLASS HEADER
+#include <dali/integration-api/profiling.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/common/thread-local-storage.h>
+#include <dali/internal/event/events/gesture-event-processor.h>
+
+using Dali::Internal::GestureEventProcessor;
+using Dali::Internal::ThreadLocalStorage;
+
+namespace Dali
+{
+
+namespace Integration
+{
+
+void EnableProfiling( ProfilingType type )
+{
+ GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
+
+ switch( type )
+ {
+ case PROFILING_TYPE_PAN_GESTURE:
+ {
+ eventProcessor.EnablePanGestureProfiling();
+ }
+
+ default:
+ {
+ // Do nothing
+ break;
+ }
+ }
+}
+
+} // namespace Integration
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTEGRATION_PROFILING_H__
+#define __DALI_INTEGRATION_PROFILING_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+
+namespace Integration
+{
+
+enum ProfilingType
+{
+ PROFILING_TYPE_PAN_GESTURE,
+
+ PROFILING_TYPE_END
+};
+
+/**
+ * Called by adaptor to provide profiling information.
+ *
+ * @pre Should be called after Core creation.
+ * @param type The type of profiling information to output.
+ */
+DALI_IMPORT_API void EnableProfiling( ProfilingType type );
+
+} // namespace Integration
+
+} // namespace Dali
+
+#endif // __DALI_INTEGRATION_PROFILING_H__
void Core::Update( UpdateStatus& status )
{
// get the last delta and the predict when this update will be rendered
- float lastRenderDelta( 0.0f );
- unsigned int lastRenderTime( 0 );
- unsigned int nextRenderTime( 0 );
- mFrameTime->PredictNextRenderTime( lastRenderDelta, lastRenderTime, nextRenderTime );
+ float lastFrameDelta( 0.0f );
+ unsigned int lastVSyncTime( 0 );
+ unsigned int nextVSyncTime( 0 );
+ mFrameTime->PredictNextVSyncTime( lastFrameDelta, lastVSyncTime, nextVSyncTime );
// set the time delta so adaptor can easily print FPS with a release build with 0 as
// it is cached by frametime
- status.secondsFromLastFrame = lastRenderDelta;
+ status.secondsFromLastFrame = lastFrameDelta;
// Render returns true when there are updates on the stage or one or more animations are completed.
// Use the estimated time diff till we render as the elapsed time.
- status.keepUpdating = mUpdateManager->Update( lastRenderDelta, lastRenderTime, nextRenderTime );
+ status.keepUpdating = mUpdateManager->Update( lastFrameDelta, lastVSyncTime, nextVSyncTime );
// Check the Notification Manager message queue to set needsNotification
status.needsNotification = mNotificationManager->MessagesToProcess();
mRunning = true;
}
-void FrameTime::PredictNextRenderTime( float& lastFrameDeltaSeconds, unsigned int& lastRenderTimeMilliseconds, unsigned int& nextRenderTimeMilliseconds )
+void FrameTime::PredictNextVSyncTime( float& lastFrameDeltaSeconds, unsigned int& lastVSyncTimeMilliseconds, unsigned int& nextVSyncTimeMilliseconds )
{
if ( mRunning )
{
// Set the input variables
lastFrameDeltaSeconds = lastFrameDelta * MICROSECONDS_TO_SECONDS;
- lastRenderTimeMilliseconds = lastVSyncTime / MICROSECONDS_PER_MILLISECOND;
- nextRenderTimeMilliseconds = ( lastVSyncTime + timeTillNextRender ) / MICROSECONDS_PER_MILLISECOND;
+ lastVSyncTimeMilliseconds = lastVSyncTime / MICROSECONDS_PER_MILLISECOND;
+ nextVSyncTimeMilliseconds = ( lastVSyncTime + timeTillNextRender ) / MICROSECONDS_PER_MILLISECOND;
- DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: Frame: %u, Time: %u, NextTime: %u, LastDelta: %f\n", mLastUpdateFrameNumber, lastRenderTimeMilliseconds, nextRenderTimeMilliseconds, lastFrameDeltaSeconds );
+ DALI_LOG_INFO( gLogFilter, Debug::General, "FrameTime: Frame: %u, Time: %u, NextTime: %u, LastDelta: %f\n", mLastUpdateFrameNumber, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, lastFrameDeltaSeconds );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, " FramesInLastUpdate: %u, FramesTillNextVSync: %u\n", framesInLastUpdate, framesTillNextVSync );
}
}
/**
* Predicts when the next render time will occur.
*
- * @param[out] lastFrameDeltaSeconds The delta, in seconds (with float precision), between the last two renders.
- * @param[out] lastRenderTimeMilliseconds The time, in milliseconds, of the last render.
- * @param[out] nextRenderTimeMilliseconds The estimated time, in milliseconds, at the next render.
+ * @param[out] lastFrameDeltaSeconds The delta, in seconds (with float precision), between the last two renders.
+ * @param[out] lastVSyncTimeMilliseconds The time, in milliseconds, of the last VSync.
+ * @param[out] nextVSyncTimeMilliseconds The estimated time, in milliseconds, at the next VSync.
*
* @note Should only be called once per tick, from the update thread.
*/
- void PredictNextRenderTime( float& lastFrameDeltaSeconds, unsigned int& lastRenderTimeMilliseconds, unsigned int& nextRenderTimeMilliseconds );
+ void PredictNextVSyncTime( float& lastFrameDeltaSeconds, unsigned int& lastVSyncTimeMilliseconds, unsigned int& nextVSyncTimeMilliseconds );
// Called from VSync thread
return updateRequired;
}
+void GestureEventProcessor::EnablePanGestureProfiling()
+{
+ mPanGestureProcessor.EnableProfiling();
+}
+
} // namespace Internal
} // namespace Dali
*/
bool NeedsUpdate();
+ /**
+ * Called to provide pan-gesture profiling information.
+ */
+ void EnablePanGestureProfiling();
+
private:
// Undefined
}
}
+void PanGestureProcessor::EnableProfiling()
+{
+ mSceneObject->EnableProfiling();
+}
+
void PanGestureProcessor::UpdateDetection()
{
DALI_ASSERT_DEBUG(!mGestureDetectors.empty());
*/
void SetPanGestureProperties( const PanGesture& pan );
+ /**
+ * Called to provide pan-gesture profiling information.
+ */
+ void EnableProfiling();
+
private:
// Undefined
$(internal_src_dir)/update/dynamics/scene-graph-dynamics-world.cpp \
$(internal_src_dir)/update/modeling/internal-mesh-data.cpp \
$(internal_src_dir)/update/modeling/scene-graph-animatable-mesh.cpp \
+ $(internal_src_dir)/update/gestures/pan-gesture-profiling.cpp \
$(internal_src_dir)/update/gestures/scene-graph-pan-gesture.cpp \
$(internal_src_dir)/update/modeling/scene-graph-material.cpp \
$(internal_src_dir)/update/modeling/scene-graph-mesh.cpp \
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// CLASS HEADER
+#include <dali/internal/update/gestures/pan-gesture-profiling.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+void PanGestureProfiling::PrintData() const
+{
+ PrintData( mRawData, "RAW" );
+ PrintData( mLatestData, "LATEST" );
+ PrintData( mAveragedData, "AVERAGED" );
+}
+
+void PanGestureProfiling::PrintData( const PanPositionContainer& dataContainer, const char * const prefix ) const
+{
+ const PanPositionContainer::const_iterator endIter = dataContainer.end();
+ for ( PanPositionContainer::const_iterator iter = dataContainer.begin(); iter != endIter; ++iter )
+ {
+ DALI_LOG_UPDATE_STATUS( "%s, %u, %.2f, %.2f\n", prefix, iter->time, iter->position.x, iter->position.y );
+ }
+}
+
+void PanGestureProfiling::ClearData()
+{
+ mRawData.clear();
+ mLatestData.clear();
+ mAveragedData.clear();
+}
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_PAN_GESTURE_PROFILING_H__
+#define __DALI_INTERNAL_PAN_GESTURE_PROFILING_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <vector>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+struct PanGestureProfiling
+{
+ struct Position
+ {
+ Position( unsigned int time, Vector2 position )
+ : time( time ), position( position )
+ {
+ }
+
+ unsigned int time;
+ Vector2 position;
+ };
+
+ typedef std::vector< PanGestureProfiling::Position > PanPositionContainer;
+
+ void PrintData() const;
+
+ void PrintData( const PanPositionContainer& dataContainer, const char * const prefix ) const;
+
+ void ClearData();
+
+ PanPositionContainer mRawData;
+ PanPositionContainer mLatestData;
+ PanPositionContainer mAveragedData;
+};
+
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_PAN_GESTURE_PROFILING_H__
// EXTERNAL INCLUDES
// INTERNAL INCLUDES
+#include <dali/internal/update/gestures/pan-gesture-profiling.h>
namespace Dali
{
namespace
{
+
const unsigned int ARRAY_SIZE( 4u );
+
+const unsigned int UPDATES_BETWEEN_PRINT( 120u );
+unsigned int UPDATE_COUNT( 0u );
+
} // unnamed namespace
PanGesture* PanGesture::New()
PanGesture::~PanGesture()
{
+ delete mProfiling;
}
void PanGesture::AddGesture( const Dali::PanGesture& gesture )
mWritePosition %= ARRAY_SIZE;
}
-void PanGesture::UpdateProperties( unsigned int nextRenderTime )
+void PanGesture::UpdateProperties( unsigned int lastVSyncTime, unsigned int nextVSyncTime )
{
unsigned int time( 0u );
bool justStarted ( false );
{
const PanInfo& currentGesture = mGestures[mReadPosition];
+ if( mProfiling )
+ {
+ mProfiling->mRawData.push_back( PanGestureProfiling::Position( currentGesture.time, currentGesture.screen.position ) );
+ }
+
if ( currentGesture.time > time )
{
justStarted |= (currentGesture.state == Gesture::Started);
{
PanInfo gesture(mLatestGesture);
+ if( mProfiling )
+ {
+ mProfiling->mLatestData.push_back( PanGestureProfiling::Position( lastVSyncTime, gesture.screen.position ) );
+ }
+
if( !justStarted ) // only use previous frame if this is the continuing.
{
// If previous gesture exists, then produce position as 50/50 interpolated blend of these two points.
gesture.local.displacement -= mPreviousGesture.local.displacement;
}
+ if( mProfiling )
+ {
+ mProfiling->mAveragedData.push_back( PanGestureProfiling::Position( lastVSyncTime, gesture.screen.position ) );
+ }
+
mPreviousGesture = mLatestGesture;
mScreenPosition.Set( gesture.screen.position );
}
mInGesture &= ~justFinished;
+
+ if( mProfiling &&
+ UPDATE_COUNT++ >= UPDATES_BETWEEN_PRINT )
+ {
+ mProfiling->PrintData();
+ mProfiling->ClearData();
+ UPDATE_COUNT = 0u;
+ }
}
const GesturePropertyVector2& PanGesture::GetScreenPositionProperty() const
return mLocalDisplacement;
}
+void PanGesture::EnableProfiling()
+{
+ if( !mProfiling )
+ {
+ mProfiling = new PanGestureProfiling();
+ }
+}
+
void PanGesture::ResetDefaultProperties( BufferIndex updateBufferIndex )
{
mScreenPosition.Reset();
: mGestures(),
mWritePosition( 0 ),
mReadPosition( 0 ),
- mInGesture( false )
+ mInGesture( false ),
+ mProfiling( NULL )
{
}
namespace Internal
{
+struct PanGestureProfiling;
+
namespace SceneGraph
{
/**
* Called by the update manager so that we can update the value of our properties.
- * @param[in] nextRenderTime The estimated time of the next render (in milliseconds).
+ * @param[in] lastVSyncTime The last VSync time (in milliseconds).
+ * @param[in] nextVSyncTime The estimated time of the next VSync (in milliseconds).
*/
- virtual void UpdateProperties( unsigned int nextRenderTime );
+ virtual void UpdateProperties( unsigned int lastVSyncTime, unsigned int nextVSyncTime );
/**
* Retrieves a reference to the screen position property.
*/
const GesturePropertyVector2& GetLocalDisplacementProperty() const;
+ /**
+ * Called to provide pan-gesture profiling information.
+ */
+ void EnableProfiling();
+
private:
/**
PanInfo mLatestGesture; ///< The latest gesture. (this update frame)
PanInfo mPreviousGesture; ///< The previous gesture. (one update frame ago)
bool mInGesture; ///< True if the gesture is currently being handled i.e. between Started <-> Finished/Cancelled
+
+ PanGestureProfiling* mProfiling; ///< NULL unless pan-gesture profiling information is required.
};
} // namespace SceneGraph
PERF_MONITOR_END(PerformanceMonitor::RESET_PROPERTIES);
}
-void UpdateManager::ProcessGestures( unsigned int nextRenderTime )
+void UpdateManager::ProcessGestures( unsigned int lastVSyncTime, unsigned int nextVSyncTime )
{
// constrain gestures... (in construction order)
GestureContainer& gestures = mImpl->gestures;
for ( GestureIter iter = gestures.Begin(), endIter = gestures.End(); iter != endIter; ++iter )
{
PanGesture& gesture = **iter;
- gesture.UpdateProperties( nextRenderTime );
+ gesture.UpdateProperties( lastVSyncTime, nextVSyncTime );
}
}
}
}
-unsigned int UpdateManager::Update( float elapsedSeconds, unsigned int lastRenderTime, unsigned int nextRenderTime )
+unsigned int UpdateManager::Update( float elapsedSeconds, unsigned int lastVSyncTime, unsigned int nextVSyncTime )
{
PERF_MONITOR_END(PerformanceMonitor::FRAME_RATE); // Mark the End of the last frame
PERF_MONITOR_NEXT_FRAME(); // Prints out performance info for the last frame (if enabled)
{
// 6) Process Touches & Gestures
mImpl->touchResampler.Update();
- ProcessGestures( nextRenderTime );
+ ProcessGestures( lastVSyncTime, nextVSyncTime );
// 7) Animate
Animate( elapsedSeconds );
/**
* Performs an Update traversal on the scene-graph.
* @param[in] elapsedSeconds The elapsed time that should be applied to animations.
- * @param[in] lastRenderTime The last time, in milliseconds, that we rendered.
- * @param[in] nextRenderTime The estimated time, in milliseconds, of the next render.
+ * @param[in] lastVSyncTime The last time, in milliseconds, that we had a VSync.
+ * @param[in] nextVSyncTime The estimated time, in milliseconds, of the next VSync.
* @return True if further updates are required e.g. during animations.
*/
- unsigned int Update( float elapsedSeconds, unsigned int lastRenderTime, unsigned int nextRenderTime );
+ unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTime, unsigned int nextVSyncTime );
/**
* Set the background color i.e. the glClear color used at the beginning of each frame.
/**
* Perform gesture updates.
- * @param[in] nextRenderTime The estimated time of the next render.
+ * @param[in] lastVSyncTime The last VSync time.
+ * @param[in] nextVSyncTime The estimated time of the next VSync.
*/
- void ProcessGestures( unsigned int nextRenderTime );
+ void ProcessGestures( unsigned int lastVSyncTime, unsigned int nextVSyncTime );
/**
* Perform animation updates