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

Side by Side Diff: gpu/perftests/texture_upload_perftest.cc

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Created 3 years, 8 months 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
OLDNEW
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>
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::small_map<std::map<std::string, Measurement>>
danakj 2017/04/18 21:35:50 Seems overkill to use small_map in test code like
405 aggregates; // indexed by name 405 aggregates; // indexed by name
406 int successful_runs = 0; 406 int successful_runs = 0;
407 GLuint texture_id = CreateGLTexture(format, size, subimage); 407 GLuint texture_id = CreateGLTexture(format, size, subimage);
408 for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) { 408 for (int i = 0; i < kUploadPerfWarmupRuns + kUploadPerfTestRuns; ++i) {
409 GenerateTextureData(size, GLFormatBytePerPixel(format), i + 1, &pixels); 409 GenerateTextureData(size, GLFormatBytePerPixel(format), i + 1, &pixels);
410 auto run = UploadAndDraw(texture_id, size, pixels, format, subimage); 410 auto run = UploadAndDraw(texture_id, size, pixels, format, subimage);
411 if (i < kUploadPerfWarmupRuns || run.empty()) { 411 if (i < kUploadPerfWarmupRuns || run.empty()) {
412 continue; 412 continue;
413 } 413 }
414 successful_runs++; 414 successful_runs++;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 gpu_timing_client_->CheckAndResetTimerErrors(); 551 gpu_timing_client_->CheckAndResetTimerErrors();
552 if (!gpu_timer_errors) { 552 if (!gpu_timer_errors) {
553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") 553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw")
554 .PrintResult("renaming"); 554 .PrintResult("renaming");
555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); 555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming");
556 } 556 }
557 } 557 }
558 558
559 } // namespace 559 } // namespace
560 } // namespace gpu 560 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698