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

Side by Side Diff: dm/DMReporter.cpp

Issue 483323002: Print max RSS in GM and nanobench too. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 #include "DMReporter.h" 1 #include "DMReporter.h"
2 2
3 #include "SkDynamicAnnotations.h" 3 #include "SkDynamicAnnotations.h"
4 #include "SkCommonFlags.h" 4 #include "SkCommonFlags.h"
5 #include "OverwriteLine.h" 5 #include "OverwriteLine.h"
6 #include "ProcStats.h" 6 #include "ProcStats.h"
7 7
8 namespace DM { 8 namespace DM {
9 9
10 void Reporter::printStatus(SkString name, SkMSec timeMs) const { 10 void Reporter::printStatus(SkString name, SkMSec timeMs) const {
11 if (FLAGS_quiet) { 11 if (FLAGS_quiet) {
12 return; 12 return;
13 } 13 }
14 14
15 // It's okay if these are a little off---they're just for show---so we can r ead unprotectedly. 15 // It's okay if these are a little off---they're just for show---so we can r ead unprotectedly.
16 const int32_t failed = SK_ANNOTATE_UNPROTECTED_READ(fFailed); 16 const int32_t failed = SK_ANNOTATE_UNPROTECTED_READ(fFailed);
17 const int32_t pending = SK_ANNOTATE_UNPROTECTED_READ(fPending) - 1; 17 const int32_t pending = SK_ANNOTATE_UNPROTECTED_READ(fPending) - 1;
18 18
19 SkString status; 19 SkString status;
20 status.printf("%s%d tasks left", FLAGS_verbose ? "\n" : kSkOverwriteLine, pe nding); 20 status.printf("%s%d tasks left", FLAGS_verbose ? "\n" : kSkOverwriteLine, pe nding);
21 if (failed > 0) { 21 if (failed > 0) {
22 status.appendf(", %d failed", failed); 22 status.appendf(", %d failed", failed);
23 } 23 }
24 if (FLAGS_verbose) { 24 if (FLAGS_verbose) {
25 int max_rss_kb = sk_tools::getMaxResidentSetSizeKB(); 25 int max_rss_mb = sk_tools::getMaxResidentSetSizeMB();
26 if (max_rss_kb >= 0) { 26 if (max_rss_mb >= 0) {
27 status.appendf("\t%4dM peak", max_rss_kb / 1024); 27 status.appendf("\t%4dM peak", max_rss_mb);
28 } 28 }
29 status.appendf("\t%5dms\t%s", timeMs, name.c_str()); 29 status.appendf("\t%5dms\t%s", timeMs, name.c_str());
30 } 30 }
31 SkDebugf("%s", status.c_str()); 31 SkDebugf("%s", status.c_str());
32 } 32 }
33 33
34 void Reporter::fail(SkString msg) { 34 void Reporter::fail(SkString msg) {
35 sk_atomic_inc(&fFailed); 35 sk_atomic_inc(&fFailed);
36 36
37 SkAutoMutexAcquire writer(&fMutex); 37 SkAutoMutexAcquire writer(&fMutex);
38 fFailures.push_back(msg); 38 fFailures.push_back(msg);
39 } 39 }
40 40
41 void Reporter::getFailures(SkTArray<SkString>* failures) const { 41 void Reporter::getFailures(SkTArray<SkString>* failures) const {
42 SkAutoMutexAcquire reader(&fMutex); 42 SkAutoMutexAcquire reader(&fMutex);
43 *failures = fFailures; 43 *failures = fFailures;
44 } 44 }
45 45
46 } // namespace DM 46 } // namespace DM
OLDNEW
« bench/nanobench.cpp ('K') | « bench/nanobench.cpp ('k') | gm/gmmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698