Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/api.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed Address from public API. Removed the function to copy TickSample to Sample. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/cpu-profiler.h » ('j') | src/log.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
11 #include <cmath> // For isnan. 11 #include <cmath> // For isnan.
12 #include "include/v8.h"
12 #include "include/v8-debug.h" 13 #include "include/v8-debug.h"
13 #include "include/v8-profiler.h" 14 #include "include/v8-profiler.h"
14 #include "include/v8-testing.h" 15 #include "include/v8-testing.h"
15 #include "src/assert-scope.h" 16 #include "src/assert-scope.h"
16 #include "src/base/platform/platform.h" 17 #include "src/base/platform/platform.h"
17 #include "src/base/platform/time.h" 18 #include "src/base/platform/time.h"
18 #include "src/base/utils/random-number-generator.h" 19 #include "src/base/utils/random-number-generator.h"
19 #include "src/bootstrapper.h" 20 #include "src/bootstrapper.h"
20 #include "src/code-stubs.h" 21 #include "src/code-stubs.h"
21 #include "src/compiler.h" 22 #include "src/compiler.h"
22 #include "src/conversions-inl.h" 23 #include "src/conversions-inl.h"
23 #include "src/counters.h" 24 #include "src/counters.h"
24 #include "src/cpu-profiler.h" 25 #include "src/cpu-profiler.h"
25 #include "src/debug.h" 26 #include "src/debug.h"
26 #include "src/deoptimizer.h" 27 #include "src/deoptimizer.h"
27 #include "src/execution.h" 28 #include "src/execution.h"
28 #include "src/global-handles.h" 29 #include "src/global-handles.h"
29 #include "src/heap-profiler.h" 30 #include "src/heap-profiler.h"
30 #include "src/heap-snapshot-generator-inl.h" 31 #include "src/heap-snapshot-generator-inl.h"
31 #include "src/icu_util.h" 32 #include "src/icu_util.h"
32 #include "src/json-parser.h" 33 #include "src/json-parser.h"
34 #include "src/log.h"
33 #include "src/messages.h" 35 #include "src/messages.h"
34 #include "src/natives.h" 36 #include "src/natives.h"
35 #include "src/parser.h" 37 #include "src/parser.h"
36 #include "src/profile-generator-inl.h" 38 #include "src/profile-generator-inl.h"
37 #include "src/property.h" 39 #include "src/property.h"
38 #include "src/property-details.h" 40 #include "src/property-details.h"
39 #include "src/runtime.h" 41 #include "src/runtime.h"
40 #include "src/runtime-profiler.h" 42 #include "src/runtime-profiler.h"
41 #include "src/scanner-character-streams.h" 43 #include "src/scanner-character-streams.h"
42 #include "src/simulator.h" 44 #include "src/simulator.h"
(...skipping 6624 matching lines...) Expand 10 before | Expand all | Expand 10 after
6667 i::Heap* heap = isolate->heap(); 6669 i::Heap* heap = isolate->heap();
6668 heap_statistics->total_heap_size_ = heap->CommittedMemory(); 6670 heap_statistics->total_heap_size_ = heap->CommittedMemory();
6669 heap_statistics->total_heap_size_executable_ = 6671 heap_statistics->total_heap_size_executable_ =
6670 heap->CommittedMemoryExecutable(); 6672 heap->CommittedMemoryExecutable();
6671 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); 6673 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
6672 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); 6674 heap_statistics->used_heap_size_ = heap->SizeOfObjects();
6673 heap_statistics->heap_size_limit_ = heap->MaxReserved(); 6675 heap_statistics->heap_size_limit_ = heap->MaxReserved();
6674 } 6676 }
6675 6677
6676 6678
6679 void Isolate::GetSample(Sample* sample) {
6680 sample->frames_count = 0;
6681
6682 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6683
6684 i::Logger* logger = isolate->logger();
6685 if (logger == NULL) return;
6686
6687 i::Sampler* sampler = logger->sampler();
6688 if (sampler == NULL) return;
6689
6690 // TODO(gohlap): These checks and getters above are just transitory.
6691 // Get rid of those as we make the API mature.
6692 // We have these right now because we want the new API
6693 // to play well with the current cpu-profiler thread inside v8.
6694
6695 sampler->GetSample(sample);
6696 }
6697
6698
6677 void Isolate::SetEventLogger(LogEventCallback that) { 6699 void Isolate::SetEventLogger(LogEventCallback that) {
6678 // Do not overwrite the event logger if we want to log explicitly. 6700 // Do not overwrite the event logger if we want to log explicitly.
6679 if (i::FLAG_log_timer_events) return; 6701 if (i::FLAG_log_timer_events) return;
6680 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6702 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6681 isolate->set_event_logger(that); 6703 isolate->set_event_logger(that);
6682 } 6704 }
6683 6705
6684 6706
6685 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { 6707 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
6686 if (callback == NULL) return; 6708 if (callback == NULL) return;
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
7626 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7648 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7627 Address callback_address = 7649 Address callback_address =
7628 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7650 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7629 VMState<EXTERNAL> state(isolate); 7651 VMState<EXTERNAL> state(isolate);
7630 ExternalCallbackScope call_scope(isolate, callback_address); 7652 ExternalCallbackScope call_scope(isolate, callback_address);
7631 callback(info); 7653 callback(info);
7632 } 7654 }
7633 7655
7634 7656
7635 } } // namespace v8::internal 7657 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/cpu-profiler.h » ('j') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698