Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: gpu/command_buffer/service/query_manager.cc

Issue 732423002: Update from chromium https://crrev.com/304586 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/query_manager.cc
diff --git a/gpu/command_buffer/service/query_manager.cc b/gpu/command_buffer/service/query_manager.cc
index fdb5fa82f27fb6c5b816c4ad00b9e38fce6bf6de..8b753337deee345aa95953051eeb34a17a1d0772 100644
--- a/gpu/command_buffer/service/query_manager.cc
+++ b/gpu/command_buffer/service/query_manager.cc
@@ -408,6 +408,7 @@ class CommandsCompletedQuery : public QueryManager::Query {
private:
scoped_ptr<gfx::GLFence> fence_;
+ base::TimeTicks begin_time_;
};
CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager,
@@ -416,7 +417,10 @@ CommandsCompletedQuery::CommandsCompletedQuery(QueryManager* manager,
uint32 shm_offset)
: Query(manager, target, shm_id, shm_offset) {}
-bool CommandsCompletedQuery::Begin() { return true; }
+bool CommandsCompletedQuery::Begin() {
+ begin_time_ = base::TimeTicks::HighResNow();
+ return true;
+}
bool CommandsCompletedQuery::End(base::subtle::Atomic32 submit_count) {
fence_.reset(gfx::GLFence::Create());
@@ -428,13 +432,11 @@ bool CommandsCompletedQuery::Process(bool did_finish) {
// Note: |did_finish| guarantees that the GPU has passed the fence but
// we cannot assume that GLFence::HasCompleted() will return true yet as
// that's not guaranteed by all GLFence implementations.
- //
- // TODO(reveman): Add UMA stats to determine how common it is that glFinish()
- // needs to be called for these queries to complete. crbug.com/431845
if (!did_finish && fence_ && !fence_->HasCompleted())
return true;
- return MarkAsCompleted(0);
+ base::TimeDelta elapsed = base::TimeTicks::HighResNow() - begin_time_;
+ return MarkAsCompleted(elapsed.InMicroseconds());
}
void CommandsCompletedQuery::Destroy(bool have_context) {
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | gpu/command_buffer/tests/gl_clear_framebuffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698