OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/small_map.h" | 12 #include "base/containers/flat_map.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "gpu/perftests/measurements.h" | 16 #include "gpu/perftests/measurements.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "testing/perf/perf_test.h" | 19 #include "testing/perf/perf_test.h" |
20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
21 #include "ui/gfx/geometry/vector2d_f.h" | 21 #include "ui/gfx/geometry/vector2d_f.h" |
22 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 measurements.push_back(draw_timers.GetAsMeasurement("drawarrays")); | 394 measurements.push_back(draw_timers.GetAsMeasurement("drawarrays")); |
395 measurements.push_back(finish_timers.GetAsMeasurement("finish")); | 395 measurements.push_back(finish_timers.GetAsMeasurement("finish")); |
396 } | 396 } |
397 return measurements; | 397 return measurements; |
398 } | 398 } |
399 | 399 |
400 void RunUploadAndDrawMultipleTimes(const gfx::Size& size, | 400 void RunUploadAndDrawMultipleTimes(const gfx::Size& size, |
401 const GLenum format, | 401 const GLenum format, |
402 const bool subimage) { | 402 const bool subimage) { |
403 std::vector<uint8_t> pixels; | 403 std::vector<uint8_t> pixels; |
404 base::SmallMap<std::map<std::string, Measurement>> | 404 base::flat_map<std::string, Measurement> aggregates; // indexed by name |
405 aggregates; // indexed by name | |
406 int successful_runs = 0; | 405 int successful_runs = 0; |
407 GLuint texture_id = CreateGLTexture(format, size, subimage); | 406 GLuint texture_id = CreateGLTexture(format, size, subimage); |
408 for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) { | 407 for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) { |
409 GenerateTextureData(size, GLFormatBytePerPixel(format), i + 1, &pixels); | 408 GenerateTextureData(size, GLFormatBytePerPixel(format), i + 1, &pixels); |
410 auto run = UploadAndDraw(texture_id, size, pixels, format, subimage); | 409 auto run = UploadAndDraw(texture_id, size, pixels, format, subimage); |
411 if (i < kUploadPerfWarmupRuns || run.empty()) { | 410 if (i < kUploadPerfWarmupRuns || run.empty()) { |
412 continue; | 411 continue; |
413 } | 412 } |
414 successful_runs++; | 413 successful_runs++; |
415 for (const Measurement& measurement : run) { | 414 for (const Measurement& measurement : run) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 gpu_timing_client_->CheckAndResetTimerErrors(); | 550 gpu_timing_client_->CheckAndResetTimerErrors(); |
552 if (!gpu_timer_errors) { | 551 if (!gpu_timer_errors) { |
553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") | 552 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") |
554 .PrintResult("renaming"); | 553 .PrintResult("renaming"); |
555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); | 554 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); |
556 } | 555 } |
557 } | 556 } |
558 | 557 |
559 } // namespace | 558 } // namespace |
560 } // namespace gpu | 559 } // namespace gpu |
OLD | NEW |