X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fdebug.cpp;h=26248187400e395c3198800d6e0ccee8c2cacc75;hb=94247a4aedeee1f04791586fdae8bca9da682969;hp=dd62a17e8b0462719f1b05b1946eee918b56f201;hpb=7e14935f42dc79f6b8239b0301078d004d3ebaba;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/integration-api/debug.cpp b/dali/integration-api/debug.cpp index dd62a17..2624818 100644 --- a/dali/integration-api/debug.cpp +++ b/dali/integration-api/debug.cpp @@ -25,6 +25,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -38,9 +39,20 @@ namespace Dali { +#ifdef DEBUG_ENABLED + +// Fake globals for gdb typedefs +Dali::DebugPropertyValueArray gValueArray; +Dali::DebugPropertyValueMap gValueMap; + +#endif + + namespace // unnamed namespace { +const uint64_t NANOSECONDS_PER_SECOND = 1e+9; + /** * Generic function to print out any 2-Dimensional array * @param[in] data pointer to the source data stored as float[rows][cols] @@ -198,13 +210,21 @@ void Filter::Log(LogLevel level, const char* format, ...) va_list arg; va_start(arg, format); - char *buffer = NULL; - int numChars = asprintf(&buffer, "%-*c %s", mNesting, ':', format); - if(numChars >= 0) // No error + if( mTraceEnabled ) { - std::string message = ArgListToString(buffer, arg); - LogMessage(DebugInfo, message.c_str()); - free(buffer); + char *buffer = NULL; + int numChars = asprintf( &buffer, " %-*c %s", mNesting, ':', format ); + if( numChars >= 0 ) // No error + { + std::string message = ArgListToString( buffer, arg ); + LogMessage( DebugInfo, message.c_str() ); + free( buffer ); + } + } + else + { + std::string message = ArgListToString( format, arg ); + LogMessage( DebugInfo, message.c_str() ); } va_end(arg); } @@ -317,6 +337,15 @@ std::string MatrixToString(const Matrix& m, size_t precision, size_t indent) return Array2DToString(m.AsFloat(), 4, 4, precision, indent); } +void GetNanoseconds( uint64_t& timeInNanoseconds ) +{ + timespec timeSpec; + clock_gettime( CLOCK_MONOTONIC, &timeSpec ); + + // Convert all values to uint64_t to match our return type + timeInNanoseconds = ( static_cast< uint64_t >( timeSpec.tv_sec ) * NANOSECONDS_PER_SECOND ) + static_cast< uint64_t >( timeSpec.tv_nsec ); +} + } // namespace Log } // namespace Integration