[Libreoffice-commits] core.git: sc/source

Michael Meeks michael.meeks at collabora.com
Sat Dec 28 14:48:46 PST 2013


 sc/source/core/tool/interpr7.cxx     |   17 ++++++++++++++---
 sc/source/ui/docshell/datastream.cxx |   26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

New commits:
commit 7a4b8676a283d629d952ceb5c59327827838124d
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Dec 28 22:45:00 2013 +0000

    implement datastream timings.
    
    Change-Id: I8b3a1747ff291cbfcc650887bb8557fb5dc24c0d

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index aa07090..91f7116 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -25,6 +25,12 @@
 
 using namespace com::sun::star;
 
+namespace sc
+{
+    // punch through into the datastream impl.
+    extern double datastream_get_time( int nIdx );
+}
+
 // TODO: Add new methods for ScInterpreter here.
 
 void ScInterpreter::ScFilterXML()
@@ -248,10 +254,15 @@ void ScInterpreter::ScDebugVar()
             fVal = pDPs->GetCount();
         }
         PushDouble(fVal);
-        return;
     }
-
-    PushIllegalParameter();
+    else if (aStrUpper == "DATASTREAM_IMPORT")
+        PushDouble( sc::datastream_get_time( 0 ) );
+    else if (aStrUpper == "DATASTREAM_RECALC")
+        PushDouble( sc::datastream_get_time( 1 ) );
+    else if (aStrUpper == "DATASTREAM_RENDER")
+        PushDouble( sc::datastream_get_time( 2 ) );
+    else
+        PushIllegalParameter();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index d43fdeb..4e7e1ee 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -38,6 +38,24 @@
 
 namespace sc {
 
+extern double datastream_get_time(int nIdx);
+
+enum {
+    DEBUG_TIME_IMPORT,
+    DEBUG_TIME_RECALC,
+    DEBUG_TIME_RENDER,
+    DEBUG_TIME_MAX
+};
+
+static double fTimes[DEBUG_TIME_MAX] = { 0.0, 0.0, 0.0 };
+
+double datastream_get_time(int nIdx)
+{
+    if( nIdx < 0 || nIdx > (int)SAL_N_ELEMENTS( fTimes ) )
+        return -1;
+    return fTimes[ nIdx ];
+}
+
 inline double getNow()
 {
     TimeValue now;
@@ -353,10 +371,14 @@ void DataStream::Refresh()
 {
     Application::Yield();
 
+    double fStart = getNow();
+
     // Hard recalc will repaint the grid area.
     mpDocShell->DoHardRecalc(true);
     mpDocShell->SetDocumentModified(true);
 
+    fTimes[ DEBUG_TIME_RECALC ] = getNow() - fStart;
+
     mfLastRefreshTime = getNow();
     mnLinesSinceRefresh = 0;
 }
@@ -476,6 +498,8 @@ void DataStream::Text2Doc()
         return;
     }
 
+    double fStart = getNow();
+
     MoveData();
     {
         StrValArray::const_iterator it = rStrs.begin(), itEnd = rStrs.end();
@@ -489,6 +513,8 @@ void DataStream::Text2Doc()
             maDocAccess.setNumericCell(it->maPos, it->mfVal);
     }
 
+    fTimes[ DEBUG_TIME_IMPORT ] = getNow() - fStart;
+
     if (meMove == NO_MOVE)
         return;
 


More information about the Libreoffice-commits mailing list