#include <base/interfaces/socket-factory-interface.h>
#include <base/interfaces/performance-interface.h>
#include <base/interfaces/vsync-monitor-interface.h>
-#include <base/interfaces/kernel-trace-interface.h>
+#include <base/interfaces/trace-interface.h>
#include <render-surface.h>
virtual PerformanceInterface* GetPerformanceInterface() = 0;
/**
- * @return kernel trace interface
+ * @return interface for logging to the kernel ( e.g. using ftrace )
*/
- virtual KernelTraceInterface& GetKernelTraceInterface() = 0;
+ virtual TraceInterface& GetKernelTraceInterface() = 0;
+
+ /**
+ * @return system trace interface, e.g. for using Tizen Trace (ttrace) or Android Trace (atrace)
+ */
+ virtual TraceInterface& GetSystemTraceInterface() = 0;
+
protected:
+++ /dev/null
-#ifndef __DALI_INTERNAL_BASE_KERNEL_TRACE_INTERFACE_H__
-#define __DALI_INTERNAL_BASE_KERNEL_TRACE_INTERFACE_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <string>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * Abstract Kernel Tracing Interface.
- * Used to log trace messages to the kernel.
- * E.g. On Linux this will use ftrace
- *
- */
-class KernelTraceInterface
-{
-
-public:
-
- /**
- * Write a trace message
- * @param traceMessage trace message
- */
- virtual void Trace( const std::string& traceMessage ) = 0;
-
-protected:
-
- /**
- * Constructor
- */
- KernelTraceInterface()
- {
- }
-
- /**
- * virtual destructor
- */
- virtual ~KernelTraceInterface()
- {
- }
-
- // Undefined copy constructor.
- KernelTraceInterface( const KernelTraceInterface& );
-
- // Undefined assignment operator.
- KernelTraceInterface& operator=( const KernelTraceInterface& );
-};
-
-} // namespace Internal
-
-} // namespace Adaptor
-
-} // namespace Dali
-
-#endif
};
/**
- * bitmask of time stamp output options
+ * bitmask of time stamp output options.
+ * E.g. DALI_PERFORMANCE_TIMESTAMP_OUTPUT = 1 dali-demo
* Used for logging out time stamped markers for detailed analysis (see MarkerType, for the markers logged)
* Typical output would look like:
* 379.059025 (seconds), V_SYNC
--- /dev/null
+#ifndef __DALI_INTERNAL_BASE_TRACE_INTERFACE_H__
+#define __DALI_INTERNAL_BASE_TRACE_INTERFACE_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+
+// INTERNAL INCLUDES
+#include <base/performance-logging/performance-marker.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Abstract Tracing Interface.
+ * Used to log trace messages.
+ * E.g. On Linux this may use ftrace
+ *
+ */
+class TraceInterface
+{
+
+public:
+
+ /**
+ * Write a trace message
+ * @param marker performance marker
+ * @param traceMessage trace message
+ */
+ virtual void Trace( const PerformanceMarker& marker, const std::string& traceMessage ) = 0;
+
+protected:
+
+ /**
+ * Constructor
+ */
+ TraceInterface()
+ {
+ }
+
+ /**
+ * virtual destructor
+ */
+ virtual ~TraceInterface()
+ {
+ }
+
+ // Undefined copy constructor.
+ TraceInterface( const TraceInterface& );
+
+ // Undefined assignment operator.
+ TraceInterface& operator=( const TraceInterface& );
+};
+
+} // namespace Internal
+
+} // namespace Adaptor
+
+} // namespace Dali
+
+#endif
const NamePair MARKER_LOOKUP[] =
{
+ // timed event names must be postfixed with with _START and _END
+ // this is to allow tracers to extract the event name by removing the _START, _END strings
+ //
{ PerformanceInterface::VSYNC , "V_SYNC" , PerformanceMarker::V_SYNC_EVENTS, PerformanceMarker::SINGLE_EVENT },
{ PerformanceInterface::UPDATE_START , "UPDATE_START" , PerformanceMarker::UPDATE, PerformanceMarker::START_TIMED_EVENT },
{ PerformanceInterface::UPDATE_END , "UPDATE_END" , PerformanceMarker::UPDATE, PerformanceMarker::END_TIMED_EVENT },
return MARKER_LOOKUP[ mType ].eventType;
}
+PerformanceMarker::MarkerFilter PerformanceMarker::GetFilterType() const
+{
+ return MARKER_LOOKUP[ mType ].group;
+}
+
unsigned int PerformanceMarker::MicrosecondDiff( const PerformanceMarker& start,const PerformanceMarker& end )
{
return FrameTimeStamp::MicrosecondDiff( start.mTimeStamp, end.mTimeStamp );
*/
MarkerEventType GetEventType() const;
+ /**
+ * @return the filter type of marker
+ */
+ MarkerFilter GetFilterType() const;
+
+
/**
* @return marker name
*/
:mPlatformAbstraction( adaptorServices.GetPlatformAbstractionInterface() ),
mEnvironmentOptions( environmentOptions ),
mKernelTrace( adaptorServices.GetKernelTraceInterface() ),
+ mSystemTrace( adaptorServices.GetSystemTraceInterface() ),
mNetworkServer( adaptorServices, environmentOptions ),
mStatContextManager( *this ),
mStatisticsLogBitmask( 0 ),
// log to kernel trace
if( mPerformanceOutputBitmask & OUTPUT_KERNEL_TRACE )
{
- // name will be something like UPDATE_START or UPDATE_END
- mKernelTrace.Trace( description );
+ // description will be something like UPDATE_START or UPDATE_END
+ mKernelTrace.Trace( marker, description );
+ }
+
+ // log to system trace
+ if( mPerformanceOutputBitmask & OUTPUT_SYSTEM_TRACE )
+ {
+ mSystemTrace.Trace( marker, description );
}
// log to Dali log
Integration::PlatformAbstraction& mPlatformAbstraction; ///< platform abstraction
const EnvironmentOptions& mEnvironmentOptions; ///< environment options
- KernelTraceInterface& mKernelTrace; ///< kernel trace interface
+ TraceInterface& mKernelTrace; ///< kernel trace interface
+ TraceInterface& mSystemTrace; ///< system trace interface
boost::mutex mDataMutex; ///< mutex
NetworkPerformanceServer mNetworkServer; ///< network server
StatContextManager mStatContextManager; ///< Stat context manager
return mVSyncMonitor;
}
-KernelTraceInterface& Adaptor::GetKernelTraceInterface()
+TraceInterface& Adaptor::GetKernelTraceInterface()
{
return mKernelTracer;
}
+TraceInterface& Adaptor::GetSystemTraceInterface()
+{
+ return mSystemTracer;
+}
+
PerformanceInterface* Adaptor::GetPerformanceInterface()
{
return mPerformanceInterface;
#include <damage-observer.h>
#include <window-visibility-observer.h>
#include <kernel-trace.h>
+#include <system-trace.h>
#include <trigger-event-factory.h>
#include <networking/socket-factory.h>
/**
* copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetKernelTraceInterface()
*/
- virtual KernelTraceInterface& GetKernelTraceInterface();
+ virtual TraceInterface& GetKernelTraceInterface();
+
+ /**
+ * copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetSystemTraceInterface()
+ */
+ virtual TraceInterface& GetSystemTraceInterface();
public: // Stereoscopy
EnvironmentOptions mEnvironmentOptions; ///< environment options
PerformanceInterface* mPerformanceInterface; ///< Performance interface
KernelTrace mKernelTracer; ///< Kernel tracer
+ SystemTrace mSystemTracer; ///< System tracer
TriggerEventFactory mTriggerEventFactory; ///< Trigger event factory
ObjectProfiler* mObjectProfiler; ///< Tracks object lifetime for profiling
SocketFactory mSocketFactory; ///< Socket factory
$(adaptor_common_dir)/ecore-callback-manager.cpp \
$(adaptor_common_dir)/file-descriptor-monitor.cpp \
$(adaptor_common_dir)/haptic-player-impl.cpp \
- $(adaptor_common_dir)/indicator-impl.cpp \
- $(adaptor_common_dir)/indicator-buffer.cpp \
- $(adaptor_common_dir)/kernel-trace.cpp \
+ $(adaptor_common_dir)/indicator-impl.cpp \
+ $(adaptor_common_dir)/indicator-buffer.cpp \
+ $(adaptor_common_dir)/kernel-trace.cpp \
+ $(adaptor_common_dir)/system-trace.cpp \
$(adaptor_common_dir)/lifecycle-controller-impl.cpp \
$(adaptor_common_dir)/locale-utils.cpp \
$(adaptor_common_dir)/native-bitmap-buffer-impl.cpp \
// If the message did not get added to the trace, then check you have write permissions to the trace_marker file.
//
//
-void KernelTrace::Trace( const std::string& traceMessage )
+void KernelTrace::Trace( const PerformanceMarker& marker, const std::string& traceMessage )
{
// Open the trace_marker file
if( mFileDescriptor == 0 )
*
*/
-#include <base/interfaces/kernel-trace-interface.h>
+#include <base/interfaces/trace-interface.h>
namespace Dali
{
* Used to log trace messages to the kernel using ftrace.
*
*/
-class KernelTrace : public KernelTraceInterface
+class KernelTrace : public TraceInterface
{
public:
/**
* @copydoc KernelTracerInterface::KernelTrace()
*/
- virtual void Trace( const std::string& traceMessage );
+ virtual void Trace( const PerformanceMarker& marker, const std::string& traceMessage );
private:
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "system-trace.h"
+
+// EXTERNAL HEADERS
+#include <string>
+#include <dali/public-api/common/hash.h>
+
+// INTERNAL HEADERS
+#include <dali/integration-api/debug.h>
+
+#ifdef ENABLE_TTRACE
+#include <ttrace.h>
+#else
+
+// Emulate trace calls if ttrace isn't available
+namespace
+{
+const int TTRACE_TAG_GRAPHICS = 1;
+
+void traceAsyncBegin(int tag, int cookie, const char *name, ...)
+{
+ Debug::LogMessage(Debug::DebugInfo, "AsyncBegin: %s : cookie %d\n", name, cookie );
+}
+void traceAsyncEnd(int tag, int cookie, const char *name, ...)
+{
+ Debug::LogMessage(Debug::DebugInfo, "AsyncEnd: %s : cookie %d\n", name, cookie );
+}
+void traceMark(int tag, const char *name, ...)
+{
+ Debug::LogMessage(Debug::DebugInfo, "Marker: %s \n", name);
+}
+} // un-named namespace
+#endif
+
+namespace
+{
+
+int GetCookie( const std::string& description, std::string& markerName )
+{
+ // description holds the marker name and postfix of _START or _END
+ std::size_t pos = description.find("_START");
+ if( pos == std::string::npos )
+ {
+ pos = description.find("_END");
+ }
+ if( !pos )
+ {
+ // if this asserts then check the postfix strings in StatContext.cpp for
+ // custom markers and performance-marker.cpp for built-in markers
+ DALI_ASSERT_DEBUG(0);
+ }
+ markerName = description.substr( 0, pos );
+
+ std::size_t hash = Dali::CalculateHash( markerName.c_str() );
+ return static_cast<int>( hash );
+}
+}
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+SystemTrace::SystemTrace()
+{
+}
+SystemTrace::~SystemTrace()
+{
+}
+
+void SystemTrace::Trace( const PerformanceMarker& marker, const std::string& traceMessage )
+{
+ PerformanceMarker::MarkerEventType eventType = marker.GetEventType();
+
+ if( eventType == PerformanceMarker::SINGLE_EVENT )
+ {
+ traceMark( TTRACE_TAG_GRAPHICS, traceMessage.c_str() );
+ return;
+ }
+
+ // DALi is multi-threaded so timed events will occur asynchronously
+ std::string markerName;
+
+ int cookie = GetCookie(traceMessage, markerName );
+
+ if( eventType == PerformanceMarker::START_TIMED_EVENT )
+ {
+ traceAsyncBegin( TTRACE_TAG_GRAPHICS, cookie, markerName.c_str() );
+ }
+ else
+ {
+ traceAsyncEnd( TTRACE_TAG_GRAPHICS, cookie, markerName.c_str() );
+ }
+}
+
+} // namespace Internal
+
+} // namespace Adaptor
+
+} // namespace Dali
+
--- /dev/null
+#ifndef __DALI_INTERNAL_ADAPTOR_SYSTEM_TRACE_H__
+#define __DALI_INTERNAL_ADAPTOR_SYSTEM_TRACE_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <base/interfaces/trace-interface.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Concrete System Tracing Interface.
+ * Used to log trace messages to the system using ttrace
+ *
+ */
+class SystemTrace : public TraceInterface
+{
+public:
+
+ /**
+ * Constructor
+ */
+ SystemTrace();
+
+ /**
+ * Destructor
+ */
+ virtual ~SystemTrace();
+
+ /**
+ * @copydoc KernelTracerInterface::KernelTrace()
+ */
+ virtual void Trace( const PerformanceMarker& marker, const std::string& traceMessage );
+
+};
+
+} // namespace Internal
+
+} // namespace Adaptor
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_ADAPTOR_SYSTEM_TRACE_H__
PKG_CHECK_MODULES(LIBCURL, libcurl)
PKG_CHECK_MODULES(HARFBUZZ, harfbuzz)
PKG_CHECK_MODULES(FRIBIDI, fribidi)
+PKG_CHECK_MODULES(TTRACE, ttrace, AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available]),
+ [ AC_MSG_NOTICE([Tizen Trace not avaiable]) ]
+ )
# Check for availability of BulletPhysics
PKG_CHECK_EXISTS(bullet, [