OLD | NEW |
---|---|
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 } else { | 673 } else { |
674 if (sampler_->IsProfiling()) SendProfilingSignal(); | 674 if (sampler_->IsProfiling()) SendProfilingSignal(); |
675 if (RuntimeProfiler::IsEnabled()) RuntimeProfiler::NotifyTick(); | 675 if (RuntimeProfiler::IsEnabled()) RuntimeProfiler::NotifyTick(); |
676 Sleep(FULL_INTERVAL); | 676 Sleep(FULL_INTERVAL); |
677 } | 677 } |
678 } | 678 } |
679 } | 679 } |
680 | 680 |
681 void SendProfilingSignal() { | 681 void SendProfilingSignal() { |
682 if (!signal_handler_installed_) return; | 682 if (!signal_handler_installed_) return; |
683 // There doesn't seem to be a robust way to deliver a signal to a | 683 // There doesn't seem to be a robust way to deliver a signal to a |
Vitaly Repeshko
2011/03/11 07:42:19
I removed the comment.
| |
684 // particular thread that may have terminated already. We send the | 684 // particular thread that may have terminated already. We send the |
685 // signal to the whole process hoping the right thread will get | 685 // signal to the whole process hoping the right thread will get |
686 // it. | 686 // it. |
687 kill(vm_tgid_, SIGPROF); | 687 pthread_kill(vm_tid_, SIGPROF); |
688 } | 688 } |
689 | 689 |
690 void Sleep(SleepInterval full_or_half) { | 690 void Sleep(SleepInterval full_or_half) { |
691 // Convert ms to us and subtract 100 us to compensate delays | 691 // Convert ms to us and subtract 100 us to compensate delays |
692 // occuring during signal delivery. | 692 // occuring during signal delivery. |
693 useconds_t interval = sampler_->interval_ * 1000 - 100; | 693 useconds_t interval = sampler_->interval_ * 1000 - 100; |
694 if (full_or_half == HALF_INTERVAL) interval /= 2; | 694 if (full_or_half == HALF_INTERVAL) interval /= 2; |
695 int result = usleep(interval); | 695 int result = usleep(interval); |
696 #ifdef DEBUG | 696 #ifdef DEBUG |
697 if (result != 0 && errno != EINTR) { | 697 if (result != 0 && errno != EINTR) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
783 data_->signal_handler_installed_ = false; | 783 data_->signal_handler_installed_ = false; |
784 } | 784 } |
785 | 785 |
786 // This sampler is no longer the active sampler. | 786 // This sampler is no longer the active sampler. |
787 active_sampler_ = NULL; | 787 active_sampler_ = NULL; |
788 } | 788 } |
789 | 789 |
790 #endif // ENABLE_LOGGING_AND_PROFILING | 790 #endif // ENABLE_LOGGING_AND_PROFILING |
791 | 791 |
792 } } // namespace v8::internal | 792 } } // namespace v8::internal |
OLD | NEW |