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

Side by Side Diff: test/cctest/test-cpu-profiler.cc

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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 | « test/cctest/test-compiler.cc ('k') | test/cctest/test-dataflow.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of profiles generator and utilities. 3 // Tests of profiles generator and utilities.
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #include "v8.h" 7 #include "v8.h"
8 #include "cpu-profiler-inl.h" 8 #include "cpu-profiler-inl.h"
9 #include "cctest.h" 9 #include "cctest.h"
10 10
11 namespace i = v8::internal; 11 namespace i = v8::internal;
12 12
13 using i::CodeEntry; 13 using i::CodeEntry;
14 using i::CpuProfile; 14 using i::CpuProfile;
15 using i::CpuProfiler; 15 using i::CpuProfiler;
16 using i::CpuProfilesCollection; 16 using i::CpuProfilesCollection;
17 using i::ProfileGenerator; 17 using i::ProfileGenerator;
18 using i::ProfileNode; 18 using i::ProfileNode;
19 using i::ProfilerEventsProcessor; 19 using i::ProfilerEventsProcessor;
20 using i::TokenEnumerator; 20 using i::TokenEnumerator;
21 21
22 22
23 TEST(StartStop) { 23 TEST(StartStop) {
24 CpuProfilesCollection profiles; 24 CpuProfilesCollection profiles;
25 ProfileGenerator generator(&profiles); 25 ProfileGenerator generator(&profiles);
26 ProfilerEventsProcessor processor(&generator); 26 ProfilerEventsProcessor processor(i::Isolate::Current(), &generator);
27 processor.Start(); 27 processor.Start();
28 while (!processor.running()) { 28 while (!processor.running()) {
29 i::Thread::YieldCPU(); 29 i::Thread::YieldCPU();
30 } 30 }
31 processor.Stop(); 31 processor.Stop();
32 processor.Join(); 32 processor.Join();
33 } 33 }
34 34
35 static v8::Persistent<v8::Context> env; 35 static v8::Persistent<v8::Context> env;
36 36
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }; 80 };
81 81
82 } // namespace 82 } // namespace
83 83
84 TEST(CodeEvents) { 84 TEST(CodeEvents) {
85 InitializeVM(); 85 InitializeVM();
86 TestSetup test_setup; 86 TestSetup test_setup;
87 CpuProfilesCollection profiles; 87 CpuProfilesCollection profiles;
88 profiles.StartProfiling("", 1); 88 profiles.StartProfiling("", 1);
89 ProfileGenerator generator(&profiles); 89 ProfileGenerator generator(&profiles);
90 ProfilerEventsProcessor processor(&generator); 90 ProfilerEventsProcessor processor(i::Isolate::Current(), &generator);
91 processor.Start(); 91 processor.Start();
92 while (!processor.running()) { 92 while (!processor.running()) {
93 i::Thread::YieldCPU(); 93 i::Thread::YieldCPU();
94 } 94 }
95 95
96 // Enqueue code creation events. 96 // Enqueue code creation events.
97 i::HandleScope scope; 97 i::HandleScope scope;
98 const char* aaa_str = "aaa"; 98 const char* aaa_str = "aaa";
99 i::Handle<i::String> aaa_name = i::Factory::NewStringFromAscii( 99 i::Handle<i::String> aaa_name = FACTORY->NewStringFromAscii(
100 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); 100 i::Vector<const char>(aaa_str, i::StrLength(aaa_str)));
101 processor.CodeCreateEvent(i::Logger::FUNCTION_TAG, 101 processor.CodeCreateEvent(i::Logger::FUNCTION_TAG,
102 *aaa_name, 102 *aaa_name,
103 i::Heap::empty_string(), 103 HEAP->empty_string(),
104 0, 104 0,
105 ToAddress(0x1000), 105 ToAddress(0x1000),
106 0x100, 106 0x100,
107 ToAddress(0x10000)); 107 ToAddress(0x10000));
108 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 108 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
109 "bbb", 109 "bbb",
110 ToAddress(0x1200), 110 ToAddress(0x1200),
111 0x80); 111 0x80);
112 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); 112 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10);
113 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 113 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
(...skipping 30 matching lines...) Expand all
144 template<typename T> 144 template<typename T>
145 static int CompareProfileNodes(const T* p1, const T* p2) { 145 static int CompareProfileNodes(const T* p1, const T* p2) {
146 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name()); 146 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name());
147 } 147 }
148 148
149 TEST(TickEvents) { 149 TEST(TickEvents) {
150 TestSetup test_setup; 150 TestSetup test_setup;
151 CpuProfilesCollection profiles; 151 CpuProfilesCollection profiles;
152 profiles.StartProfiling("", 1); 152 profiles.StartProfiling("", 1);
153 ProfileGenerator generator(&profiles); 153 ProfileGenerator generator(&profiles);
154 ProfilerEventsProcessor processor(&generator); 154 ProfilerEventsProcessor processor(i::Isolate::Current(), &generator);
155 processor.Start(); 155 processor.Start();
156 while (!processor.running()) { 156 while (!processor.running()) {
157 i::Thread::YieldCPU(); 157 i::Thread::YieldCPU();
158 } 158 }
159 159
160 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 160 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
161 "bbb", 161 "bbb",
162 ToAddress(0x1200), 162 ToAddress(0x1200),
163 0x80); 163 0x80);
164 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); 164 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 TestSetup test_setup; 230 TestSetup test_setup;
231 CpuProfiler::Setup(); 231 CpuProfiler::Setup();
232 CpuProfiler::StartProfiling("1"); 232 CpuProfiler::StartProfiling("1");
233 CpuProfiler::StopProfiling("2"); 233 CpuProfiler::StopProfiling("2");
234 CpuProfiler::StartProfiling("1"); 234 CpuProfiler::StartProfiling("1");
235 CpuProfiler::StopProfiling(""); 235 CpuProfiler::StopProfiling("");
236 CpuProfiler::TearDown(); 236 CpuProfiler::TearDown();
237 } 237 }
238 238
239 #endif // ENABLE_LOGGING_AND_PROFILING 239 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-dataflow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698