Change Object profiler to use Environment Options, harmonize environment variable... 53/42053/1
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Mon, 22 Jun 2015 12:47:56 +0000 (13:47 +0100)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Mon, 22 Jun 2015 12:47:56 +0000 (13:47 +0100)
Change-Id: I095e84289d50c977668507fc9894fccb6b860079

adaptors/base/environment-options.cpp
adaptors/base/environment-options.h
adaptors/base/environment-variables.h
adaptors/common/adaptor-impl.cpp
adaptors/common/object-profiler.cpp
adaptors/common/object-profiler.h

index 2df0b2b..8344e05 100644 (file)
@@ -87,8 +87,9 @@ EnvironmentOptions::EnvironmentOptions()
   mNetworkControl(0),
   mFpsFrequency(0),
   mUpdateStatusFrequency(0),
+  mObjectProfilerInterval( 0 ),
   mPerformanceStatsLevel(0),
-  mPerformanceStatsFrequency( DEFAULT_STATISTICS_LOG_FREQUENCY),
+  mPerformanceStatsFrequency( DEFAULT_STATISTICS_LOG_FREQUENCY ),
   mPerformanceTimeStampOutput(0),
   mPanGestureLoggingLevel(0),
   mPanGesturePredictionMode(-1),
@@ -140,6 +141,11 @@ unsigned int EnvironmentOptions::GetUpdateStatusLoggingFrequency() const
   return mUpdateStatusFrequency;
 }
 
