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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 sampler_thread->SampleContext(sampler); | 817 sampler_thread->SampleContext(sampler); |
818 } | 818 } |
819 | 819 |
820 static void DoRuntimeProfile(Sampler* sampler, void* ignored) { | 820 static void DoRuntimeProfile(Sampler* sampler, void* ignored) { |
821 if (!sampler->isolate()->IsInitialized()) return; | 821 if (!sampler->isolate()->IsInitialized()) return; |
822 sampler->isolate()->runtime_profiler()->NotifyTick(); | 822 sampler->isolate()->runtime_profiler()->NotifyTick(); |
823 } | 823 } |
824 | 824 |
825 void SampleContext(Sampler* sampler) { | 825 void SampleContext(Sampler* sampler) { |
826 thread_act_t profiled_thread = sampler->platform_data()->profiled_thread(); | 826 thread_act_t profiled_thread = sampler->platform_data()->profiled_thread(); |
| 827 TickSample sample_obj; |
827 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); | 828 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); |
828 if (sample == NULL) return; | 829 if (sample == NULL) sample = &sample_obj; |
829 | 830 |
830 if (KERN_SUCCESS != thread_suspend(profiled_thread)) return; | 831 if (KERN_SUCCESS != thread_suspend(profiled_thread)) return; |
831 | 832 |
832 #if V8_HOST_ARCH_X64 | 833 #if V8_HOST_ARCH_X64 |
833 thread_state_flavor_t flavor = x86_THREAD_STATE64; | 834 thread_state_flavor_t flavor = x86_THREAD_STATE64; |
834 x86_thread_state64_t state; | 835 x86_thread_state64_t state; |
835 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; | 836 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; |
836 #if __DARWIN_UNIX03 | 837 #if __DARWIN_UNIX03 |
837 #define REGISTER_FIELD(name) __r ## name | 838 #define REGISTER_FIELD(name) __r ## name |
838 #else | 839 #else |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 } | 928 } |
928 | 929 |
929 | 930 |
930 void Sampler::Stop() { | 931 void Sampler::Stop() { |
931 ASSERT(IsActive()); | 932 ASSERT(IsActive()); |
932 SamplerThread::RemoveActiveSampler(this); | 933 SamplerThread::RemoveActiveSampler(this); |
933 SetActive(false); | 934 SetActive(false); |
934 } | 935 } |
935 | 936 |
936 | 937 |
| 938 void Sampler::StartSampling() { |
| 939 } |
| 940 |
| 941 |
| 942 void Sampler::StopSampling() { |
| 943 } |
| 944 |
| 945 |
937 } } // namespace v8::internal | 946 } } // namespace v8::internal |
OLD | NEW |