// EXTERNAL INCLUDES
// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
#include <dali/internal/event/animation/animation-playlist.h>
#include <dali/internal/event/animation/animator-connector.h>
#include <dali/internal/event/animation/key-frames-impl.h>
namespace
{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
#if defined(DEBUG_ENABLED)
Debug::Filter* gAnimFilter = Debug::Filter::New(Debug::NoLogging, false, "DALI_LOG_ANIMATION");
#endif
static constexpr std::string_view ACTION_STOP = "stop";
static constexpr std::string_view ACTION_PAUSE = "pause";
+#if defined(DEBUG_ENABLED) || defined(TRACE_ENABLED)
+// clang-format off
+#define GET_ANIMATION_INTERNAL_STATE_STRING(internalState) \
+ internalState == Animation::InternalState::STOPPED ? "STOPPED" : \
+ internalState == Animation::InternalState::PLAYING ? "PLAYING" : \
+ internalState == Animation::InternalState::PAUSED ? "PAUSED" : \
+ internalState == Animation::InternalState::CLEARED ? "CLEARED" : \
+ internalState == Animation::InternalState::STOPPING ? "STOPPING" : \
+ internalState == Animation::InternalState::PLAYING_DURING_STOPPING ? "PLAYING_DURING_STOPPING" : \
+ internalState == Animation::InternalState::PAUSED_DURING_STOPPING ? "PAUSED_DURING_STOPPING" : \
+ "Unknown"
+
+#define GET_ANIMATION_STATE_STRING(state) \
+ state == Dali::Animation::State::STOPPED ? "STOPPED" : \
+ state == Dali::Animation::State::PLAYING ? "PLAYING" : \
+ state == Dali::Animation::State::PAUSED ? "PAUSED" : \
+ "Unknown"
+
+#define GET_ANIMATION_END_ACTION_STRING(endAction) \
+ endAction == Dali::Animation::EndAction::BAKE ? "BAKE" : \
+ endAction == Dali::Animation::EndAction::DISCARD ? "DISCARD" : \
+ endAction == Dali::Animation::EndAction::BAKE_FINAL ? "BAKE_FINAL" : \
+ "Unknown"
+// clang-format on
+
+#if defined(TRACE_ENABLED)
+// DevNote : Use trace marker to print logs at release mode.
+#define DALI_LOG_ANIMATION_INFO(format, ...) \
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled()) \
+ { \
+ DALI_LOG_DEBUG_INFO(format, ##__VA_ARGS__); \
+ } \
+ DALI_LOG_INFO(gAnimFilter, Debug::Verbose, format, ##__VA_ARGS__)
+#else
+#define DALI_LOG_ANIMATION_INFO(format, ...) \
+ DALI_LOG_INFO(gAnimFilter, Debug::Verbose, format, ##__VA_ARGS__)
+#endif
+#else
+#define DALI_LOG_ANIMATION_INFO(format, ...)
+#endif
+
BaseHandle Create()
{
return Dali::Animation::New(0.f);
* @param[in] targetState The target state of the animation.
* @return True if the animation state has been changed.
*/
-bool InternalStateConverter(Internal::Animation::InternalState& currentState, Dali::Animation::State targetState)
+bool InternalStateConverter(uint32_t animationId, Internal::Animation::InternalState& currentState, Dali::Animation::State targetState)
{
bool changed = false;
+ DALI_LOG_ANIMATION_INFO("Animation[%u] state change %s -> %s\n", animationId, GET_ANIMATION_INTERNAL_STATE_STRING(currentState), GET_ANIMATION_STATE_STRING(targetState));
switch(targetState)
{
case Dali::Animation::PLAYING:
// Set id of scene graph animation
mAnimationId = mAnimation->GetNotifyId();
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Created\n", mAnimationId);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Created\n", mAnimationId);
OwnerPointer<SceneGraph::Animation> transferOwnership(const_cast<SceneGraph::Animation*>(mAnimation));
AddAnimationMessage(GetEventThreadServices().GetUpdateManager(), transferOwnership);
// Remove mapping infomations
mPlaylist.UnmapNotifier(mAnimation);
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Destroyed\n", mAnimationId);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Destroyed\n", mAnimationId);
// Remove animation using a message to the update manager
RemoveAnimationMessage(GetEventThreadServices().GetUpdateManager(), *mAnimation);
}
mDurationSeconds = seconds;
+ DALI_LOG_ANIMATION_INFO("Animation[%u] SetDuration %f (s)\n", mDurationSeconds);
// mAnimation is being used in a separate thread; queue a message to set the value
SetDurationMessage(GetEventThreadServices(), *mAnimation, seconds);
void Animation::SetLoopCount(int32_t count)
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] SetLoopCount[%d]\n", mAnimationId, count);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] SetLoopCount[%d]\n", mAnimationId, count);
// Cache for public getters
mLoopCount = count;
void Animation::SetEndAction(EndAction action)
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] SetEndAction[%d]\n", mAnimationId, static_cast<int>(action));
+ DALI_LOG_ANIMATION_INFO("Animation[%u] SetEndAction[%s]\n", mAnimationId, GET_ANIMATION_END_ACTION_STRING(action));
// Cache for public getters
mEndAction = action;
void Animation::Play()
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Play() connectors : %zu, internal state : %d\n", mAnimationId, mConnectors.Count(), static_cast<int>(mState));
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Play() connectors : %zu, internal state : %s\n", mAnimationId, mConnectors.Count(), GET_ANIMATION_INTERNAL_STATE_STRING(mState));
// Update the current playlist
mPlaylist.OnPlay(*this);
- InternalStateConverter(mState, Dali::Animation::PLAYING);
+ InternalStateConverter(GetAnimationId(), mState, Dali::Animation::PLAYING);
NotifyObjects(Notify::USE_TARGET_VALUE);
{
if(progress >= mPlayRange.x && progress <= mPlayRange.y)
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] PlayFrom(%f) connectors : %zu, internal state : %d\n", mAnimationId, progress, mConnectors.Count(), static_cast<int>(mState));
+ DALI_LOG_ANIMATION_INFO("Animation[%u] PlayFrom(%f) connectors : %zu, internal state : %s\n", mAnimationId, progress, mConnectors.Count(), GET_ANIMATION_INTERNAL_STATE_STRING(mState));
// Update the current playlist
mPlaylist.OnPlay(*this);
- InternalStateConverter(mState, Dali::Animation::PLAYING);
+ InternalStateConverter(GetAnimationId(), mState, Dali::Animation::PLAYING);
NotifyObjects(Notify::USE_TARGET_VALUE);
mDelaySeconds = delaySeconds;
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] PlayAfter(%f) connectors : %zu, internal state : %d\n", mAnimationId, mDelaySeconds, mConnectors.Count(), static_cast<int>(mState));
+ DALI_LOG_ANIMATION_INFO("Animation[%u] PlayAfter(%f) connectors : %zu, internal state : %s\n", mAnimationId, mDelaySeconds, mConnectors.Count(), GET_ANIMATION_INTERNAL_STATE_STRING(mState));
// Update the current playlist
mPlaylist.OnPlay(*this);
- InternalStateConverter(mState, Dali::Animation::PLAYING);
+ InternalStateConverter(GetAnimationId(), mState, Dali::Animation::PLAYING);
NotifyObjects(Notify::USE_TARGET_VALUE);
void Animation::Pause()
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Pause() internal state : %d\n", mAnimationId, static_cast<int>(mState));
- if(InternalStateConverter(mState, Dali::Animation::PAUSED))
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Pause() internal state : %s\n", mAnimationId, GET_ANIMATION_INTERNAL_STATE_STRING(mState));
+ if(InternalStateConverter(GetAnimationId(), mState, Dali::Animation::PAUSED))
{
// mAnimation is being used in a separate thread; queue a Pause message
PauseAnimationMessage(GetEventThreadServices(), *mAnimation);
void Animation::Stop()
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Stop() internal state : %d\n", mAnimationId, static_cast<int>(mState));
- if(InternalStateConverter(mState, Dali::Animation::STOPPED))
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Stop() internal state : %s\n", mAnimationId, GET_ANIMATION_INTERNAL_STATE_STRING(mState));
+ if(InternalStateConverter(GetAnimationId(), mState, Dali::Animation::STOPPED))
{
// mAnimation is being used in a separate thread; queue a Stop message
StopAnimationMessage(GetEventThreadServices().GetUpdateManager(), *mAnimation);
{
DALI_ASSERT_DEBUG(mAnimation);
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Clear() connectors : %zu, internal state : %d\n", mAnimationId, mConnectors.Count(), static_cast<int>(mState));
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Clear() connectors : %zu, internal state : %d\n", mAnimationId, mConnectors.Count(), GET_ANIMATION_INTERNAL_STATE_STRING(mState));
if(mConnectors.Empty() && mState == Dali::Internal::Animation::CLEARED)
{
const int32_t playedCount(mAnimation->GetPlayedCount());
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] HasFinished() count : %d -> %d, internal state : %d\n", mAnimationId, mNotificationCount, playedCount, static_cast<int>(mState));
+ DALI_LOG_ANIMATION_INFO("Animation[%u] HasFinished() count : %d -> %d, internal state : %s\n", mAnimationId, mNotificationCount, playedCount, GET_ANIMATION_INTERNAL_STATE_STRING(mState));
if(playedCount > mNotificationCount)
{
mNotificationCount = playedCount;
}
}
+ DALI_LOG_ANIMATION_INFO("Animation[%u] internal state : %s. Finished? %d\n", mAnimationId, GET_ANIMATION_INTERNAL_STATE_STRING(mState), hasFinished);
return hasFinished;
}
void Animation::EmitSignalFinish()
{
+ DALI_LOG_ANIMATION_INFO("Animation[%u] EmitSignalFinish(), signal count : %zu, internal state : %s\n", mAnimationId, mFinishedSignal.GetConnectionCount(), GET_ANIMATION_INTERNAL_STATE_STRING(mState));
if(!mFinishedSignal.Empty())
{
Dali::Animation handle(this);
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] EmitSignalFinish(), internal state : %d\n", mAnimationId, static_cast<int>(mState));
mFinishedSignal.Emit(handle);
}
}
if(DALI_UNLIKELY(mConnectorTargetValues.size() % WARNING_PRINT_THRESHOLD == 0))
{
- DALI_LOG_WARNING("Animation[%u] Connect %zu Animators! Please check you might append too much items.\n", mAnimationId, mConnectorTargetValues.size());
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Connect %zu Animators! Please check you might append too much items.\n", mAnimationId, mConnectorTargetValues.size());
}
}
Debug::Filter* gAnimFilter = Debug::Filter::New(Debug::NoLogging, false, "DALI_LOG_ANIMATION");
#endif
+#if defined(DEBUG_ENABLED) || defined(TRACE_ENABLED)
+
+#if defined(TRACE_ENABLED)
+// DevNote : Use trace marker to print logs at release mode.
+#define DALI_LOG_ANIMATION_INFO(format, ...) \
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled()) \
+ { \
+ DALI_LOG_DEBUG_INFO(format, ##__VA_ARGS__); \
+ } \
+ DALI_LOG_INFO(gAnimFilter, Debug::Verbose, format, ##__VA_ARGS__)
+#else
+#define DALI_LOG_ANIMATION_INFO(format, ...) \
+ DALI_LOG_INFO(gAnimFilter, Debug::Verbose, format, ##__VA_ARGS__)
+#endif
+#else
+#define DALI_LOG_ANIMATION_INFO(format, ...)
+#endif
+
#ifdef TRACE_ENABLED
uint64_t GetNanoseconds()
{
mPlaylist.erase(iter);
}
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "OnClear(%d) Animation[%u]\n", ignoreRequired, animation.GetAnimationId());
+ DALI_LOG_ANIMATION_INFO("OnClear(%d) Animation[%u]\n", ignoreRequired, animation.GetAnimationId());
if(ignoreRequired)
{
{
if(mIgnoredAnimations.size() > 0u)
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Ignored animations count[%zu]\n", mIgnoredAnimations.size());
+ DALI_LOG_ANIMATION_INFO("Ignored animations count[%zu]\n", mIgnoredAnimations.size());
mIgnoredAnimations.clear();
}
}
for(const auto& notifierId : notifierIdList)
{
+ DALI_LOG_ANIMATION_INFO("Animation[%u] notified.\n", notifierId);
if(DALI_LIKELY(mIgnoredAnimations.find(notifierId) == mIgnoredAnimations.end()))
{
auto* animation = GetEventObject(notifierId);
}
else
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] not finished actually...\n", notifierId);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] not finished actually...\n", notifierId);
}
}
else
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] destroyed!!\n", notifierId);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] destroyed!!\n", notifierId);
}
}
else
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Ignored (Clear() called)\n", notifierId);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Ignored (Clear() called)\n", notifierId);
}
}
}
else
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] Ignored (Clear() called)\n", animation.GetAnimationId());
+ DALI_LOG_ANIMATION_INFO("Animation[%u] Ignored (Clear() called)\n", animation.GetAnimationId());
}
}
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
#include <dali/internal/common/memory-pool-object-allocator.h>
#include <dali/internal/render/common/performance-monitor.h>
#include <dali/public-api/math/math-utils.h>
namespace // Unnamed namespace
{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
#if defined(DEBUG_ENABLED)
Debug::Filter* gAnimFilter = Debug::Filter::New(Debug::NoLogging, false, "DALI_LOG_ANIMATION");
#endif
+#if defined(DEBUG_ENABLED) || defined(TRACE_ENABLED)
+
+#if defined(TRACE_ENABLED)
+// DevNote : Use trace marker to print logs at release mode.
+#define DALI_LOG_ANIMATION_INFO(format, ...) \
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled()) \
+ { \
+ DALI_LOG_DEBUG_INFO(format, ##__VA_ARGS__); \
+ } \
+ DALI_LOG_INFO(gAnimFilter, Debug::Verbose, format, ##__VA_ARGS__)
+#else
+#define DALI_LOG_ANIMATION_INFO(format, ...) \
+ DALI_LOG_INFO(gAnimFilter, Debug::Verbose, format, ##__VA_ARGS__)
+#endif
+#else
+#define DALI_LOG_ANIMATION_INFO(format, ...)
+#endif
+
// Memory pool used to allocate new animations. Memory used by this pool will be released when shutting down DALi
Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::Animation>& GetAnimationMemoryPool()
{
{
if(mState == Playing)
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] with duration %f ms Pause (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] with duration %f ms Pause (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
mState = Paused;
}
}
void Animation::SetAnimatorsActive(bool active)
{
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] with duration %f ms %s (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, active ? "Play" : "Stop", "SRPD"[mState]);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] with duration %f ms %s (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, active ? "Play" : "Stop", "SRPD"[mState]);
for(auto&& item : mAnimators)
{
item->SetActive(active);
if(mEndAction != Dali::Animation::DISCARD)
{
Bake(bufferIndex, mEndAction);
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] with duration %f ms Stop (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] with duration %f ms Stop (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
// Animators are automatically set to inactive in Bake
}
mPlayedCount = 0;
mCurrentLoop = 0;
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] with duration %f ms Clear (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] with duration %f ms Clear (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
}
void Animation::OnDestroy(BufferIndex bufferIndex)
}
}
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] with duration %f ms Destroy (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
+ DALI_LOG_ANIMATION_INFO("Animation[%u] with duration %f ms Destroy (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
mIsStopped = false; ///< Do not make notify.
mState = Destroyed;
{
DALI_ASSERT_DEBUG(mCurrentLoop == mLoopCount);
finished = true;
- DALI_LOG_INFO(gAnimFilter, Debug::Verbose, "Animation[%u] with duration %f ms Finished (before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, "SRPD"[mState]);
// The animation has now been played to completion
++mPlayedCount;
+ DALI_LOG_ANIMATION_INFO("Animation[%u] with duration %f ms Finished (playcount:%d)(before state : %c)\n", GetNotifyId(), mDurationSeconds * 1000.0f, mPlayedCount, "SRPD"[mState]);
+
// Make elapsed second as edge of range forcely.
mElapsedSeconds = edgeRangeSeconds + signSpeedFactor * Math::MACHINE_EPSILON_10;
UpdateAnimators(bufferIndex, finished && (mEndAction != Dali::Animation::DISCARD), finished);