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

Side by Side Diff: cc/texture_uploader.cc

Issue 11434111: Clamp texture queries to sane values. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Increase upper limit of a query Created 8 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/texture_uploader.h" 5 #include "cc/texture_uploader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 void TextureUploader::processQueries() 347 void TextureUploader::processQueries()
348 { 348 {
349 while (!m_pendingQueries.isEmpty()) { 349 while (!m_pendingQueries.isEmpty()) {
350 if (m_pendingQueries.first()->isPending()) 350 if (m_pendingQueries.first()->isPending())
351 break; 351 break;
352 352
353 unsigned usElapsed = m_pendingQueries.first()->value(); 353 unsigned usElapsed = m_pendingQueries.first()->value();
354 HISTOGRAM_CUSTOM_COUNTS("Renderer4.TextureGpuUploadTimeUS", usElapsed, 0 , 100000, 50); 354 HISTOGRAM_CUSTOM_COUNTS("Renderer4.TextureGpuUploadTimeUS", usElapsed, 0 , 100000, 50);
355 355
356 // Clamp the queries to saner values in case the queries fail.
357 usElapsed = std::max(1u, usElapsed);
358 usElapsed = std::min(15000u, usElapsed);
359
356 if (!m_pendingQueries.first()->isNonBlocking()) 360 if (!m_pendingQueries.first()->isNonBlocking())
357 m_numBlockingTextureUploads--; 361 m_numBlockingTextureUploads--;
358 362
359 // Remove the min and max value from our history and insert the new one. 363 // Remove the min and max value from our history and insert the new one.
360 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); 364 double texturesPerSecond = 1.0 / (usElapsed * 1e-6);
361 if (m_texturesPerSecondHistory.size() >= uploadHistorySizeMax) { 365 if (m_texturesPerSecondHistory.size() >= uploadHistorySizeMax) {
362 m_texturesPerSecondHistory.erase(m_texturesPerSecondHistory.begin()) ; 366 m_texturesPerSecondHistory.erase(m_texturesPerSecondHistory.begin()) ;
363 m_texturesPerSecondHistory.erase(--m_texturesPerSecondHistory.end()) ; 367 m_texturesPerSecondHistory.erase(--m_texturesPerSecondHistory.end()) ;
364 } 368 }
365 m_texturesPerSecondHistory.insert(texturesPerSecond); 369 m_texturesPerSecondHistory.insert(texturesPerSecond);
366 370
367 m_availableQueries.append(m_pendingQueries.takeFirst()); 371 m_availableQueries.append(m_pendingQueries.takeFirst());
368 } 372 }
369 } 373 }
370 374
371 } // namespace cc 375 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698