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

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

Issue 6551011: Fix CPU profiling for Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 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
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
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = i::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 i::Heap::empty_string(),
104 0, 104 0,
105 ToAddress(0x1000), 105 ToAddress(0x1000),
106 0x100); 106 0x100,
107 ToAddress(0x10000));
107 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 108 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
108 "bbb", 109 "bbb",
109 ToAddress(0x1200), 110 ToAddress(0x1200),
110 0x80); 111 0x80);
111 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10); 112 processor.CodeCreateEvent(i::Logger::STUB_TAG, 5, ToAddress(0x1300), 0x10);
112 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, 113 processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
113 "ddd", 114 "ddd",
114 ToAddress(0x1400), 115 ToAddress(0x1400),
115 0x80); 116 0x80);
116 processor.CodeMoveEvent(ToAddress(0x1400), ToAddress(0x1500)); 117 processor.CodeMoveEvent(ToAddress(0x1400), ToAddress(0x1500));
117 processor.CodeCreateEvent(i::Logger::STUB_TAG, 3, ToAddress(0x1600), 0x10); 118 processor.CodeCreateEvent(i::Logger::STUB_TAG, 3, ToAddress(0x1600), 0x10);
118 processor.CodeDeleteEvent(ToAddress(0x1600)); 119 processor.CodeDeleteEvent(ToAddress(0x1600));
119 processor.FunctionCreateEvent(ToAddress(0x1700), ToAddress(0x1000),
120 TokenEnumerator::kNoSecurityToken);
121 // Enqueue a tick event to enable code events processing. 120 // Enqueue a tick event to enable code events processing.
122 EnqueueTickSampleEvent(&processor, ToAddress(0x1000)); 121 EnqueueTickSampleEvent(&processor, ToAddress(0x1000));
123 122
124 processor.Stop(); 123 processor.Stop();
125 processor.Join(); 124 processor.Join();
126 125
127 // Check the state of profile generator. 126 // Check the state of profile generator.
128 CodeEntry* entry1 = generator.code_map()->FindEntry(ToAddress(0x1000)); 127 CodeEntry* entry1 = generator.code_map()->FindEntry(ToAddress(0x1000));
129 CHECK_NE(NULL, entry1); 128 CHECK_NE(NULL, entry1);
130 CHECK_EQ(aaa_str, entry1->name()); 129 CHECK_EQ(aaa_str, entry1->name());
131 CodeEntry* entry2 = generator.code_map()->FindEntry(ToAddress(0x1200)); 130 CodeEntry* entry2 = generator.code_map()->FindEntry(ToAddress(0x1200));
132 CHECK_NE(NULL, entry2); 131 CHECK_NE(NULL, entry2);
133 CHECK_EQ("bbb", entry2->name()); 132 CHECK_EQ("bbb", entry2->name());
134 CodeEntry* entry3 = generator.code_map()->FindEntry(ToAddress(0x1300)); 133 CodeEntry* entry3 = generator.code_map()->FindEntry(ToAddress(0x1300));
135 CHECK_NE(NULL, entry3); 134 CHECK_NE(NULL, entry3);
136 CHECK_EQ("5", entry3->name()); 135 CHECK_EQ("5", entry3->name());
137 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1400))); 136 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1400)));
138 CodeEntry* entry4 = generator.code_map()->FindEntry(ToAddress(0x1500)); 137 CodeEntry* entry4 = generator.code_map()->FindEntry(ToAddress(0x1500));
139 CHECK_NE(NULL, entry4); 138 CHECK_NE(NULL, entry4);
140 CHECK_EQ("ddd", entry4->name()); 139 CHECK_EQ("ddd", entry4->name());
141 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1600))); 140 CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1600)));
142 CodeEntry* entry5 = generator.code_map()->FindEntry(ToAddress(0x1700));
143 CHECK_NE(NULL, entry5);
144 CHECK_EQ(aaa_str, entry5->name());
145 } 141 }
146 142
147 143
148 template<typename T> 144 template<typename T>
149 static int CompareProfileNodes(const T* p1, const T* p2) { 145 static int CompareProfileNodes(const T* p1, const T* p2) {
150 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name()); 146 return strcmp((*p1)->entry()->name(), (*p2)->entry()->name());
151 } 147 }
152 148
153 TEST(TickEvents) { 149 TEST(TickEvents) {
154 TestSetup test_setup; 150 TestSetup test_setup;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 TestSetup test_setup; 230 TestSetup test_setup;
235 CpuProfiler::Setup(); 231 CpuProfiler::Setup();
236 CpuProfiler::StartProfiling("1"); 232 CpuProfiler::StartProfiling("1");
237 CpuProfiler::StopProfiling("2"); 233 CpuProfiler::StopProfiling("2");
238 CpuProfiler::StartProfiling("1"); 234 CpuProfiler::StartProfiling("1");
239 CpuProfiler::StopProfiling(""); 235 CpuProfiler::StopProfiling("");
240 CpuProfiler::TearDown(); 236 CpuProfiler::TearDown();
241 } 237 }
242 238
243 #endif // ENABLE_LOGGING_AND_PROFILING 239 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698