Added TimeService following removal of Time getters from PlatformAbstraction 33/51433/5
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 9 Nov 2015 12:48:33 +0000 (12:48 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 10 Nov 2015 15:14:11 +0000 (15:14 +0000)
Change-Id: Iae8c84519dda65915b18c1574be41e2c191cab98

21 files changed:
adaptors/base/file.list
adaptors/base/performance-logging/frame-time-stamp.cpp
adaptors/base/performance-logging/frame-time-stamp.h
adaptors/base/performance-logging/networking/network-performance-client.cpp
adaptors/base/performance-logging/performance-server.cpp
adaptors/base/performance-logging/performance-server.h
adaptors/base/separate-update-render/frame-time.cpp
adaptors/base/separate-update-render/frame-time.h
adaptors/base/separate-update-render/thread-synchronization.cpp
adaptors/base/separate-update-render/vsync-notifier.cpp
adaptors/base/separate-update-render/vsync-notifier.h
adaptors/base/single-threaded/single-thread-controller.cpp
adaptors/base/single-threaded/single-thread-controller.h
adaptors/base/time-service.cpp [new file with mode: 0644]
adaptors/base/time-service.h [new file with mode: 0644]
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
automated-tests/src/dali-platform-abstraction/utc-image-loading-common.h
platform-abstractions/tizen/tizen-platform-abstraction.cpp
platform-abstractions/tizen/tizen-platform-abstraction.h

index f583fa1..9b85f44 100644 (file)
@@ -6,6 +6,7 @@ base_adaptor_src_files = \
   $(base_adaptor_src_dir)/fps-tracker.cpp \
   $(base_adaptor_src_dir)/render-helper.cpp \
   $(base_adaptor_src_dir)/thread-controller.cpp \
+  $(base_adaptor_src_dir)/time-service.cpp \
   $(base_adaptor_src_dir)/update-status-logger.cpp \
   $(base_adaptor_src_dir)/performance-logging/frame-time-stamp.cpp \
   $(base_adaptor_src_dir)/performance-logging/frame-time-stats.cpp \
index 4fe539d..e1a9b9d 100644 (file)
 // CLASS HEADER
 #include "frame-time-stamp.h"
 
-namespace
-{
-const unsigned int MICROSECONDS_PER_SECOND = 1000000; ///< 1000000 microseconds per second
-}
-
 namespace Dali
 {
 
@@ -34,26 +29,22 @@ namespace Adaptor
 
 FrameTimeStamp::FrameTimeStamp()
 : frame(0),
-  seconds(0),
   microseconds(0),
   bufferIndex(0)
 {
 }
 
 FrameTimeStamp::FrameTimeStamp(unsigned int frame,
-                               unsigned int seconds,
-                               unsigned int microseconds,
+                               uint64_t     microseconds,
                                unsigned int bufferIndex)
 : frame( frame ),
-  seconds( seconds ),
   microseconds( microseconds ),
   bufferIndex( bufferIndex )
 {
 }
 
-FrameTimeStamp::FrameTimeStamp(unsigned int bufferIndex )
+FrameTimeStamp::FrameTimeStamp( unsigned int bufferIndex )
 : frame( 0 ),
-  seconds(  0 ),
   microseconds( 0 ),
   bufferIndex( bufferIndex )
 {
@@ -61,9 +52,7 @@ FrameTimeStamp::FrameTimeStamp(unsigned int bufferIndex )
 
 unsigned int FrameTimeStamp::MicrosecondDiff( const FrameTimeStamp& start,const FrameTimeStamp& end )
 {
-  int microDiff = end.microseconds - start.microseconds;
-  unsigned int secDiff = ( end.seconds - start.seconds ) * MICROSECONDS_PER_SECOND;
-  return ( microDiff + secDiff);
+  return end.microseconds - start.microseconds;
 }
 
 } // namespace Adaptor
index 7d6dcbe..5311690 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <stdint.h>
+
 namespace Dali
 {
 
@@ -44,11 +47,10 @@ struct FrameTimeStamp
     /**
      * Constructor
      * @param frame the frame number
-     * @param second the seconds from a monotonic clock
-     * @param microseconds the microseconds from a monotonic clock
+     * @param microseconds the time from a monotonic clock
      * @param bufferIndex  double buffered index used for performing an update / render
      */
-    FrameTimeStamp( unsigned int frame, unsigned int seconds,unsigned int microseconds, unsigned int bufferIndex = BUFFER_NOT_USED );
+    FrameTimeStamp( unsigned int frame, uint64_t microseconds, unsigned int bufferIndex = BUFFER_NOT_USED );
 
     /**
      * Constructor
@@ -64,8 +66,7 @@ struct FrameTimeStamp
     static unsigned int MicrosecondDiff( const FrameTimeStamp& start,const FrameTimeStamp& end );
 
     unsigned int frame;            ///< Frame number ( not always available)
-    unsigned int seconds;          ///< Second time stamp
-    unsigned int microseconds;     ///< Microsecond time stamp
+    uint64_t     microseconds;     ///< Microsecond time stamp
     unsigned int bufferIndex;      ///< The double buffered index used for performing an update / render
   };
 } // namespace Adaptor
index 27fb07a..7c90848 100644 (file)
@@ -39,6 +39,7 @@ namespace Adaptor
 
 namespace
 {
+const float MICROSECONDS_TO_SECOND = 1e-6;
 const char UNKNOWN_CMD[]= "Command or parameter invalid, type help for list of commands\n";
 
 
@@ -168,9 +169,8 @@ bool NetworkPerformanceClient::TransmitMarker( const PerformanceMarker& marker,
   {
     // write out the time stamp
     char buffer[64];
-    int size = snprintf( buffer, sizeof(buffer),"%d.%06d (seconds), %s\n",
-                                    marker.GetTimeStamp().seconds,
-                                    marker.GetTimeStamp().microseconds,
+    int size = snprintf( buffer, sizeof(buffer),"%.6f (seconds), %s\n",
+                                    (float)( marker.GetTimeStamp().microseconds * MICROSECONDS_TO_SECOND ),
                                     description );
 
    return mSocket->Write( buffer, size );
index 5b6773f..9aabb48 100644 (file)
@@ -23,6 +23,7 @@
 
 // INTERNAL INCLUDES
 #include <base/environment-options.h>
+#include <base/time-service.h>
 
 namespace Dali
 {
@@ -33,18 +34,23 @@ namespace Internal
 namespace Adaptor
 {
 
+namespace
+{
+const unsigned int NANOSECONDS_PER_MICROSECOND = 1000u;
+const float        MICROSECONDS_TO_SECOND = 1e-6;
+} // unnamed namespace
+
 PerformanceServer::PerformanceServer( AdaptorInternalServices& adaptorServices,
                                       const EnvironmentOptions& environmentOptions)
-:mPlatformAbstraction( adaptorServices.GetPlatformAbstractionInterface() ),
- mEnvironmentOptions( environmentOptions ),
- mKernelTrace( adaptorServices.GetKernelTraceInterface() ),
- mSystemTrace( adaptorServices.GetSystemTraceInterface() ),
- mNetworkServer( adaptorServices, environmentOptions ),
- mStatContextManager( *this ),
- mStatisticsLogBitmask( 0 ),
- mNetworkControlEnabled( mEnvironmentOptions.GetNetworkControlMode()),
- mLoggingEnabled( false ),
- mLogFunctionInstalled( false )
+: mEnvironmentOptions( environmentOptions ),
+  mKernelTrace( adaptorServices.GetKernelTraceInterface() ),
+  mSystemTrace( adaptorServices.GetSystemTraceInterface() ),
+  mNetworkServer( adaptorServices, environmentOptions ),
+  mStatContextManager( *this ),
+  mStatisticsLogBitmask( 0 ),
+  mNetworkControlEnabled( mEnvironmentOptions.GetNetworkControlMode()),
+  mLoggingEnabled( false ),
+  mLogFunctionInstalled( false )
 {
   SetLogging( mEnvironmentOptions.GetPerformanceStatsLoggingOptions(),
               mEnvironmentOptions.GetPerformanceTimeStampOutput(),
@@ -120,12 +126,12 @@ void PerformanceServer::AddMarker( MarkerType markerType, ContextId contextId )
   }
 
   // Get the time stamp
-  unsigned int seconds = 0;
-  unsigned int microseconds = 0;
-  mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+  uint64_t timeStamp = 0;
+  TimeService::GetNanoseconds( timeStamp );
+  timeStamp /= NANOSECONDS_PER_MICROSECOND; // Convert to microseconds
 
   // Create a marker
-  PerformanceMarker marker( markerType, FrameTimeStamp( 0, seconds, microseconds ) );
+  PerformanceMarker marker( markerType, FrameTimeStamp( 0, timeStamp ) );
 
   // get the marker description for this context, e.g SIZE_NEGOTIATION_START
   const char* const description = mStatContextManager.GetMarkerDescription( markerType, contextId );
@@ -158,12 +164,12 @@ void PerformanceServer::AddMarker( MarkerType markerType )
   }
 
   // Get the time
-  unsigned int seconds = 0;
-  unsigned int microseconds = 0;
-  mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+  uint64_t timeStamp = 0;
+  TimeService::GetNanoseconds( timeStamp );
+  timeStamp /= NANOSECONDS_PER_MICROSECOND; // Convert to microseconds
 
   // Create a marker
-  PerformanceMarker marker( markerType, FrameTimeStamp( 0, seconds, microseconds ) );
+  PerformanceMarker marker( markerType, FrameTimeStamp( 0, timeStamp ) );
 
   // log it
   LogMarker(marker, marker.GetName() );
@@ -208,9 +214,8 @@ void PerformanceServer::LogMarker( const PerformanceMarker& marker, const char*
   if ( mPerformanceOutputBitmask & OUTPUT_DALI_LOG )
   {
     Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo,
-                                    "%d.%06d (seconds), %s\n",
-                                    marker.GetTimeStamp().seconds,
-                                    marker.GetTimeStamp().microseconds,
+                                    "%.6f (seconds), %s\n",
+                                    (float)( marker.GetTimeStamp().microseconds * MICROSECONDS_TO_SECOND ),
                                     description);
   }
 }
index 6ee2a29..a60a1a3 100644 (file)
@@ -117,7 +117,6 @@ private:
 
 private:
 
-  Integration::PlatformAbstraction& mPlatformAbstraction; ///< platform abstraction
   const EnvironmentOptions& mEnvironmentOptions;          ///< environment options
   TraceInterface& mKernelTrace;                           ///< kernel trace interface
   TraceInterface& mSystemTrace;                           ///< system trace interface
index f3d4e23..7c49800 100644 (file)
@@ -22,6 +22,9 @@
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/platform-abstraction.h>
 
+// INTERNAL INCLUDES
+#include <base/time-service.h>
+
 namespace Dali
 {
 
@@ -54,9 +57,8 @@ const unsigned int FALSE = 0u;
 } // unnamed namespace
 
 
-FrameTime::FrameTime( PlatformAbstraction& platform )
-: mPlatform( platform ),
-  mMinimumFrameTimeInterval( DEFAULT_MINIMUM_FRAME_TIME_INTERVAL ),
+FrameTime::FrameTime()
+: mMinimumFrameTimeInterval( DEFAULT_MINIMUM_FRAME_TIME_INTERVAL ),
   mLastSyncTime( 0u ),
   mLastSyncTimeAtUpdate( 0u ),
   mLastSyncFrameNumber( 0u ),
@@ -221,13 +223,10 @@ void FrameTime::PredictNextSyncTime( float& lastFrameDeltaSeconds, unsigned int&
 
 inline void FrameTime::SetLastSyncTime()
 {
-  uint64_t seconds( 0u );
   uint64_t nanoseconds( 0u );
+  TimeService::GetNanoseconds( nanoseconds );
 
-  mPlatform.GetTimeNanoseconds( seconds, nanoseconds );
-
-  mLastSyncTime = seconds * MICROSECONDS_PER_SECOND;
-  mLastSyncTime += nanoseconds / NANOSECONDS_PER_MICROSECOND;
+  mLastSyncTime = nanoseconds / NANOSECONDS_PER_MICROSECOND;
 }
 
 } // namespace Adaptor
index 42bc596..ec43971 100644 (file)
@@ -46,9 +46,8 @@ public:
 
   /**
    * Constructor
-   * @param[in]  platform  The platform used to retrieve the current time
    */
-  FrameTime( Integration::PlatformAbstraction& platform );
+  FrameTime();
 
   /**
    * Destructor, non virtual
@@ -114,8 +113,6 @@ private:
 
 private:
 
-  Integration::PlatformAbstraction& mPlatform; ///< The platform abstraction.
-
   unsigned int mMinimumFrameTimeInterval; ///< The minimum frame time interval, set by Adaptor.
 
   uint64_t mLastSyncTime;                ///< The last Sync time (in microseconds).
index f6484ae..407c018 100644 (file)
@@ -40,7 +40,7 @@ const unsigned int FALSE = 0u;
 } // unnamed namespace
 
 ThreadSynchronization::ThreadSynchronization( AdaptorInternalServices& adaptorInterfaces, unsigned int numberOfVSyncsPerRender)
-: mFrameTime( adaptorInterfaces.GetPlatformAbstractionInterface() ),
+: mFrameTime(),
   mNotificationTrigger( adaptorInterfaces.GetProcessCoreEventsTrigger() ),
   mPerformanceInterface( adaptorInterfaces.GetPerformanceInterface() ),
   mReplaceSurfaceRequest(),
index a8f3794..dc407f8 100644 (file)
@@ -27,6 +27,7 @@
 #include <base/interfaces/adaptor-internal-services.h>
 #include <base/separate-update-render/thread-synchronization.h>
 #include <base/environment-options.h>
+#include <base/time-service.h>
 
 namespace Dali
 {
@@ -40,6 +41,7 @@ namespace Adaptor
 namespace
 {
 
+const unsigned int NANOSECONDS_PER_SECOND( 1e+9 );
 const unsigned int NANOSECONDS_PER_MICROSECOND( 1000u );
 const unsigned int MICROSECONDS_PER_SECOND( 1000000u );
 const unsigned int TIME_PER_FRAME_IN_MICROSECONDS( 16667u );
@@ -55,7 +57,6 @@ VSyncNotifier::VSyncNotifier( ThreadSynchronization& sync,
                               const EnvironmentOptions& environmentOptions )
 : mThreadSynchronization( sync ),
   mCore( adaptorInterfaces.GetCore() ),
-  mPlatformAbstraction( adaptorInterfaces.GetPlatformAbstractionInterface() ),
   mVSyncMonitor( adaptorInterfaces.GetVSyncMonitorInterface() ),
   mThread( NULL ),
   mEnvironmentOptions( environmentOptions ),
@@ -137,8 +138,12 @@ void VSyncNotifier::Run()
     else
     {
       // No..use software timer
-      mPlatformAbstraction.GetTimeNanoseconds( seconds, microseconds );
-      microseconds /= NANOSECONDS_PER_MICROSECOND; // Convert to microseconds
+      uint64_t nanoseconds = 0;
+      TimeService::GetNanoseconds( nanoseconds );
+
+      seconds = nanoseconds / NANOSECONDS_PER_SECOND; // Convert to seconds
+      nanoseconds -= seconds * NANOSECONDS_PER_SECOND; // Only want remainder nanoseconds
+      microseconds = nanoseconds / NANOSECONDS_PER_MICROSECOND; // Convert to microseconds
 
       unsigned int timeDelta( MICROSECONDS_PER_SECOND * (seconds - currentSeconds) );
       if( microseconds < currentMicroseconds)
index fd6bdc3..86cdc24 100644 (file)
@@ -99,7 +99,6 @@ private:
 
   ThreadSynchronization&              mThreadSynchronization;   ///< Used to synchronize all the threads
   Dali::Integration::Core&            mCore;                    ///< Dali core reference
-  Integration::PlatformAbstraction&   mPlatformAbstraction;     ///< The platform abstraction for retrieving the current time etc.
   VSyncMonitorInterface*              mVSyncMonitor;            ///< VSyncMonitor interface
   pthread_t*                          mThread;                  ///< The actual thread.
   const EnvironmentOptions&           mEnvironmentOptions;      ///< Environment options
index f0c3398..9d70fe8 100644 (file)
@@ -25,6 +25,7 @@
 // INTERNAL INCLUDES
 #include <base/interfaces/adaptor-internal-services.h>
 #include <base/environment-options.h>
+#include <base/time-service.h>
 
 namespace Dali
 {
@@ -41,8 +42,7 @@ const unsigned int MILLISECONDS_PER_FRAME = 17u;
 const float SECONDS_PER_FRAME = MILLISECONDS_PER_FRAME * 0.001f;
 
 const unsigned int NANOSECONDS_PER_MICROSECOND( 1000u );
-const unsigned int MICROSECONDS_PER_SECOND( 1000000u );
-const float        MICROSECONDS_TO_SECONDS( 0.000001f );
+const float        NANOSECONDS_TO_SECONDS( 1e-9f );
 
 #if defined(DEBUG_ENABLED)
 Integration::Log::Filter* gLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_THREAD_SYNC");
@@ -58,7 +58,6 @@ SingleThreadController::SingleThreadController( AdaptorInternalServices& adaptor
   mUpdateStatusLogger( environmentOptions ),
   mRenderHelper( adaptorInterfaces ),
   mCore( adaptorInterfaces.GetCore()),
-  mPlatformAbstraction( adaptorInterfaces.GetPlatformAbstractionInterface() ),
   mPerformanceInterface( adaptorInterfaces.GetPerformanceInterface() ),
   mLastUpdateRenderTime( 0 ),
   mSystemTime( 0 ),
@@ -293,18 +292,13 @@ float SingleThreadController::UpdateTimeSinceLastRender()
   // No need calculating if FPS tracking is NOT enabled
   if( mFpsTracker.Enabled() )
   {
-    uint64_t seconds = 0;
-    uint64_t microSeconds = 0;
-
-    mPlatformAbstraction.GetTimeNanoseconds( seconds, microSeconds );
-    microSeconds /= NANOSECONDS_PER_MICROSECOND;
-
-    uint64_t currentTime = ( seconds * MICROSECONDS_PER_SECOND ) + microSeconds;
+    uint64_t currentTime = 0;
+    TimeService::GetNanoseconds( currentTime );
 
     uint64_t delta = currentTime - mSystemTime;
     mSystemTime = currentTime;
 
-    timeSinceLastRender = delta * MICROSECONDS_TO_SECONDS;
+    timeSinceLastRender = delta * NANOSECONDS_TO_SECONDS;
   }
 
   return timeSinceLastRender;
index 64a6a8e..e5bf676 100644 (file)
@@ -175,7 +175,6 @@ private:
   RenderHelper                      mRenderHelper;                    ///< Helper class for EGL, pre & post rendering
 
   Integration::Core&                mCore;                            ///< DALi core reference
-  Integration::PlatformAbstraction& mPlatformAbstraction;             ///< To get the current time
   PerformanceInterface*             mPerformanceInterface;            ///< The performance logging interface
 
   uint64_t                          mLastUpdateRenderTime;            ///< Last time we did an update and render
diff --git a/adaptors/base/time-service.cpp b/adaptors/base/time-service.cpp
new file mode 100644 (file)
index 0000000..61d9f7f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ */
+
+// HEADER
+#include "base/time-service.h"
+
+// EXTERNAL INCLUDES
+#include <ctime>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace TimeService
+{
+
+namespace
+{
+const uint64_t NANOSECONDS_PER_SECOND = 1e+9;
+}
+
+void GetNanoseconds( uint64_t& time )
+{
+  timespec timeSpec;
+  clock_gettime( CLOCK_MONOTONIC, &timeSpec );
+
+  // Convert all values to uint64_t to match our return type
+  time = ( static_cast< uint64_t >( timeSpec.tv_sec ) * NANOSECONDS_PER_SECOND ) + static_cast< uint64_t >( timeSpec.tv_nsec );
+}
+
+} // namespace TimeService
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/adaptors/base/time-service.h b/adaptors/base/time-service.h
new file mode 100644 (file)
index 0000000..ed2ca8a
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef __DALI_INTERNAL_TIME_SERVICE_H__
+#define __DALI_INTERNAL_TIME_SERVICE_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 <stdint.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace TimeService
+{
+
+/**
+ * @brief Get the monotonic time since some unspecified starting point (usually the boot time).
+ *
+ * @param[out]  nanoseconds  The time in nanoseconds since the reference point.
+ *
+ * @note The maximum value this can hold is 0xFFFFFFFFFFFFFFFF which is 1.844674407e+19. Therefore, this can overflow after approximately 584 years.
+ */
+void GetNanoseconds( uint64_t& time );
+
+} // namespace TimeService
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TIME_SERVICE_H__
index 60d7b6e..995e117 100644 (file)
@@ -153,16 +153,12 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height )
 
 void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
 {
-  uint64_t seconds(0u), nanoseconds(0u);
-  mPlatformAbstraction.GetTimeNanoseconds( seconds, nanoseconds );
-  mLastVSyncTime = ( seconds * 1e3 ) + ( nanoseconds / 1e6 );
-  unsigned int nextVSyncTime = mLastVSyncTime + 16;
-
-  // Update Time values
-  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
-
+  unsigned int nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
   float elapsedSeconds = intervalMilliseconds / 1e3f;
+
   mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
+
+  mLastVSyncTime = nextVSyncTime;
 }
 
 bool TestApplication::Render( unsigned int intervalMilliseconds  )
index 5ece3f1..1e56f8d 100644 (file)
 namespace Dali
 {
 
-namespace
-{
-const unsigned int NANOSECONDS_PER_MILLISECOND = 1000000u;
-const unsigned int NANOSECONDS_PER_SECOND = 1000000000u;
-}
-
 TestPlatformAbstraction::TestPlatformAbstraction()
 : mTrace(),
-  mSeconds( 0u ),
-  mNanoSeconds( 0u ),
   mIsLoadingResult( false ),
   mGetDefaultFontSizeResult( 0 ),
   mResources(),
@@ -48,13 +40,6 @@ TestPlatformAbstraction::~TestPlatformAbstraction()
 {
 }
 
-void TestPlatformAbstraction::GetTimeNanoseconds( uint64_t& seconds, uint64_t& nanoseconds )
-{
-  seconds = mSeconds;
-  nanoseconds = mNanoSeconds;
-  mTrace.PushCall("GetTimeNanoseconds", "");
-}
-
 void TestPlatformAbstraction::Suspend()
 {
   mTrace.PushCall("Suspend", "");
@@ -188,8 +173,6 @@ void TestPlatformAbstraction::Initialize()
   mTrace.Reset();
   mTrace.Enable(true);
   memset(&mResources, 0, sizeof(Resources));
-  mSeconds=0;
-  mNanoSeconds=0;
   mIsLoadingResult=false;
 
   if(mRequest)
@@ -203,7 +186,6 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
 {
   switch(func)
   {
-    case GetTimeNanosecondsFunc:              return mTrace.FindMethod("GetTimeNanoseconds");
     case SuspendFunc:                         return mTrace.FindMethod("Suspend");
     case ResumeFunc:                          return mTrace.FindMethod("Resume");
     case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
@@ -220,21 +202,6 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
   return false;
 }
 
-void TestPlatformAbstraction::SetGetTimeNanosecondsResult(size_t sec, size_t nsec)
-{
-  mSeconds = sec;
-  mNanoSeconds = nsec;
-}
-
-void TestPlatformAbstraction::IncrementGetTimeResult(size_t milliseconds)
-{
-  mNanoSeconds += milliseconds * NANOSECONDS_PER_MILLISECOND;
-  unsigned int additionalSeconds = mNanoSeconds / NANOSECONDS_PER_SECOND;
-
-  mSeconds += additionalSeconds;
-  mNanoSeconds -= additionalSeconds * NANOSECONDS_PER_SECOND;
-}
-
 void TestPlatformAbstraction::SetIsLoadingResult(bool result)
 {
   mIsLoadingResult = result;
index b1fb01b..a728ac2 100644 (file)
@@ -74,11 +74,6 @@ public:
   virtual ~TestPlatformAbstraction();
 
   /**
-   * @copydoc PlatformAbstraction::GetTimeNanoseconds()
-   */
-  virtual void GetTimeNanoseconds( uint64_t& seconds, uint64_t& nanoseconds );
-
-  /**
    * @copydoc PlatformAbstraction::Suspend()
    */
   virtual void Suspend();
@@ -173,7 +168,6 @@ public: // TEST FUNCTIONS
   // Enumeration of Platform Abstraction methods
   typedef enum
   {
-    GetTimeNanosecondsFunc,
     SuspendFunc,
     ResumeFunc,
     LoadResourceFunc,
@@ -197,10 +191,6 @@ public: // TEST FUNCTIONS
 
   bool WasCalled(TestFuncEnum func);
 
-  void SetGetTimeNanosecondsResult(size_t sec, size_t nsec);
-
-  void IncrementGetTimeResult(size_t milliseconds);
-
   void SetIsLoadingResult(bool result);
 
   void SetGetDefaultFontSizeResult(float result);
@@ -226,8 +216,6 @@ public: // TEST FUNCTIONS
 
 private:
   mutable TraceCallStack        mTrace;
-  uint64_t                      mSeconds;
-  uint64_t                      mNanoSeconds;
   bool                          mIsLoadingResult;
   int                           mGetDefaultFontSizeResult;
   Resources                     mResources;
index 28b9140..9c709a9 100644 (file)
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <iostream>
 #include <stdlib.h>
+#include <ctime>
 #include <dali/dali.h>
 #include <dali-test-suite-utils.h>
 #include "tizen-platform-abstraction.h"
@@ -65,12 +66,9 @@ const unsigned NUM_VALID_IMAGES = sizeof(VALID_IMAGES) / sizeof(VALID_IMAGES[0])
 /** Returns elapsed milliseconds. */
 double GetTimeMilliseconds( Integration::PlatformAbstraction& abstraction )
 {
-  uint64_t seconds;
-  uint64_t microseconds;
-  abstraction.GetTimeNanoseconds( seconds, microseconds );
-  microseconds /= 1000u;
-  double milliseconds = seconds * 1000.0 + microseconds / 1000.0;
-  return milliseconds;
+  timespec timeSpec;
+  clock_gettime( CLOCK_MONOTONIC, &timeSpec );
+  return ( timeSpec.tv_sec * 1e3 ) + ( timeSpec.tv_nsec / 1e6 );
 }
 
 } // anon namespace
index 6d2e4c6..338f5da 100644 (file)
@@ -54,14 +54,6 @@ TizenPlatformAbstraction::~TizenPlatformAbstraction()
   delete mResourceLoader;
 }
 
-void TizenPlatformAbstraction::GetTimeNanoseconds( uint64_t& seconds, uint64_t& nanoseconds )
-{
-  timespec time;
-  clock_gettime( CLOCK_MONOTONIC, &time );
-  seconds = time.tv_sec;
-  nanoseconds = time.tv_nsec;
-}
-
 void TizenPlatformAbstraction::Suspend()
 {
   if (mResourceLoader)
index 89cd462..fdad62e 100644 (file)
@@ -58,11 +58,6 @@ public: // Construction & Destruction
 public: // PlatformAbstraction overrides
 
   /**
-   * @copydoc PlatformAbstraction::GetTimeNanoseconds()
-   */
-  virtual void GetTimeNanoseconds( uint64_t& seconds, uint64_t& nanoseconds );
-
-  /**
    * @copydoc PlatformAbstraction::Suspend()
    */
   virtual void Suspend();