| Index: debugger/QT/SkDebuggerGUI.cpp
|
| diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
|
| index 4901d6238946ed17463f1e0b1de552d3ba76eb31..4b87f0f841077247cf150e7ace28b143aefc117d 100644
|
| --- a/debugger/QT/SkDebuggerGUI.cpp
|
| +++ b/debugger/QT/SkDebuggerGUI.cpp
|
| @@ -155,192 +155,6 @@ void SkDebuggerGUI::showDeletes() {
|
| item->setHidden(fDebugger.isCommandVisible(row) && fDeletesActivated);
|
| }
|
| }
|
| -
|
| -// The timed picture playback just steps through every operation timing
|
| -// each one individually. Note that each picture should be replayed multiple
|
| -// times (via calls to 'draw') before each command's time is accessed via 'time'.
|
| -class SkTimedPicturePlayback : public SkPicturePlayback {
|
| -public:
|
| -
|
| - SkTimedPicturePlayback(const SkPicture* picture, const SkTDArray<bool>& deletedCommands)
|
| - : INHERITED(picture)
|
| - , fSkipCommands(deletedCommands)
|
| - , fTot(0.0)
|
| - , fCurCommand(0) {
|
| - fTimes.setCount(deletedCommands.count());
|
| - fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1);
|
| - this->resetTimes();
|
| - }
|
| -
|
| - virtual void draw(SkCanvas* canvas, SkDrawPictureCallback* callback) SK_OVERRIDE {
|
| - AutoResetOpID aroi(this);
|
| - SkASSERT(0 == fCurOffset);
|
| -
|
| - SkReader32 reader(fPictureData->opData()->bytes(), fPictureData->opData()->size());
|
| -
|
| - // Record this, so we can concat w/ it if we encounter a setMatrix()
|
| - SkMatrix initialMatrix = canvas->getTotalMatrix();
|
| -
|
| - SkAutoCanvasRestore acr(canvas, false);
|
| -
|
| - int opIndex = -1;
|
| -
|
| - while (!reader.eof()) {
|
| - if (callback && callback->abortDrawing()) {
|
| - return;
|
| - }
|
| -
|
| - fCurOffset = reader.offset();
|
| - uint32_t size;
|
| - DrawType op = ReadOpAndSize(&reader, &size);
|
| - if (NOOP == op) {
|
| - // NOOPs are to be ignored - do not propagate them any further
|
| - reader.setOffset(fCurOffset + size);
|
| - continue;
|
| - }
|
| -
|
| - opIndex++;
|
| -
|
| - if (this->preDraw(opIndex, op)) {
|
| - // This operation is disabled in the debugger's GUI
|
| - reader.setOffset(fCurOffset + size);
|
| - continue;
|
| - }
|
| -
|
| - this->handleOp(&reader, op, size, canvas, initialMatrix);
|
| -
|
| - this->postDraw(opIndex);
|
| - }
|
| - }
|
| -
|
| - void resetTimes() {
|
| - for (int i = 0; i < fTimes.count(); ++i) {
|
| - fTimes[i] = 0.0;
|
| - }
|
| - for (int i = 0; i < fTypeTimes.count(); ++i) {
|
| - fTypeTimes[i] = 0.0f;
|
| - }
|
| - fTot = 0.0;
|
| - }
|
| -
|
| - int count() const { return fTimes.count(); }
|
| -
|
| - // Return the fraction of the total time consumed by the index-th operation
|
| - double time(int index) const { return fTimes[index] / fTot; }
|
| -
|
| - const SkTDArray<double>* typeTimes() const { return &fTypeTimes; }
|
| -
|
| - double totTime() const { return fTot; }
|
| -
|
| -protected:
|
| - SysTimer fTimer;
|
| - SkTDArray<bool> fSkipCommands; // has the command been deleted in the GUI?
|
| - SkTDArray<double> fTimes; // sum of time consumed for each command
|
| - SkTDArray<double> fTypeTimes; // sum of time consumed for each type of command (e.g., drawPath)
|
| - double fTot; // total of all times in 'fTimes'
|
| -
|
| - int fCurType;
|
| - int fCurCommand; // the current command being executed/timed
|
| -
|
| - bool preDraw(int opIndex, int type) {
|
| - fCurCommand = opIndex;
|
| -
|
| - if (fSkipCommands[fCurCommand]) {
|
| - return true;
|
| - }
|
| -
|
| - fCurType = type;
|
| - // The SkDebugCanvas doesn't recognize these types. This class needs to
|
| - // convert or else we'll wind up with a mismatch between the type counts
|
| - // the debugger displays and the profile times.
|
| - if (DRAW_POS_TEXT_TOP_BOTTOM == type) {
|
| - fCurType = DRAW_POS_TEXT;
|
| - } else if (DRAW_POS_TEXT_H_TOP_BOTTOM == type) {
|
| - fCurType = DRAW_POS_TEXT_H;
|
| - }
|
| -
|
| -#if defined(SK_BUILD_FOR_WIN32)
|
| - // CPU timer doesn't work well on Windows
|
| - fTimer.startWall();
|
| -#else
|
| - fTimer.startCpu();
|
| -#endif
|
| -
|
| - return false;
|
| - }
|
| -
|
| - void postDraw(int opIndex) {
|
| -#if defined(SK_BUILD_FOR_WIN32)
|
| - // CPU timer doesn't work well on Windows
|
| - double time = fTimer.endWall();
|
| -#else
|
| - double time = fTimer.endCpu();
|
| -#endif
|
| -
|
| - SkASSERT(opIndex == fCurCommand);
|
| - SkASSERT(fCurType <= LAST_DRAWTYPE_ENUM);
|
| -
|
| - fTimes[fCurCommand] += time;
|
| - fTypeTimes[fCurType] += time;
|
| - fTot += time;
|
| - }
|
| -
|
| -private:
|
| - typedef SkPicturePlayback INHERITED;
|
| -};
|
| -
|
| -#if 0
|
| -// Wrap SkPicture to allow installation of an SkTimedPicturePlayback object
|
| -class SkTimedPicture : public SkPicture {
|
| -public:
|
| - static SkTimedPicture* CreateTimedPicture(SkStream* stream,
|
| - SkPicture::InstallPixelRefProc proc,
|
| - const SkTDArray<bool>& deletedCommands) {
|
| - SkPictInfo info;
|
| - if (!InternalOnly_StreamIsSKP(stream, &info)) {
|
| - return NULL;
|
| - }
|
| -
|
| - // Check to see if there is a playback to recreate.
|
| - if (stream->readBool()) {
|
| - SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFromStream(
|
| - stream,
|
| - info, proc,
|
| - deletedCommands);
|
| - if (NULL == playback) {
|
| - return NULL;
|
| - }
|
| -
|
| - return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeight));
|
| - }
|
| -
|
| - return NULL;
|
| - }
|
| -
|
| - void resetTimes() { ((SkTimedPicturePlayback*) fData.get())->resetTimes(); }
|
| -
|
| - int count() const { return ((SkTimedPicturePlayback*) fData.get())->count(); }
|
| -
|
| - // return the fraction of the total time this command consumed
|
| - double time(int index) const { return ((SkTimedPicturePlayback*) fData.get())->time(index); }
|
| -
|
| - const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback*) fData.get())->typeTimes(); }
|
| -
|
| - double totTime() const { return ((SkTimedPicturePlayback*) fData.get())->totTime(); }
|
| -
|
| -private:
|
| - // disallow default ctor b.c. we don't have a good way to setup the fData ptr
|
| - SkTimedPicture();
|
| - // Private ctor only used by CreateTimedPicture, which has created the playback.
|
| - SkTimedPicture(SkTimedPicturePlayback* playback, int width, int height)
|
| - : INHERITED(playback, width, height) {}
|
| - // disallow the copy ctor - enabling would require copying code from SkPicture
|
| - SkTimedPicture(const SkTimedPicture& src);
|
| -
|
| - typedef SkPicture INHERITED;
|
| -};
|
| -#endif
|
| -
|
| // This is a simplification of PictureBenchmark's run with the addition of
|
| // clearing of the times after the first pass (in resetTimes)
|
| void SkDebuggerGUI::run(const SkPicture* pict,
|
| @@ -362,11 +176,6 @@ void SkDebuggerGUI::run(const SkPicture* pict,
|
| renderer->render();
|
| renderer->resetState(true); // flush, swapBuffers and Finish
|
|
|
| -#if 0
|
| - // We throw this away the first batch of times to remove first time effects (such as paging in this program)
|
| - pict->resetTimes();
|
| -#endif
|
| -
|
| for (int i = 0; i < repeats; ++i) {
|
| renderer->setup();
|
| renderer->render();
|
| @@ -399,60 +208,6 @@ void SkDebuggerGUI::actionProfile() {
|
| if (NULL == picture.get()) {
|
| return;
|
| }
|
| -
|
| -
|
| -#if 0
|
| -
|
| - // For now this #if allows switching between tiled and simple rendering
|
| - // modes. Eventually this will be accomplished via the GUI
|
| -#if 0
|
| - // With the current batch of SysTimers, profiling in tiled mode
|
| - // gets swamped by the timing overhead:
|
| - //
|
| - // tile mode simple mode
|
| - // debugger 64.2ms 12.8ms
|
| - // bench_pictures 16.9ms 12.4ms
|
| - //
|
| - // This is b.c. in tiled mode each command is called many more times
|
| - // but typically does less work on each invocation (due to clipping)
|
| - sk_tools::TiledPictureRenderer* renderer = NULL;
|
| -
|
| - renderer = SkNEW(sk_tools::TiledPictureRenderer);
|
| - renderer->setTileWidth(256);
|
| - renderer->setTileHeight(256);
|
| -#else
|
| - sk_tools::SimplePictureRenderer* renderer = NULL;
|
| -
|
| - renderer = SkNEW(sk_tools::SimplePictureRenderer);
|
| -
|
| -#if SK_SUPPORT_GPU
|
| - if (fSettingsWidget.isGLActive()) {
|
| - renderer->setDeviceType(sk_tools::PictureRenderer::kGPU_DeviceType);
|
| - renderer->setSampleCount(fSettingsWidget.getGLSampleCount());
|
| - }
|
| -#endif
|
| -
|
| -#endif
|
| -
|
| - static const int kNumRepeats = 10;
|
| -
|
| - run(picture.get(), renderer, kNumRepeats);
|
| -
|
| - SkASSERT(picture->count() == fListWidget.count());
|
| -
|
| - // extract the individual command times from the SkTimedPlaybackPicture
|
| - for (int i = 0; i < picture->count(); ++i) {
|
| - double temp = picture->time(i);
|
| -
|
| - QListWidgetItem* item = fListWidget.item(i);
|
| -
|
| - item->setData(Qt::UserRole + 4, 100.0*temp);
|
| - }
|
| -
|
| - setupOverviewText(picture->typeTimes(), picture->totTime(), kNumRepeats);
|
| - setupClipStackText();
|
| -
|
| -#endif
|
| }
|
|
|
| void SkDebuggerGUI::actionCancel() {
|
|
|