File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,14 @@ getChildrenMaxResidentSetSize() {
45
45
struct rusage RU;
46
46
::getrusage (RUSAGE_CHILDREN, &RU);
47
47
int64_t M = static_cast <int64_t >(RU.ru_maxrss );
48
- if (M < 0 )
48
+ if (M < 0 ) {
49
49
M = std::numeric_limits<int64_t >::max ();
50
+ } else {
51
+ #ifndef __APPLE__
52
+ // Apple systems report bytes; everything else appears to report KB.
53
+ M <<= 10 ;
54
+ #endif
55
+ }
50
56
return M;
51
57
#else
52
58
return 0 ;
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: touch %t/main.swift
3
+ // RUN: %target-swiftc_driver -o %t/main -module-name main -stats-output-dir %t %t/main.swift
4
+ // RUN: %utils/process-stats-dir.py --set-csv-baseline %t/frontend.csv %t
5
+ // RUN: %FileCheck -input-file %t/frontend.csv %s
6
+
7
+ // This test checks that we're reporting some number that's "at least 10MB" and
8
+ // "not more than 999MB", because for a while we were incorrectly reporting KB
9
+ // as bytes on non-macOS, so claiming we took (say) "100KB". If we ever manage
10
+ // to get the swift frontend to use less than 10MB, celebrate! And change this
11
+ // test. Likewise (minus celebration) if compiling a function like the following
12
+ // ever takes more than 1GB.
13
+ //
14
+ // CHECK: {{"Driver.ChildrenMaxRSS" [1-9][0-9]{7,8}$}}
15
+
16
+ public func foo( ) {
17
+ print ( " hello " )
18
+ }
You can’t perform that action at this time.
0 commit comments