+unsigned int EnvironmentOptions::GetObjectProfilerInterval() const
+{
+  return mObjectProfilerInterval;
+}
+
 unsigned int EnvironmentOptions::GetPerformanceStatsLoggingOptions() const
 {
   return mPerformanceStatsLevel;
@@ -230,7 +236,7 @@ const std::string& EnvironmentOptions::GetWindowClassName() const
 
 bool EnvironmentOptions::PerformanceServerRequired() const
 {
-  return ( (GetPerformanceStatsLoggingOptions() > 0) ||
+  return ( ( GetPerformanceStatsLoggingOptions() > 0) ||
            ( GetPerformanceTimeStampOutput() > 0 ) ||
            ( GetNetworkControlMode() > 0) );
 }
@@ -240,6 +246,7 @@ void EnvironmentOptions::ParseEnvironmentOptions()
   // get logging options
   mFpsFrequency = GetIntegerEnvironmentVariable( DALI_ENV_FPS_TRACKING, 0 );
   mUpdateStatusFrequency = GetIntegerEnvironmentVariable( DALI_ENV_UPDATE_STATUS_INTERVAL, 0 );
+  mObjectProfilerInterval = GetIntegerEnvironmentVariable( DALI_ENV_OBJECT_PROFILER_INTERVAL, 0 );
   mPerformanceStatsLevel = GetIntegerEnvironmentVariable( DALI_ENV_LOG_PERFORMANCE_STATS, 0 );
   mPerformanceStatsFrequency = GetIntegerEnvironmentVariable( DALI_ENV_LOG_PERFORMANCE_STATS_FREQUENCY, 0 );
   mPerformanceTimeStampOutput = GetIntegerEnvironmentVariable( DALI_ENV_PERFORMANCE_TIMESTAMP_OUTPUT, 0 );
index b553ba8..29aa9bf 100644 (file)
@@ -79,6 +79,11 @@ public:
   unsigned int GetUpdateStatusLoggingFrequency() const;
 
   /**
+   * @return object profiler status interval ( 0 == off )
+   */
+  unsigned int GetObjectProfilerInterval() const;
+
+  /**
    * @return performance statistics log level ( 0 == off )
    */
   unsigned int GetPerformanceStatsLoggingOptions() const;
@@ -195,6 +200,7 @@ private: // Data
   unsigned int mNetworkControl;                   ///< whether network control is enabled
   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
+  unsigned int mObjectProfilerInterval;           ///< how often object counts are logged out in seconds
   unsigned int mPerformanceStatsLevel;            ///< performance statistics logging bitmask
   unsigned int mPerformanceStatsFrequency;        ///< performance statistics logging frequency (seconds)
   unsigned int mPerformanceTimeStampOutput;       ///< performance time stamp output ( bitmask)
index a1190c4..3b8f663 100644 (file)
@@ -56,6 +56,8 @@ namespace Adaptor
 // environment variable for enabling/disabling fps tracking
 #define DALI_ENV_UPDATE_STATUS_INTERVAL "DALI_UPDATE_STATUS_INTERVAL"
 
+#define DALI_ENV_OBJECT_PROFILER_INTERVAL "DALI_OBJECT_PROFILER_INTERVAL"
+
 #define DALI_ENV_LOG_PAN_GESTURE "DALI_LOG_PAN_GESTURE"
 
 #define DALI_ENV_PAN_PREDICTION_MODE "DALI_PAN_PREDICTION_MODE"
index b6af617..05da7b9 100644 (file)
@@ -141,7 +141,11 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
 
   mCore = Integration::Core::New( *this, *mPlatformAbstraction, *mGLES, *eglSyncImpl, *mGestureManager, dataRetentionPolicy );
 
-  mObjectProfiler = new ObjectProfiler();
+  const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval();
+  if( 0u < timeInterval )
+  {
+    mObjectProfiler = new ObjectProfiler( timeInterval );
+  }
 
   mNotificationTrigger = new TriggerEvent( MakeCallback( this, &Adaptor::ProcessCoreEvents ) );
 
index f91468a..a5f101c 100644 (file)
@@ -38,28 +38,18 @@ namespace Internal
 namespace Adaptor
 {
 
-ObjectProfiler::ObjectProfiler()
-: mIsActive(false)
+ObjectProfiler::ObjectProfiler( unsigned int timeInterval )
 {
   // This class must be created after the Stage; this means it doesn't count the initial objects
   // that are created by the stage (base layer, default camera actor)
   mObjectRegistry = Dali::Stage::GetCurrent().GetObjectRegistry();
 
-  char* profile = getenv("PROFILE_DALI_OBJECTS");
-  if( profile != NULL )
-  {
-    mIsActive = true;
-    int timeInterval = atoi(profile);
-    if( timeInterval > 0 )
-    {
-      mTimer = Dali::Timer::New(timeInterval*1000);
-      mTimer.TickSignal().Connect( this, &ObjectProfiler::OnTimeout );
-      mTimer.Start();
-    }
+  mTimer = Dali::Timer::New( timeInterval * 1000 );
+  mTimer.TickSignal().Connect( this, &ObjectProfiler::OnTimeout );
+  mTimer.Start();
 
-    mObjectRegistry.ObjectCreatedSignal().Connect( this, &ObjectProfiler::OnObjectCreated );
-    mObjectRegistry.ObjectDestroyedSignal().Connect( this, &ObjectProfiler::OnObjectDestroyed );
-  }
+  mObjectRegistry.ObjectCreatedSignal().Connect( this, &ObjectProfiler::OnObjectCreated );
+  mObjectRegistry.ObjectDestroyedSignal().Connect( this, &ObjectProfiler::OnObjectDestroyed );
 }
 
 ObjectProfiler::~ObjectProfiler()
index 8308664..eca7972 100644 (file)
@@ -40,10 +40,12 @@ namespace Adaptor
 class ObjectProfiler : public ConnectionTracker
 {
 public:
+
   /**
    * Constructor
+   * @param timeInterval to specify the frequency of reporting
    */
-  ObjectProfiler();
+  ObjectProfiler( unsigned int timeInterval );
 
   /**
    * Destructor
@@ -89,7 +91,6 @@ private:
   Dali::Timer             mTimer;
   InstanceCountMap        mInstanceCountMap;
   InstanceTypes           mInstanceTypes;
-  bool                    mIsActive;
 };
 
 } // Adaptor