| 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 22 matching lines...) Expand all  Loading... | 
| 33 #include "utils.h" | 33 #include "utils.h" | 
| 34 #include "../include/v8-profiler.h" | 34 #include "../include/v8-profiler.h" | 
| 35 | 35 | 
| 36 using i::CodeEntry; | 36 using i::CodeEntry; | 
| 37 using i::CpuProfile; | 37 using i::CpuProfile; | 
| 38 using i::CpuProfiler; | 38 using i::CpuProfiler; | 
| 39 using i::CpuProfilesCollection; | 39 using i::CpuProfilesCollection; | 
| 40 using i::ProfileGenerator; | 40 using i::ProfileGenerator; | 
| 41 using i::ProfileNode; | 41 using i::ProfileNode; | 
| 42 using i::ProfilerEventsProcessor; | 42 using i::ProfilerEventsProcessor; | 
| 43 using i::ScopedVector; | 43 // using i::ScopedVector; | 
| 44 using i::TokenEnumerator; | 44 using i::TokenEnumerator; | 
| 45 using i::Vector; | 45 using i::Vector; | 
| 46 | 46 | 
| 47 | 47 | 
| 48 TEST(StartStop) { | 48 TEST(StartStop) { | 
| 49   CpuProfilesCollection profiles; | 49   CpuProfilesCollection profiles; | 
| 50   ProfileGenerator generator(&profiles); | 50   ProfileGenerator generator(&profiles); | 
| 51   ProfilerEventsProcessor processor(&generator); | 51   ProfilerEventsProcessor processor(&generator); | 
| 52   processor.Start(); | 52   processor.Start(); | 
| 53   processor.Stop(); | 53   processor.Stop(); | 
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 389   const_cast<v8::CpuProfile*>(p2)->Delete(); | 389   const_cast<v8::CpuProfile*>(p2)->Delete(); | 
| 390   CHECK_EQ(1, cpu_profiler->GetProfileCount()); | 390   CHECK_EQ(1, cpu_profiler->GetProfileCount()); | 
| 391   CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid2)); | 391   CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid2)); | 
| 392   CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); | 392   CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); | 
| 393   const_cast<v8::CpuProfile*>(p3)->Delete(); | 393   const_cast<v8::CpuProfile*>(p3)->Delete(); | 
| 394   CHECK_EQ(0, cpu_profiler->GetProfileCount()); | 394   CHECK_EQ(0, cpu_profiler->GetProfileCount()); | 
| 395   CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid3)); | 395   CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid3)); | 
| 396 } | 396 } | 
| 397 | 397 | 
| 398 | 398 | 
|  | 399 #if 0 | 
| 399 static bool ContainsString(v8::Handle<v8::String> string, | 400 static bool ContainsString(v8::Handle<v8::String> string, | 
| 400                            const Vector<v8::Handle<v8::String> >& vector) { | 401                            const Vector<v8::Handle<v8::String> >& vector) { | 
| 401   for (int i = 0; i < vector.length(); i++) { | 402   for (int i = 0; i < vector.length(); i++) { | 
| 402     if (string->Equals(vector[i])) | 403     if (string->Equals(vector[i])) | 
| 403       return true; | 404       return true; | 
| 404   } | 405   } | 
| 405   return false; | 406   return false; | 
| 406 } | 407 } | 
| 407 | 408 | 
| 408 | 409 | 
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 529   const v8::CpuProfileNode* fooNode = FindChild(startNode, "foo"); | 530   const v8::CpuProfileNode* fooNode = FindChild(startNode, "foo"); | 
| 530   CHECK_EQ(3, fooNode->GetChildrenCount()); | 531   CHECK_EQ(3, fooNode->GetChildrenCount()); | 
| 531 | 532 | 
| 532   const char* barBranch[] = { "bar", "delay", "loop" }; | 533   const char* barBranch[] = { "bar", "delay", "loop" }; | 
| 533   CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch)); | 534   CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch)); | 
| 534   const char* bazBranch[] = { "baz", "delay", "loop" }; | 535   const char* bazBranch[] = { "baz", "delay", "loop" }; | 
| 535   CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch)); | 536   CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch)); | 
| 536   const char* delayBranch[] = { "delay", "loop" }; | 537   const char* delayBranch[] = { "delay", "loop" }; | 
| 537   CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch)); | 538   CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch)); | 
| 538 } | 539 } | 
|  | 540 #endif | 
| OLD | NEW | 
|---|