OLD | NEW |
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 | 6 |
7 #ifdef SK_BUILD_FOR_UNIX | 7 #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_
FOR_ANDROID) |
8 #include <sys/resource.h> | 8 #include <sys/resource.h> |
9 static long get_max_rss_kb() { | 9 static long get_max_rss_kb() { |
10 struct rusage ru; | 10 struct rusage ru; |
11 getrusage(RUSAGE_SELF, &ru); | 11 getrusage(RUSAGE_SELF, &ru); |
12 return ru.ru_maxrss; | 12 #if defined(SK_BUILD_FOR_MAC) |
| 13 return ru.ru_maxrss / 1024; // Darwin reports bytes. |
| 14 #else |
| 15 return ru.ru_maxrss; // Linux reports kilobytes. |
| 16 #endif |
13 } | 17 } |
14 #else | 18 #else |
15 static long get_max_rss_kb() { return 0; } | 19 static long get_max_rss_kb() { return 0; } |
16 #endif | 20 #endif |
17 | 21 |
18 namespace DM { | 22 namespace DM { |
19 | 23 |
20 void Reporter::printStatus(SkString name, SkMSec timeMs) const { | 24 void Reporter::printStatus(SkString name, SkMSec timeMs) const { |
21 if (FLAGS_quiet) { | 25 if (FLAGS_quiet) { |
22 return; | 26 return; |
(...skipping 23 matching lines...) Expand all Loading... |
46 SkAutoMutexAcquire writer(&fMutex); | 50 SkAutoMutexAcquire writer(&fMutex); |
47 fFailures.push_back(msg); | 51 fFailures.push_back(msg); |
48 } | 52 } |
49 | 53 |
50 void Reporter::getFailures(SkTArray<SkString>* failures) const { | 54 void Reporter::getFailures(SkTArray<SkString>* failures) const { |
51 SkAutoMutexAcquire reader(&fMutex); | 55 SkAutoMutexAcquire reader(&fMutex); |
52 *failures = fFailures; | 56 *failures = fFailures; |
53 } | 57 } |
54 | 58 |
55 } // namespace DM | 59 } // namespace DM |
OLD | NEW |