jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include "v8.h" |
| 29 | |
| 30 | #include "v8-counters.h" |
| 31 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 32 | namespace v8 { |
| 33 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 34 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 35 | Counters::Counters() { |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 36 | #define HT(name, caption) \ |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 37 | HistogramTimer name = { {#caption, 0, 10000, 50, NULL, false}, 0, 0 }; \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 38 | name##_ = name; |
| 39 | HISTOGRAM_TIMER_LIST(HT) |
| 40 | #undef HT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 41 | |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 42 | #define HP(name, caption) \ |
| 43 | Histogram name = { #caption, 0, 101, 100, NULL, false }; \ |
| 44 | name##_ = name; |
| 45 | HISTOGRAM_PERCENTAGE_LIST(HP) |
| 46 | #undef HP |
| 47 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 48 | #define HM(name, caption) \ |
| 49 | Histogram name = { #caption, 1000, 500000, 50, NULL, false }; \ |
| 50 | name##_ = name; |
| 51 | HISTOGRAM_MEMORY_LIST(HM) |
| 52 | #undef HM |
| 53 | |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 54 | #define SC(name, caption) \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 55 | StatsCounter name = { "c:" #caption, NULL, false };\ |
| 56 | name##_ = name; |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 57 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 58 | STATS_COUNTER_LIST_1(SC) |
| 59 | STATS_COUNTER_LIST_2(SC) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 60 | #undef SC |
| 61 | |
jkummerow@chromium.org | 28583c9 | 2012-07-16 11:31:55 +0000 | [diff] [blame] | 62 | #define SC(name) \ |
| 63 | StatsCounter count_of_##name = { "c:" "V8.CountOf_" #name, NULL, false };\ |
| 64 | count_of_##name##_ = count_of_##name; \ |
| 65 | StatsCounter size_of_##name = { "c:" "V8.SizeOf_" #name, NULL, false };\ |
| 66 | size_of_##name##_ = size_of_##name; |
| 67 | INSTANCE_TYPE_LIST(SC) |
| 68 | #undef SC |
| 69 | |
verwaest@chromium.org | 753aee4 | 2012-07-17 16:15:42 +0000 | [diff] [blame] | 70 | #define SC(name) \ |
| 71 | StatsCounter count_of_CODE_TYPE_##name = { \ |
| 72 | "c:" "V8.CountOf_CODE_TYPE-" #name, NULL, false }; \ |
| 73 | count_of_CODE_TYPE_##name##_ = count_of_CODE_TYPE_##name; \ |
| 74 | StatsCounter size_of_CODE_TYPE_##name = { \ |
| 75 | "c:" "V8.SizeOf_CODE_TYPE-" #name, NULL, false }; \ |
| 76 | size_of_CODE_TYPE_##name##_ = size_of_CODE_TYPE_##name; |
| 77 | CODE_KIND_LIST(SC) |
| 78 | #undef SC |
| 79 | |
yangguo@chromium.org | 304cc33 | 2012-07-24 07:59:48 +0000 | [diff] [blame] | 80 | #define SC(name) \ |
| 81 | StatsCounter count_of_FIXED_ARRAY_##name = { \ |
| 82 | "c:" "V8.CountOf_FIXED_ARRAY-" #name, NULL, false }; \ |
| 83 | count_of_FIXED_ARRAY_##name##_ = count_of_FIXED_ARRAY_##name; \ |
| 84 | StatsCounter size_of_FIXED_ARRAY_##name = { \ |
| 85 | "c:" "V8.SizeOf_FIXED_ARRAY-" #name, NULL, false }; \ |
| 86 | size_of_FIXED_ARRAY_##name##_ = size_of_FIXED_ARRAY_##name; |
| 87 | FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC) |
| 88 | #undef SC |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 89 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 90 | |
mstarzinger@chromium.org | 471f2f1 | 2012-08-10 14:46:33 +0000 | [diff] [blame] | 91 | void Counters::ResetHistograms() { |
| 92 | #define HT(name, caption) name##_.Reset(); |
| 93 | HISTOGRAM_TIMER_LIST(HT) |
| 94 | #undef HT |
| 95 | |
| 96 | #define HP(name, caption) name##_.Reset(); |
| 97 | HISTOGRAM_PERCENTAGE_LIST(HP) |
| 98 | #undef HP |
| 99 | |
| 100 | #define HM(name, caption) name##_.Reset(); |
| 101 | HISTOGRAM_MEMORY_LIST(HM) |
| 102 | #undef HM |
| 103 | } |
| 104 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 105 | } } // namespace v8::internal |