X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fimage-loader%2Floading-task.cpp;h=5cbd16b50c67b49ba8a2f4b1f08f12dc6c0b76be;hb=HEAD;hp=e81b16f6d887cf1e05ba94631eb616b5177e3cae;hpb=bd552c2e346bf4c0993c443a30e2fc0a07986c3b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/image-loader/loading-task.cpp b/dali-toolkit/internal/image-loader/loading-task.cpp index e81b16f..5cbd16b 100644 --- a/dali-toolkit/internal/image-loader/loading-task.cpp +++ b/dali-toolkit/internal/image-loader/loading-task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,21 +16,44 @@ */ // CLASS HEADER -#include "loading-task.h" +#include // EXTERNAL INCLUDES #include #include #include #include +#include #include +#ifdef TRACE_ENABLED +#include +#include +#include +#include +#endif + namespace Dali { namespace Toolkit { namespace Internal { +namespace +{ +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_IMAGE_PERFORMANCE_MARKER, false); + +#ifdef TRACE_ENABLED +uint64_t GetNanoseconds() +{ + // Get the time of a monotonic clock since its epoch. + auto epoch = std::chrono::steady_clock::now().time_since_epoch(); + auto duration = std::chrono::duration_cast(epoch); + return static_cast(duration.count()); +} +#endif +} // namespace + LoadingTask::LoadingTask(uint32_t id, Dali::AnimatedImageLoading animatedImageLoading, uint32_t frameIndex, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, CallbackBase* callback) : AsyncTask(callback), url(), @@ -148,6 +171,19 @@ LoadingTask::~LoadingTask() void LoadingTask::Process() { +#ifdef TRACE_ENABLED + uint64_t mStartTimeNanoSceonds = 0; + uint64_t mEndTimeNanoSceonds = 0; + if(gTraceFilter && gTraceFilter->IsTraceEnabled()) + { + mStartTimeNanoSceonds = GetNanoseconds(); + std::ostringstream oss; + oss << "[u:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetEllipsedUrl()) << "]"; + // DALI_TRACE_BEGIN(gTraceFilter, "DALI_IMAGE_LOADING_TASK"); ///< TODO : Open it if we can control trace log level + DALI_LOG_RELEASE_INFO("BEGIN: DALI_IMAGE_LOADING_TASK %s", oss.str().c_str()); + } +#endif + isReady = false; if(!isMaskTask) { @@ -159,6 +195,28 @@ void LoadingTask::Process() } MultiplyAlpha(); isReady = true; + +#ifdef TRACE_ENABLED + if(gTraceFilter && gTraceFilter->IsTraceEnabled()) + { + mEndTimeNanoSceonds = GetNanoseconds(); + std::ostringstream oss; + oss << std::fixed << std::setprecision(3); + oss << "["; + oss << "d:" << static_cast(mEndTimeNanoSceonds - mStartTimeNanoSceonds) / 1000000.0f << "ms "; + oss << "m:" << isMaskTask << " "; + oss << "i:" << frameIndex << " "; + oss << "b:" << pixelBuffers.size() << " "; + if(!pixelBuffers.empty()) + { + oss << "s:" << pixelBuffers[0].GetWidth() << "x" << pixelBuffers[0].GetHeight() << " "; + oss << "p:" << pixelBuffers[0].IsAlphaPreMultiplied() << " "; + } + oss << "u:" << (!!(animatedImageLoading) ? animatedImageLoading.GetUrl() : url.GetEllipsedUrl()) << "]"; + // DALI_TRACE_END(gTraceFilter, "DALI_IMAGE_LOADING_TASK"); ///< TODO : Open it if we can control trace log level + DALI_LOG_RELEASE_INFO("END: DALI_IMAGE_LOADING_TASK %s", oss.str().c_str()); + } +#endif } bool LoadingTask::IsReady() @@ -176,6 +234,9 @@ void LoadingTask::Load() else if(encodedImageBuffer) { pixelBuffer = Dali::LoadImageFromBuffer(encodedImageBuffer.GetRawBuffer(), dimensions, fittingMode, samplingMode, orientationCorrection); + + // We don't need to hold image buffer anymore. + encodedImageBuffer.Reset(); } else if(url.IsValid() && url.IsLocalResource()) {