Chromium Code Reviews| Index: gpu/perftests/texture_upload_perftest.cc |
| diff --git a/gpu/perftests/texture_upload_perftest.cc b/gpu/perftests/texture_upload_perftest.cc |
| index 2e9ef6cea4346d217eeae515b89db88f9e0cf40f..86e72c4ccebdfb5f62cfe16dea6507ebae6ee57f 100644 |
| --- a/gpu/perftests/texture_upload_perftest.cc |
| +++ b/gpu/perftests/texture_upload_perftest.cc |
| @@ -12,6 +12,7 @@ |
| #include "gpu/command_buffer/service/gpu_timing.h" |
| #include "gpu/perftests/measurements.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#include "testing/perf/perf_test.h" |
| #include "ui/gfx/geometry/size.h" |
| #include "ui/gl/gl_bindings.h" |
| #include "ui/gl/gl_context.h" |
| @@ -232,10 +233,14 @@ class TextureUploadPerfTest : public testing::Test { |
| EXPECT_EQ(pixels, pixels_rendered); |
| std::vector<Measurement> measurements; |
| - measurements.push_back(total_timers.GetAsMeasurement("total")); |
| - measurements.push_back(tex_timers.GetAsMeasurement("teximage2d")); |
| - measurements.push_back(draw_timers.GetAsMeasurement("drawarrays")); |
| - measurements.push_back(finish_timers.GetAsMeasurement("finish")); |
| + bool gpu_timer_errors = |
| + gpu_timing_.IsAvailable() && gpu_timing_.CheckAndResetTimerErrors(); |
| + if (!gpu_timer_errors) { |
| + measurements.push_back(total_timers.GetAsMeasurement("total")); |
| + measurements.push_back(tex_timers.GetAsMeasurement("teximage2d")); |
| + measurements.push_back(draw_timers.GetAsMeasurement("drawarrays")); |
| + measurements.push_back(finish_timers.GetAsMeasurement("finish")); |
| + } |
| return measurements; |
| } |
| @@ -259,22 +264,27 @@ TEST_F(TextureUploadPerfTest, glTexImage2d) { |
| std::vector<uint8> pixels; |
| base::SmallMap<std::map<std::string, Measurement>> |
| aggregates; // indexed by name |
| + size_t successful_runs = 0; |
| for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) { |
| GenerateTextureData(size_, i + 1, &pixels); |
| auto run = UploadAndDraw(pixels, GL_RGBA, GL_UNSIGNED_BYTE); |
| if (i >= kUploadPerfWarmupRuns) { |
|
reveman
2015/02/23 16:48:29
nit: maybe "if (i < kUpload...) continue" to reduc
Daniele Castagna
2015/02/23 16:59:25
Done.
|
| - for (const Measurement& m : run) { |
| - auto& agg = aggregates[m.name]; |
| - agg.name = m.name; |
| - agg.Increment(m); |
| + if (run.size() > 0) { |
|
reveman
2015/02/23 16:48:29
Nit: if (!run.size()) continue;
Daniele Castagna
2015/02/23 16:59:26
I moved this with the previous check.
Done.
|
| + successful_runs++; |
| + for (const Measurement& m : run) { |
|
reveman
2015/02/23 16:48:29
nit: s/m/measurement/
Daniele Castagna
2015/02/23 16:59:25
Done.
|
| + auto& agg = aggregates[m.name]; |
|
reveman
2015/02/23 16:48:29
nit: s/agg/aggregate/
Daniele Castagna
2015/02/23 16:59:26
Done.
|
| + agg.name = m.name; |
| + agg.Increment(m); |
| + } |
| } |
| } |
| } |
| for (const auto& entry : aggregates) { |
| - const auto m = entry.second.Divide(kUploadPerfTestRuns); |
| + const auto m = entry.second.Divide(successful_runs); |
| m.PrintResult(); |
| } |
| + perf_test::PrintResult("sample_runs", "", "", successful_runs, "laps", true); |
| } |
| } // namespace |