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()
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;
{
return;
}
- DALI_LOG_RESOURCE("[DELBUF] Deleting pixel buffer for Bitmap %p at address %p.\n", this, mData);
delete [] mData;
mData = NULL;
}
*/
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
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();
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);
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);
}
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"
{
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
* @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.
#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)
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 );
}
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 );
}
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)
{
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;
}
}