aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/GpuTimer.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-10-04 12:49:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-04 12:49:45 -0700
commit56df2de7fb48e879446938f47464c7a2c8223616 (patch)
tree110fd354fbab83a3902f2e94157ec426837c2cfa /tools/gpu/GpuTimer.h
parent60b0a2d85cb8f9a8fcb91a77b1994a6177f3725f (diff)
Revert of skpbench: add option for gpu timing (patchset #7 id:120001 of https://codereview.chromium.org/2388433003/ )
Reason for revert: many bots failing Original issue's description: > skpbench: add option for gpu timing > > Adds a gpu timing option with a GL implementation. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2388433003 > > Committed: https://skia.googlesource.com/skia/+/c06720d06faab3b01eba1b8693e0ac791f06dc96 TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2390383002
Diffstat (limited to 'tools/gpu/GpuTimer.h')
-rw-r--r--tools/gpu/GpuTimer.h77
1 files changed, 0 insertions, 77 deletions
diff --git a/tools/gpu/GpuTimer.h b/tools/gpu/GpuTimer.h
deleted file mode 100644
index d9e320e0a0..0000000000
--- a/tools/gpu/GpuTimer.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GpuTimer_DEFINED
-#define GpuTimer_DEFINED
-
-#include "SkTypes.h"
-#include "SkExchange.h"
-#include <chrono>
-
-namespace sk_gpu_test {
-
-using PlatformTimerQuery = intptr_t;
-static constexpr PlatformTimerQuery kInvalidTimerQuery = 0;
-
-/**
- * Platform-independent interface for timing operations on the GPU.
- */
-class GpuTimer {
-public:
- GpuTimer(bool disjointSupport)
- : fDisjointSupport(disjointSupport)
- , fActiveTimer(kInvalidTimerQuery) {
- }
- virtual ~GpuTimer() { SkASSERT(!fActiveTimer); }
-
- /**
- * Returns whether this timer can detect disjoint GPU operations while timing. If false, a query
- * has less confidence when it completes with QueryStatus::kAccurate.
- */
- bool disjointSupport() const { return fDisjointSupport; }
-
- /**
- * Inserts a "start timing" command in the GPU command stream.
- */
- void queueStart() {
- SkASSERT(!fActiveTimer);
- fActiveTimer = this->onQueueTimerStart();
- }
-
- /**
- * Inserts a "stop timing" command in the GPU command stream.
- *
- * @return a query object that can retrieve the time elapsed once the timer has completed.
- */
- PlatformTimerQuery SK_WARN_UNUSED_RESULT queueStop() {
- SkASSERT(fActiveTimer);
- this->onQueueTimerStop(fActiveTimer);
- return skstd::exchange(fActiveTimer, kInvalidTimerQuery);
- }
-
- enum class QueryStatus {
- kInvalid, //<! the timer query is invalid.
- kPending, //<! the timer is still running on the GPU.
- kDisjoint, //<! the query is complete, but dubious due to disjoint GPU operations.
- kAccurate //<! the query is complete and reliable.
- };
-
- virtual QueryStatus checkQueryStatus(PlatformTimerQuery) = 0;
- virtual std::chrono::nanoseconds getTimeElapsed(PlatformTimerQuery) = 0;
- virtual void deleteQuery(PlatformTimerQuery) = 0;
-
-private:
- virtual PlatformTimerQuery onQueueTimerStart() const = 0;
- virtual void onQueueTimerStop(PlatformTimerQuery) const = 0;
-
- bool const fDisjointSupport;
- PlatformTimerQuery fActiveTimer;
-};
-
-} // namespace sk_gpu_test
-
-#endif