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

Side by Side Diff: bench/nanobench.cpp

Issue 773323002: Upload picture byte size and op count metrics for SKP recording. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « bench/ResultsWriter.h ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <ctype.h> 8 #include <ctype.h>
9 9
10 #include "Benchmark.h" 10 #include "Benchmark.h"
11 #include "CrashHandler.h" 11 #include "CrashHandler.h"
12 #include "GMBench.h" 12 #include "GMBench.h"
13 #include "ProcStats.h" 13 #include "ProcStats.h"
14 #include "ResultsWriter.h" 14 #include "ResultsWriter.h"
15 #include "RecordingBench.h" 15 #include "RecordingBench.h"
16 #include "SKPBench.h" 16 #include "SKPBench.h"
17 #include "Stats.h" 17 #include "Stats.h"
18 #include "Timer.h" 18 #include "Timer.h"
19 19
20 #include "SkBBoxHierarchy.h" 20 #include "SkBBoxHierarchy.h"
21 #include "SkCanvas.h" 21 #include "SkCanvas.h"
22 #include "SkCommonFlags.h" 22 #include "SkCommonFlags.h"
23 #include "SkForceLinking.h" 23 #include "SkForceLinking.h"
24 #include "SkGraphics.h" 24 #include "SkGraphics.h"
25 #include "SkOSFile.h" 25 #include "SkOSFile.h"
26 #include "SkPictureRecorder.h" 26 #include "SkPictureRecorder.h"
27 #include "SkPictureUtils.h"
27 #include "SkString.h" 28 #include "SkString.h"
28 #include "SkSurface.h" 29 #include "SkSurface.h"
29 #include "SkTaskGroup.h" 30 #include "SkTaskGroup.h"
30 31
31 #if SK_SUPPORT_GPU 32 #if SK_SUPPORT_GPU
32 #include "gl/GrGLDefines.h" 33 #include "gl/GrGLDefines.h"
33 #include "GrContextFactory.h" 34 #include "GrContextFactory.h"
34 SkAutoTDelete<GrContextFactory> gGrFactory; 35 SkAutoTDelete<GrContextFactory> gGrFactory;
35 #endif 36 #endif
36 37
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 // First add all .skps as RecordingBenches. 518 // First add all .skps as RecordingBenches.
518 while (fCurrentRecording < fSKPs.count()) { 519 while (fCurrentRecording < fSKPs.count()) {
519 const SkString& path = fSKPs[fCurrentRecording++]; 520 const SkString& path = fSKPs[fCurrentRecording++];
520 SkAutoTUnref<SkPicture> pic; 521 SkAutoTUnref<SkPicture> pic;
521 if (!ReadPicture(path.c_str(), &pic)) { 522 if (!ReadPicture(path.c_str(), &pic)) {
522 continue; 523 continue;
523 } 524 }
524 SkString name = SkOSPath::Basename(path.c_str()); 525 SkString name = SkOSPath::Basename(path.c_str());
525 fSourceType = "skp"; 526 fSourceType = "skp";
526 fBenchType = "recording"; 527 fBenchType = "recording";
528 fSKPBytes = SkPictureUtils::ApproximateBytesUsed(pic);
529 fSKPOps = pic->approximateOpCount();
527 return SkNEW_ARGS(RecordingBench, (name.c_str(), pic.get(), FLAGS_bb h)); 530 return SkNEW_ARGS(RecordingBench, (name.c_str(), pic.get(), FLAGS_bb h));
528 } 531 }
529 532
530 // Then once each for each scale as SKPBenches (playback). 533 // Then once each for each scale as SKPBenches (playback).
531 while (fCurrentScale < fScales.count()) { 534 while (fCurrentScale < fScales.count()) {
532 while (fCurrentSKP < fSKPs.count()) { 535 while (fCurrentSKP < fSKPs.count()) {
533 const SkString& path = fSKPs[fCurrentSKP]; 536 const SkString& path = fSKPs[fCurrentSKP];
534 SkAutoTUnref<SkPicture> pic; 537 SkAutoTUnref<SkPicture> pic;
535 if (!ReadPicture(path.c_str(), &pic)) { 538 if (!ReadPicture(path.c_str(), &pic)) {
536 fCurrentSKP++; 539 fCurrentSKP++;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 if (0 == strcmp(fSourceType, "skp")) { 574 if (0 == strcmp(fSourceType, "skp")) {
572 log->configOption("clip", 575 log->configOption("clip",
573 SkStringPrintf("%d %d %d %d", fClip.fLeft, fClip.fTop, 576 SkStringPrintf("%d %d %d %d", fClip.fLeft, fClip.fTop,
574 fClip.fRight, fClip.fBottom).c _str()); 577 fClip.fRight, fClip.fBottom).c _str());
575 log->configOption("scale", SkStringPrintf("%.2g", fScales[fCurrentSc ale]).c_str()); 578 log->configOption("scale", SkStringPrintf("%.2g", fScales[fCurrentSc ale]).c_str());
576 if (fCurrentUseMPD > 0) { 579 if (fCurrentUseMPD > 0) {
577 SkASSERT(1 == fCurrentUseMPD || 2 == fCurrentUseMPD); 580 SkASSERT(1 == fCurrentUseMPD || 2 == fCurrentUseMPD);
578 log->configOption("multi_picture_draw", fUseMPDs[fCurrentUseMPD- 1] ? "true" : "false"); 581 log->configOption("multi_picture_draw", fUseMPDs[fCurrentUseMPD- 1] ? "true" : "false");
579 } 582 }
580 } 583 }
584 if (0 == strcmp(fBenchType, "recording")) {
585 log->metric("bytes", fSKPBytes);
586 log->metric("ops", fSKPOps);
587 }
581 } 588 }
582 589
583 private: 590 private:
584 const BenchRegistry* fBenches; 591 const BenchRegistry* fBenches;
585 const skiagm::GMRegistry* fGMs; 592 const skiagm::GMRegistry* fGMs;
586 SkIRect fClip; 593 SkIRect fClip;
587 SkTArray<SkScalar> fScales; 594 SkTArray<SkScalar> fScales;
588 SkTArray<SkString> fSKPs; 595 SkTArray<SkString> fSKPs;
589 SkTArray<bool> fUseMPDs; 596 SkTArray<bool> fUseMPDs;
590 597
598 double fSKPBytes, fSKPOps;
599
591 const char* fSourceType; // What we're benching: bench, GM, SKP, ... 600 const char* fSourceType; // What we're benching: bench, GM, SKP, ...
592 const char* fBenchType; // How we bench it: micro, recording, playback, .. . 601 const char* fBenchType; // How we bench it: micro, recording, playback, .. .
593 int fCurrentRecording; 602 int fCurrentRecording;
594 int fCurrentScale; 603 int fCurrentScale;
595 int fCurrentSKP; 604 int fCurrentSKP;
596 int fCurrentUseMPD; 605 int fCurrentUseMPD;
597 }; 606 };
598 607
599 int nanobench_main(); 608 int nanobench_main();
600 int nanobench_main() { 609 int nanobench_main() {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 726
718 Stats stats(samples.get(), FLAGS_samples); 727 Stats stats(samples.get(), FLAGS_samples);
719 log->config(config); 728 log->config(config);
720 log->configOption("name", bench->getName()); 729 log->configOption("name", bench->getName());
721 benchStream.fillCurrentOptions(log.get()); 730 benchStream.fillCurrentOptions(log.get());
722 #if SK_SUPPORT_GPU 731 #if SK_SUPPORT_GPU
723 if (Benchmark::kGPU_Backend == targets[j]->config.backend) { 732 if (Benchmark::kGPU_Backend == targets[j]->config.backend) {
724 fill_gpu_options(log.get(), targets[j]->gl); 733 fill_gpu_options(log.get(), targets[j]->gl);
725 } 734 }
726 #endif 735 #endif
727 log->timer("min_ms", stats.min); 736 log->metric("min_ms", stats.min);
728 log->timer("median_ms", stats.median); 737 log->metric("median_ms", stats.median);
729 log->timer("mean_ms", stats.mean); 738 log->metric("mean_ms", stats.mean);
730 log->timer("max_ms", stats.max); 739 log->metric("max_ms", stats.max);
731 log->timer("stddev_ms", sqrt(stats.var)); 740 log->metric("stddev_ms", sqrt(stats.var));
732 if (runs++ % FLAGS_flushEvery == 0) { 741 if (runs++ % FLAGS_flushEvery == 0) {
733 log->flush(); 742 log->flush();
734 } 743 }
735 744
736 if (kAutoTuneLoops != FLAGS_loops) { 745 if (kAutoTuneLoops != FLAGS_loops) {
737 if (targets.count() == 1) { 746 if (targets.count() == 1) {
738 config = ""; // Only print the config if we run the same ben ch on more than one. 747 config = ""; // Only print the config if we run the same ben ch on more than one.
739 } 748 }
740 SkDebugf("%4dM\t%s\t%s\n" 749 SkDebugf("%4dM\t%s\t%s\n"
741 , sk_tools::getMaxResidentSetSizeMB() 750 , sk_tools::getMaxResidentSetSizeMB()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 796
788 return 0; 797 return 0;
789 } 798 }
790 799
791 #if !defined SK_BUILD_FOR_IOS 800 #if !defined SK_BUILD_FOR_IOS
792 int main(int argc, char** argv) { 801 int main(int argc, char** argv) {
793 SkCommandLineFlags::Parse(argc, argv); 802 SkCommandLineFlags::Parse(argc, argv);
794 return nanobench_main(); 803 return nanobench_main();
795 } 804 }
796 #endif 805 #endif
OLDNEW
« no previous file with comments | « bench/ResultsWriter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698