OLD | NEW |
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 m_context->unmapTexSubImage2DCHROMIUM(pixel_dest); | 341 m_context->unmapTexSubImage2DCHROMIUM(pixel_dest); |
342 } | 342 } |
343 | 343 |
344 void TextureUploader::processQueries() | 344 void TextureUploader::processQueries() |
345 { | 345 { |
346 while (!m_pendingQueries.empty()) { | 346 while (!m_pendingQueries.empty()) { |
347 if (m_pendingQueries.front()->isPending()) | 347 if (m_pendingQueries.front()->isPending()) |
348 break; | 348 break; |
349 | 349 |
350 unsigned usElapsed = m_pendingQueries.front()->value(); | 350 unsigned usElapsed = m_pendingQueries.front()->value(); |
351 HISTOGRAM_CUSTOM_COUNTS("Renderer4.TextureGpuUploadTimeUS", usElapsed, 0
, 100000, 50); | 351 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.TextureGpuUploadTimeUS", |
| 352 usElapsed, 0, 100000, 50); |
352 | 353 |
353 // Clamp the queries to saner values in case the queries fail. | 354 // Clamp the queries to saner values in case the queries fail. |
354 usElapsed = std::max(1u, usElapsed); | 355 usElapsed = std::max(1u, usElapsed); |
355 usElapsed = std::min(15000u, usElapsed); | 356 usElapsed = std::min(15000u, usElapsed); |
356 | 357 |
357 if (!m_pendingQueries.front()->isNonBlocking()) | 358 if (!m_pendingQueries.front()->isNonBlocking()) |
358 m_numBlockingTextureUploads--; | 359 m_numBlockingTextureUploads--; |
359 | 360 |
360 // Remove the min and max value from our history and insert the new one. | 361 // Remove the min and max value from our history and insert the new one. |
361 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); | 362 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); |
362 if (m_texturesPerSecondHistory.size() >= uploadHistorySizeMax) { | 363 if (m_texturesPerSecondHistory.size() >= uploadHistorySizeMax) { |
363 m_texturesPerSecondHistory.erase(m_texturesPerSecondHistory.begin())
; | 364 m_texturesPerSecondHistory.erase(m_texturesPerSecondHistory.begin())
; |
364 m_texturesPerSecondHistory.erase(--m_texturesPerSecondHistory.end())
; | 365 m_texturesPerSecondHistory.erase(--m_texturesPerSecondHistory.end())
; |
365 } | 366 } |
366 m_texturesPerSecondHistory.insert(texturesPerSecond); | 367 m_texturesPerSecondHistory.insert(texturesPerSecond); |
367 | 368 |
368 m_availableQueries.push_back(m_pendingQueries.take_front()); | 369 m_availableQueries.push_back(m_pendingQueries.take_front()); |
369 } | 370 } |
370 } | 371 } |
371 | 372 |
372 } // namespace cc | 373 } // namespace cc |
OLD | NEW |