OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return isolate()->stats_table()-> | 55 return isolate()->stats_table()-> |
56 CreateHistogram(name_, min_, max_, num_buckets_); | 56 CreateHistogram(name_, min_, max_, num_buckets_); |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 // Start the timer. | 60 // Start the timer. |
61 void HistogramTimer::Start() { | 61 void HistogramTimer::Start() { |
62 if (Enabled()) { | 62 if (Enabled()) { |
63 timer_.Start(); | 63 timer_.Start(); |
64 } | 64 } |
65 if (FLAG_log_internal_timer_events) { | 65 isolate()->event_logger()(name(), Logger::START); |
66 LOG(isolate(), TimerEvent(Logger::START, name())); | |
67 } | |
68 } | 66 } |
69 | 67 |
70 | 68 |
71 // Stop the timer and record the results. | 69 // Stop the timer and record the results. |
72 void HistogramTimer::Stop() { | 70 void HistogramTimer::Stop() { |
73 if (Enabled()) { | 71 if (Enabled()) { |
74 // Compute the delta between start and stop, in milliseconds. | 72 // Compute the delta between start and stop, in milliseconds. |
75 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); | 73 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); |
76 timer_.Stop(); | 74 timer_.Stop(); |
77 } | 75 } |
78 if (FLAG_log_internal_timer_events) { | 76 isolate()->event_logger()(name(), Logger::END); |
79 LOG(isolate(), TimerEvent(Logger::END, name())); | |
80 } | |
81 } | 77 } |
82 | 78 |
83 } } // namespace v8::internal | 79 } } // namespace v8::internal |
OLD | NEW |