| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 namespace v8 { namespace internal { | 33 namespace v8 { namespace internal { |
| 34 | 34 |
| 35 CounterLookupCallback StatsTable::lookup_function_ = NULL; | 35 CounterLookupCallback StatsTable::lookup_function_ = NULL; |
| 36 | 36 |
| 37 StatsCounterTimer::StatsCounterTimer(const wchar_t* name) | 37 StatsCounterTimer::StatsCounterTimer(const wchar_t* name) |
| 38 : start_time_(0), // initialize to avoid compiler complaints | 38 : start_time_(0), // initialize to avoid compiler complaints |
| 39 stop_time_(0) { // initialize to avoid compiler complaints | 39 stop_time_(0) { // initialize to avoid compiler complaints |
| 40 int len = wcslen(name); | 40 int len = wcslen(name); |
| 41 // we prepend the name with 'c.' to indicate that it is a counter. | 41 // we prepend the name with 'c.' to indicate that it is a counter. |
| 42 name_ = NewArray<wchar_t>(len+3); | 42 name_ = Vector<wchar_t>::New(len+3); |
| 43 wcscpy(name_, L"t:"); | 43 OS::WcsCpy(name_, L"t:"); |
| 44 wcscpy(&name_[2], name); | 44 OS::WcsCpy(name_ + 2, name); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Start the timer. | 47 // Start the timer. |
| 48 void StatsCounterTimer::Start() { | 48 void StatsCounterTimer::Start() { |
| 49 if (!Enabled()) | 49 if (!Enabled()) |
| 50 return; | 50 return; |
| 51 stop_time_ = 0; | 51 stop_time_ = 0; |
| 52 start_time_ = OS::Ticks(); | 52 start_time_ = OS::Ticks(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Stop the timer and record the results. | 55 // Stop the timer and record the results. |
| 56 void StatsCounterTimer::Stop() { | 56 void StatsCounterTimer::Stop() { |
| 57 if (!Enabled()) | 57 if (!Enabled()) |
| 58 return; | 58 return; |
| 59 stop_time_ = OS::Ticks(); | 59 stop_time_ = OS::Ticks(); |
| 60 Record(); | 60 Record(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } } // namespace v8::internal | 63 } } // namespace v8::internal |
| OLD | NEW |