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

Side by Side Diff: bench/benchmain.cpp

Issue 16069010: extend SkBenchmark to allow a bench to return a durationScale, which allows it to perform fewer act… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | 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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "BenchTimer.h" 10 #include "BenchTimer.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 // record timer values for each repeat, and their sum 908 // record timer values for each repeat, and their sum
909 TimerData timerData(perIterTimeformat, normalTimeFormat); 909 TimerData timerData(perIterTimeformat, normalTimeFormat);
910 for (int i = 0; i < repeatDraw; i++) { 910 for (int i = 0; i < repeatDraw; i++) {
911 if ((benchMode == kRecord_benchModes || benchMode == kPictureRec ord_benchModes)) { 911 if ((benchMode == kRecord_benchModes || benchMode == kPictureRec ord_benchModes)) {
912 // This will clear the recorded commands so that they do not 912 // This will clear the recorded commands so that they do not
913 // accumulate. 913 // accumulate.
914 canvas = pictureRecordTo.beginRecording(dim.fX, dim.fY, 914 canvas = pictureRecordTo.beginRecording(dim.fX, dim.fY,
915 SkPicture::kUsePathBoundsForClip_RecordingFlag); 915 SkPicture::kUsePathBoundsForClip_RecordingFlag);
916 } 916 }
917 917
918 timer->start(); 918 timer->start(bench->getDurationScale());
919 if (NULL != canvas) { 919 if (NULL != canvas) {
920 canvas->save(); 920 canvas->save();
921 } 921 }
922 if (benchMode == kPictureRecord_benchModes) { 922 if (benchMode == kPictureRecord_benchModes) {
923 pictureRecordFrom.draw(canvas); 923 pictureRecordFrom.draw(canvas);
924 } else { 924 } else {
925 bench->draw(canvas); 925 bench->draw(canvas);
926 } 926 }
927 927
928 if (kDeferredSilent_benchModes == benchMode) { 928 if (kDeferredSilent_benchModes == benchMode) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } 987 }
988 988
989 return 0; 989 return 0;
990 } 990 }
991 991
992 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 992 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
993 int main(int argc, char * const argv[]) { 993 int main(int argc, char * const argv[]) {
994 return tool_main(argc, (char**) argv); 994 return tool_main(argc, (char**) argv);
995 } 995 }
996 #endif 996 #endif
OLDNEW
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698