OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); | 141 CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap()); |
142 profiles->StartProfiling("", false); | 142 profiles->StartProfiling("", false); |
143 ProfileGenerator generator(profiles); | 143 ProfileGenerator generator(profiles); |
144 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( | 144 SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor( |
145 &generator, NULL, TimeDelta::FromMicroseconds(100))); | 145 &generator, NULL, TimeDelta::FromMicroseconds(100))); |
146 processor->Start(); | 146 processor->Start(); |
147 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); | 147 CpuProfiler profiler(isolate, profiles, &generator, processor.get()); |
148 | 148 |
149 // Enqueue code creation events. | 149 // Enqueue code creation events. |
150 const char* aaa_str = "aaa"; | 150 const char* aaa_str = "aaa"; |
151 i::Handle<i::String> aaa_name = factory->NewStringFromAscii( | 151 i::Handle<i::String> aaa_name = factory->NewStringFromAsciiChecked(aaa_str); |
152 i::Vector<const char>(aaa_str, i::StrLength(aaa_str))); | |
153 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); | 152 profiler.CodeCreateEvent(i::Logger::FUNCTION_TAG, aaa_code, *aaa_name); |
154 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); | 153 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment_code, "comment"); |
155 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); | 154 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args5_code, 5); |
156 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, "comment2"); | 155 profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, comment2_code, "comment2"); |
157 profiler.CodeMoveEvent(comment2_code->address(), moved_code->address()); | 156 profiler.CodeMoveEvent(comment2_code->address(), moved_code->address()); |
158 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); | 157 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args3_code, 3); |
159 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); | 158 profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4); |
160 | 159 |
161 // Enqueue a tick event to enable code events processing. | 160 // Enqueue a tick event to enable code events processing. |
162 EnqueueTickSampleEvent(processor.get(), aaa_code->address()); | 161 EnqueueTickSampleEvent(processor.get(), aaa_code->address()); |
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 inner_profile = NULL; | 1556 inner_profile = NULL; |
1558 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1557 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1559 | 1558 |
1560 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); | 1559 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); |
1561 CHECK(outer_profile); | 1560 CHECK(outer_profile); |
1562 CHECK_EQ(1, iprofiler->GetProfilesCount()); | 1561 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
1563 outer_profile->Delete(); | 1562 outer_profile->Delete(); |
1564 outer_profile = NULL; | 1563 outer_profile = NULL; |
1565 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1564 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
1566 } | 1565 } |
OLD | NEW |