diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2013-12-28 22:45:00 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2013-12-28 22:48:10 +0000 |
commit | 7a4b8676a283d629d952ceb5c59327827838124d (patch) | |
tree | c4b94a67f3ef92f3ce61c0a84d6c5112bf19c730 /sc/source | |
parent | 00dbff8c223953d769d47ac24e7eb5427add1c0f (diff) |
implement datastream timings.
Change-Id: I8b3a1747ff291cbfcc650887bb8557fb5dc24c0d
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/interpr7.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/docshell/datastream.cxx | 26 |
2 files changed, 40 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index aa07090cdd41..91f7116b5eea 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 d43fdeb7da14..4e7e1ee31a95 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; |