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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 TimeStamp time_now; | 455 TimeStamp time_now; |
456 GetSystemTimeAsFileTime(&time_now.ft_); | 456 GetSystemTimeAsFileTime(&time_now.ft_); |
457 DWORD ticks_now = timeGetTime(); | 457 DWORD ticks_now = timeGetTime(); |
458 | 458 |
459 // Check if we need to resync due to clock rollover. | 459 // Check if we need to resync due to clock rollover. |
460 needs_resync |= ticks_now < init_ticks; | 460 needs_resync |= ticks_now < init_ticks; |
461 | 461 |
462 // Check if we need to resync due to elapsed time. | 462 // Check if we need to resync due to elapsed time. |
463 needs_resync |= (time_now.t_ - init_time.t_) > kMaxClockElapsedTime; | 463 needs_resync |= (time_now.t_ - init_time.t_) > kMaxClockElapsedTime; |
464 | 464 |
| 465 // Check if we need to resync due to backwards time change. |
| 466 needs_resync |= time_now.t_ < init_time.t_; |
| 467 |
465 // Resync the clock if necessary. | 468 // Resync the clock if necessary. |
466 if (needs_resync) { | 469 if (needs_resync) { |
467 GetSystemTimeAsFileTime(&init_time.ft_); | 470 GetSystemTimeAsFileTime(&init_time.ft_); |
468 init_ticks = ticks_now = timeGetTime(); | 471 init_ticks = ticks_now = timeGetTime(); |
469 initialized = true; | 472 initialized = true; |
470 } | 473 } |
471 | 474 |
472 // Finally, compute the actual time. Why is this so hard. | 475 // Finally, compute the actual time. Why is this so hard. |
473 DWORD elapsed = ticks_now - init_ticks; | 476 DWORD elapsed = ticks_now - init_ticks; |
474 this->time_.t_ = init_time.t_ + (static_cast<int64_t>(elapsed) * 10000); | 477 this->time_.t_ = init_time.t_ + (static_cast<int64_t>(elapsed) * 10000); |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 | 2087 |
2085 | 2088 |
2086 void Sampler::Stop() { | 2089 void Sampler::Stop() { |
2087 ASSERT(IsActive()); | 2090 ASSERT(IsActive()); |
2088 SamplerThread::RemoveActiveSampler(this); | 2091 SamplerThread::RemoveActiveSampler(this); |
2089 SetActive(false); | 2092 SetActive(false); |
2090 } | 2093 } |
2091 | 2094 |
2092 | 2095 |
2093 } } // namespace v8::internal | 2096 } } // namespace v8::internal |
OLD | NEW |