From 1d3807d7a6de70c09a41734913daecffb172a3ab Mon Sep 17 00:00:00 2001 From: Richard Underhill Date: Mon, 10 Mar 2014 10:46:09 +0000 Subject: [PATCH] Removed legacy resource tracking / logging [Issue#] N/A [Problem] [Cause] [Solution] Change-Id: Ia957b8c40aff77b15ee53e681a09a3dcd4d17d04 Signed-off-by: Richard Underhill --- .../dali-test-suite-utils/test-application.h | 6 +- dali/integration-api/bitmap.cpp | 1 - dali/integration-api/debug.cpp | 68 ++-------------------- dali/integration-api/debug.h | 42 +------------ .../render/gl-resources/bitmap-texture.cpp | 2 - .../gl-resources/compressed-bitmap-texture.cpp | 2 - .../render/gl-resources/frame-buffer-texture.cpp | 2 - dali/internal/render/gl-resources/texture.cpp | 2 - 8 files changed, 7 insertions(+), 118 deletions(-) diff --git a/automated-tests/dali-test-suite-utils/test-application.h b/automated-tests/dali-test-suite-utils/test-application.h index e7cc8ac..720248a 100644 --- a/automated-tests/dali-test-suite-utils/test-application.h +++ b/automated-tests/dali-test-suite-utils/test-application.h @@ -90,8 +90,7 @@ public: mCore->SetDpi( mDpi.x, mDpi.y ); Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); - unsigned int logOpts = Dali::Integration::Log::ParseLogOptions(""); - Dali::Integration::Log::InstallLogFunction(logFunction, logOpts); + Dali::Integration::Log::InstallLogFunction(logFunction); } virtual ~TestApplication() @@ -113,9 +112,6 @@ public: case Dali::Integration::Log::DebugError: tet_printf("ERROR: %s", message.c_str()); break; - case Dali::Integration::Log::DebugResources: - tet_printf("INFO: %s", message.c_str()); - break; default: tet_printf("DEFAULT: %s", message.c_str()); break; diff --git a/dali/integration-api/bitmap.cpp b/dali/integration-api/bitmap.cpp index ca0f50a..93dc10e 100644 --- a/dali/integration-api/bitmap.cpp +++ b/dali/integration-api/bitmap.cpp @@ -308,7 +308,6 @@ void Bitmap::DeletePixelBuffer() { return; } - DALI_LOG_RESOURCE("[DELBUF] Deleting pixel buffer for Bitmap %p at address %p.\n", this, mData); delete [] mData; mData = NULL; } diff --git a/dali/integration-api/debug.cpp b/dali/integration-api/debug.cpp index 0cfb179..14148d9 100644 --- a/dali/integration-api/debug.cpp +++ b/dali/integration-api/debug.cpp @@ -93,14 +93,12 @@ typedef LogFunction* LogFunctionPtr; ///< LogFunction pointer */ struct ThreadLocalLogging { - ThreadLocalLogging(LogFunction func, unsigned int opts) - :function(func), - logOptions(opts) + ThreadLocalLogging(LogFunction func) + :function(func) { } LogFunction function; - unsigned int logOptions; }; #ifndef EMSCRIPTEN // single threaded @@ -113,59 +111,6 @@ std::auto_ptr threadLocal; std::string FormatToString(const char *format, ...); std::string ArgListToString(const char *format, va_list args); -unsigned int ParseLogOptions (const char* logOptString) -{ - unsigned int ret = LogNone; - if (logOptString == NULL) - { - // environment variable was not set, turn on logging for all threads by default - ret |= LogEventThread; - ret |= LogUpdateThread; - ret |= LogRenderThread; - ret |= LogResourceThreads; - } - else - { - std::string setting(logOptString); - if (!setting.compare(DALI_LOG_OFF)) - { - // leave as "LogNone" - } - else if (!setting.compare(DALI_LOG_EVENT_THREAD)) - { - ret |= LogEventThread; - } - else if (!setting.compare(DALI_LOG_UPDATE_THREAD)) - { - ret |= LogUpdateThread; - } - else if (!setting.compare(DALI_LOG_RENDER_THREAD)) - { - ret |= LogRenderThread; - } - else if (!setting.compare(DALI_LOG_RESOURCE_THREADS)) - { - ret |= LogResourceThreads; - } - else if (!setting.compare(DALI_LOG_ALL_THREADS)) - { - ret |= LogEventThread; - ret |= LogUpdateThread; - ret |= LogRenderThread; - ret |= LogResourceThreads; - } - else if (!setting.compare(DALI_LOG_RESOURCE_LIFETIME)) - { - ret |= LogEventThread; - ret |= LogUpdateThread; - ret |= LogRenderThread; - ret |= LogResourceThreads; - ret |= LogResourceLifetime; - } - } - return ret; -} - void LogMessage(DebugPriority priority, const char* format, ...) { ThreadLocalLogging* threadLogging = threadLocal.get(); @@ -180,11 +125,6 @@ void LogMessage(DebugPriority priority, const char* format, ...) return; } - // avoid string operations and function call if trying to log resources when not requested - if (priority == DebugResources && !(threadLogging->logOptions & LogResourceLifetime)) - { - return; - } va_list arg; va_start(arg, format); std::string message = ArgListToString(format, arg); @@ -193,12 +133,12 @@ void LogMessage(DebugPriority priority, const char* format, ...) logfunction(priority,message); } -void InstallLogFunction(const LogFunction& logFunction, unsigned int logOpts) +void InstallLogFunction(const LogFunction& logFunction) { // TLS stores a pointer to an object. // It needs to be allocated on the heap, because TLS will destroy it when the thread exits. - ThreadLocalLogging* logStruct = new ThreadLocalLogging(logFunction, logOpts); + ThreadLocalLogging* logStruct = new ThreadLocalLogging(logFunction); threadLocal.reset(logStruct); } diff --git a/dali/integration-api/debug.h b/dali/integration-api/debug.h index 5d50e18..696b611 100644 --- a/dali/integration-api/debug.h +++ b/dali/integration-api/debug.h @@ -43,17 +43,6 @@ namespace Integration namespace Log { -// environment variable for enabling/disabling logging in different threads -#define DALI_ENV_ENABLE_LOG "DALI_ENABLE_LOG" -// values of the environment variable -#define DALI_LOG_OFF "FALSE" ///< disable log messages from all threads. Do not log resource creation / destruction -#define DALI_LOG_EVENT_THREAD "EVENT" ///< enable log messages from event thread. Do not log resource creation / destruction -#define DALI_LOG_UPDATE_THREAD "UPDATE" ///< enable log messages from update thread. Do not log resource creation / destruction -#define DALI_LOG_RENDER_THREAD "RENDER" ///< enable log messages from render thread. Do not log resource creation / destruction -#define DALI_LOG_RESOURCE_THREADS "RESOURCE_LOADER" ///< enable log messages from render thread. Do not log resource creation / destruction -#define DALI_LOG_ALL_THREADS "ALL" ///< enable log messages from all threads. Do not log resource creation / destruction -#define DALI_LOG_RESOURCE_LIFETIME "RESOURCE_LOG" ///< log resource creation / destruction. Enables logging on all threads. - // environment variable for enabling/disabling fps tracking #define DALI_ENV_FPS_TRACKING "DALI_FPS_TRACKING" @@ -64,32 +53,10 @@ enum DebugPriority { DebugInfo, DebugWarning, - DebugError, - DebugResources -}; - -/** - * Control logging in separate threads. - * If DEBUG_ENABLED macro is not defined, only errors and resource lifetime messages are logged. - */ -enum LoggingOptions -{ - LogNone = 0, - LogEventThread = 1 << 0, - LogUpdateThread = 1 << 1, - LogRenderThread = 1 << 2, - LogResourceThreads = 1 << 3, - LogResourceLifetime = 1 << 4 + DebugError }; /** - * Return log settings (bitfield) based on the value set in environment - * @param[in] setting the string contained in DALI_ENABLE_LOG env. variable (or NULL if not set) - * @return a bitfield with all the relevant LoggingOptions values set - */ -DALI_IMPORT_API unsigned int ParseLogOptions (const char* setting); - -/** * Used by logging macros to log a message along with function/class name * @param level debug level * @param format string format @@ -108,7 +75,7 @@ typedef void (*LogFunction)(DebugPriority priority, std::string& message); * @param logFunction the log function to install * @param logOpts the log options to save in thread */ -DALI_IMPORT_API void InstallLogFunction(const LogFunction& logFunction, unsigned int logOpts); +DALI_IMPORT_API void InstallLogFunction(const LogFunction& logFunction); /** * A log function has to be uninstalled for every thread that wants to use logging. @@ -128,11 +95,6 @@ DALI_IMPORT_API void UninstallLogFunction(); #define DALI_LOG_ERROR_NOFN(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, format, ## args) /** - * Provides unfiltered logging for resource usage - */ -#define DALI_LOG_RESOURCE(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugResources, format, ## args) - -/** * Provides unfiltered logging for fps monitor */ #define DALI_LOG_FPS(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) diff --git a/dali/internal/render/gl-resources/bitmap-texture.cpp b/dali/internal/render/gl-resources/bitmap-texture.cpp index fa3a487..9481dba 100644 --- a/dali/internal/render/gl-resources/bitmap-texture.cpp +++ b/dali/internal/render/gl-resources/bitmap-texture.cpp @@ -223,8 +223,6 @@ void BitmapTexture::AssignBitmap( bool generateTexture, const unsigned char* pix mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - DALI_LOG_RESOURCE("[UPLOAD] Uploaded image data from Bitmap %p to Texture %d - size %d bytes (%dx%d)\n", - mBitmap.Get(), mId, Pixel::GetBytesPerPixel(mPixelFormat)*mWidth*mHeight, mWidth, mHeight); INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, GetBytesPerPixel(mPixelFormat) * mWidth * mHeight ); } diff --git a/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp b/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp index 1f35368..06ea66a 100644 --- a/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp +++ b/dali/internal/render/gl-resources/compressed-bitmap-texture.cpp @@ -98,8 +98,6 @@ void CompressedBitmapTexture::AssignBitmap( bool generateTexture, const unsigned mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); mContext.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - DALI_LOG_RESOURCE("[UPLOAD] Uploaded image data from Bitmap %p to Texture %d - size %d bytes (%dx%d)\n", - mBitmap.Get(), mId, bufferSize, mWidth, mHeight); INCREASE_BY( PerformanceMonitor::TEXTURE_DATA_UPLOADED, bufferSize ); } diff --git a/dali/internal/render/gl-resources/frame-buffer-texture.cpp b/dali/internal/render/gl-resources/frame-buffer-texture.cpp index 58495e0..84f7007 100644 --- a/dali/internal/render/gl-resources/frame-buffer-texture.cpp +++ b/dali/internal/render/gl-resources/frame-buffer-texture.cpp @@ -113,8 +113,6 @@ bool FrameBufferTexture::CreateGlTexture() Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat); mContext.TexImage2D(GL_TEXTURE_2D, 0, pixelFormat,mWidth, mHeight, 0, pixelFormat, pixelDataType, NULL); - DALI_LOG_RESOURCE("[UPLOAD] Allocated memory for FrameBufferTexture %p GL Texture %d - size %d bytes (%dx%d)\n", - this, mId, Pixel::GetBytesPerPixel(mPixelFormat)*mWidth*mHeight, mWidth, mHeight); if (!mFrameBufferName) { diff --git a/dali/internal/render/gl-resources/texture.cpp b/dali/internal/render/gl-resources/texture.cpp index ed25059..aac69f4 100644 --- a/dali/internal/render/gl-resources/texture.cpp +++ b/dali/internal/render/gl-resources/texture.cpp @@ -109,8 +109,6 @@ void Texture::GlCleanup() if (mId != 0) { mContext.DeleteTextures(1,&mId); - DALI_LOG_RESOURCE("[DELTEXTURE] Freed image data memory for Texture %u - (%dx%d)\n", - mId, mWidth, mHeight); mId = 0; } } -- 2.7.4