Boost removal from performance server
[platform/core/uifw/dali-adaptor.git] / adaptors / base / performance-logging / performance-server.h
index 2f69d9e..8c71900 100644 (file)
  *
  */
 
+// EXTERNAL INCLDUES
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/devel-api/common/mutex.h>
+
 // INTERNAL INCLUDES
 #include <base/performance-logging/frame-time-stats.h>
-#include <dali/public-api/common/dali-vector.h>
+#include <base/performance-logging/networking/network-performance-server.h>
 #include <base/interfaces/adaptor-internal-services.h>
-
-// EXTERNAL INCLUDES
-#include <boost/thread/mutex.hpp>
+#include <base/performance-logging/performance-marker.h>
+#include <base/performance-logging/statistics/stat-context-manager.h>
 
 namespace Dali
 {
@@ -36,20 +39,20 @@ namespace Adaptor
 {
 
 class EnvironmentOptions;
+class StatContext;
 /**
  * Concrete implementation of performance interface.
  * Adaptor classes should never include this file, they
  * just need to include the abstract class performance-interface.h
  */
-class PerformanceServer : public PerformanceInterface
+class PerformanceServer : public PerformanceInterface, public StatContextLogInterface
 {
-
 public:
 
   /**
-   * Constructor
-   * @param adaptorServices adaptor internal services
-   * @param environmentOptions environment options
+   * @brief Constructor
+   * @param[in] adaptorServices adaptor internal services
+   * @param[in] environmentOptions environment options
    */
   PerformanceServer( AdaptorInternalServices& adaptorServices,
                      const EnvironmentOptions& environmentOptions );
@@ -60,53 +63,72 @@ public:
   virtual ~PerformanceServer();
 
   /**
-   * @copydoc PerformanceInterface::AddMarker()
+   * @copydoc PerformanceLogger::AddContext()
    */
-  virtual void AddMarker( PerformanceMarker::MarkerType markerType);
+  virtual ContextId AddContext( const char* name );
 
   /**
-   * @copydoc PerformanceInterface::SetLogging()
+   * @copydoc PerformanceLogger::RemoveContext()
    */
-  virtual void SetLogging( unsigned int level, unsigned int interval);
+  virtual void RemoveContext( ContextId contextId );
 
-
-private:
+  /**
+   * @copydoc PerformanceInterface::AddMarker( MarkerType markerType )
+   */
+  virtual void AddMarker( MarkerType markerType );
 
   /**
-   * Helper
+   * @copydoc PerformanceLogger::AddMarker( MarkerType markerType, ContextId contextId )
    */
-  void AddMarkerToLog( PerformanceMarker marker );
+  virtual void AddMarker( MarkerType markerType, ContextId contextId );
 
   /**
-   * Helper
+   * @copydoc PerformanceInterface::SetLogging()
    */
-  void LogMarker(const char* name, const FrameTimeStats& frameStats);
+  virtual void SetLogging( unsigned int statisticsLogOptions,
+                           unsigned int timeStampOutput,
+                           unsigned int logFrequency );
 
   /**
-   * log markers out
+   * @copydoc PerformanceLogger::SetLoggingFrequency()
    */
-  void LogMarkers();
+  virtual void SetLoggingFrequency( unsigned int logFrequency, ContextId contextId );
 
-private:
+  /**
+   * @copydoc PerformanceLogger::EnableLogging()
+   */
+  virtual void EnableLogging( bool enable, ContextId contextId );
 
-  bool mLoggingEnabled:1;         ///< whether logging update / render to a log is enabled
-  bool mLogFunctionInstalled:1;   ///< whether the log function is installed
-  unsigned int mLogLevel;         ///< log level
+public: //StatLogInterface
 
-  unsigned int mLogFrequencyMicroseconds; ///< if logging is enabled, what frequency to log out at in micro-seconds
+  /**
+   * @copydoc StatLogInterface::LogContextStatistics()
+   */
+  virtual void LogContextStatistics( const char* const text );
 
-  FrameTimeStats mUpdateStats;    ///< update time statistics
-  FrameTimeStats mRenderStats;    ///< render time statistics
-  FrameTimeStats mEventStats;     ///< event time statistics
+private:
 
-  Integration::PlatformAbstraction& mPlatformAbstraction; ///< platform abstraction
+  /**
+   * @brief log the marker out to kernel/ DALi log
+   * @param[in] marker performance marker
+   * @param[in] description marker description
+   */
+  void LogMarker( const PerformanceMarker& marker, const char* const description );
 
-  typedef Dali::Vector<PerformanceMarker > MarkerVector;
-  MarkerVector mMarkers;              ///< vector of markers
-  boost::mutex mDataMutex;            ///< mutex
-  const EnvironmentOptions& mEnvironmentOptions;      ///< environment options
-  KernelTraceInterface& mKernelTrace; ///< kernel trace interface
+private:
 
+  Integration::PlatformAbstraction& mPlatformAbstraction; ///< platform abstraction
+  const EnvironmentOptions& mEnvironmentOptions;          ///< environment options
+  TraceInterface& mKernelTrace;                           ///< kernel trace interface
+  TraceInterface& mSystemTrace;                           ///< system trace interface
+  Dali::Mutex mLogMutex;                                  ///< mutex
+  NetworkPerformanceServer mNetworkServer;                ///< network server
+  StatContextManager mStatContextManager;                 ///< Stat context manager
+  unsigned int mStatisticsLogBitmask;                     ///< statistics log level
+  unsigned int mPerformanceOutputBitmask;                 ///< performance marker output
+  bool mNetworkControlEnabled:1;                          ///< Whether network control is enabled
+  bool mLoggingEnabled:1;                                 ///< whether logging update / render to a log is enabled
+  bool mLogFunctionInstalled:1;                           ///< whether the log function is installed
 };