OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef StackStats_h | 26 #ifndef StackStats_h |
27 #define StackStats_h | 27 #define StackStats_h |
28 | 28 |
29 #include "ThreadingPrimitives.h" | 29 #include "ThreadingPrimitives.h" |
30 | 30 |
31 | 31 |
32 // Define this flag to enable Stack stats collection. This feature is useful | 32 // Define this flag to enable Stack stats collection. This feature is useful |
33 // for getting a sample of native stack usage sizes. | 33 // for getting a sample of native stack usage sizes. |
34 // | 34 // |
35 // Enabling this will cause stats to be collected and written to a log file at | 35 // Enabling this will cause stats to be collected and written to a log file at |
36 // various instrumented points in the code. It will result in noticeable | 36 // various instrumented points in the code. It will result in noticeable |
37 // performance loss. Hence, this should only be enable when you want to do | 37 // performance loss. Hence, this should only be enable when you want to do |
38 // some stats location in your local build. This code is provided here as a | 38 // some stats location in your local build. This code is provided here as a |
39 // convenience for collecting that data. It is not meant to be enabled by | 39 // convenience for collecting that data. It is not meant to be enabled by |
40 // default on release or debug builds. | 40 // default on release or debug builds. |
41 | 41 |
42 // #define ENABLE_STACK_STATS 1 | 42 // #define ENABLE_STACK_STATS 1 |
43 | 43 |
44 | 44 |
45 namespace WTF { | 45 namespace WTF { |
46 | 46 |
47 #if !ENABLE(STACK_STATS) | 47 #if !ENABLE(STACK_STATS) |
48 | 48 |
49 class StackStats { | 49 class StackStats { |
50 public: | 50 public: |
51 // The CheckPoint class is for marking check points corresponding | 51 // The CheckPoint class is for marking check points corresponding |
52 // each location in code where a stack recursion check is being done. | 52 // each location in code where a stack recursion check is being done. |
53 | 53 |
54 class CheckPoint { | 54 class CheckPoint { |
55 public: | 55 public: |
56 CheckPoint() { } | 56 CheckPoint() { } |
57 }; | 57 }; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 static int s_maxReentryDepth; | 134 static int s_maxReentryDepth; |
135 | 135 |
136 static int s_maxLayoutCheckPointDiff; | 136 static int s_maxLayoutCheckPointDiff; |
137 static int s_maxTotalLayoutCheckPointDiff; | 137 static int s_maxTotalLayoutCheckPointDiff; |
138 static int s_maxLayoutReentryDepth; | 138 static int s_maxLayoutReentryDepth; |
139 | 139 |
140 friend class CheckPoint; | 140 friend class CheckPoint; |
141 friend class LayoutCheckPoint; | 141 friend class LayoutCheckPoint; |
142 }; | 142 }; |
143 | 143 |
144 #endif // ENABLE(STACK_STATS) | 144 #endif // ENABLE(STACK_STATS) |
145 | 145 |
146 } // namespace WTF | 146 } // namespace WTF |
147 | 147 |
148 using WTF::StackStats; | 148 using WTF::StackStats; |
149 | 149 |
150 #endif // StackStats_h | 150 #endif // StackStats_h |
OLD | NEW |