OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium 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 #include "chrome_frame/test/perf/chrome_frame_perftest.h" | 4 #include "chrome_frame/test/perf/chrome_frame_perftest.h" |
5 | 5 |
6 #include <atlwin.h> | 6 #include <atlwin.h> |
7 #include <atlhost.h> | 7 #include <atlhost.h> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "chrome_tab.h" // Generated from chrome_tab.idl. | 12 #include "chrome_tab.h" // Generated from chrome_tab.idl. |
13 | 13 |
| 14 #include "base/debug/trace_event_win.h" |
14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
17 #include "base/process_util.h" | 18 #include "base/process_util.h" |
18 #include "base/scoped_ptr.h" | 19 #include "base/scoped_ptr.h" |
19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
20 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
| 22 #include "base/threading/platform_thread.h" |
21 #include "base/time.h" | 23 #include "base/time.h" |
22 #include "base/debug/trace_event_win.h" | |
23 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 25 #include "base/win/event_trace_consumer.h" |
24 #include "base/win/event_trace_controller.h" | 26 #include "base/win/event_trace_controller.h" |
25 #include "base/win/event_trace_consumer.h" | |
26 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
27 #include "base/win/scoped_bstr.h" | 28 #include "base/win/scoped_bstr.h" |
28 #include "base/win/scoped_comptr.h" | 29 #include "base/win/scoped_comptr.h" |
29 #include "base/win/scoped_variant.h" | 30 #include "base/win/scoped_variant.h" |
30 #include "chrome/common/chrome_constants.h" | 31 #include "chrome/common/chrome_constants.h" |
31 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
32 #include "chrome/common/chrome_paths_internal.h" | 33 #include "chrome/common/chrome_paths_internal.h" |
33 #include "chrome/test/chrome_process_util.h" | 34 #include "chrome/test/chrome_process_util.h" |
34 #include "chrome/test/ui/ui_perf_test.h" | 35 #include "chrome/test/ui/ui_perf_test.h" |
35 | |
36 #include "chrome_frame/test_utils.h" | 36 #include "chrome_frame/test_utils.h" |
37 #include "chrome_frame/utils.h" | 37 #include "chrome_frame/utils.h" |
38 | 38 |
39 const wchar_t kSilverlightControlKey[] = | 39 const wchar_t kSilverlightControlKey[] = |
40 L"CLSID\\{DFEAF541-F3E1-4c24-ACAC-99C30715084A}\\InprocServer32"; | 40 L"CLSID\\{DFEAF541-F3E1-4c24-ACAC-99C30715084A}\\InprocServer32"; |
41 | 41 |
42 const wchar_t kFlashControlKey[] = | 42 const wchar_t kFlashControlKey[] = |
43 L"CLSID\\{D27CDB6E-AE6D-11cf-96B8-444553540000}\\InprocServer32"; | 43 L"CLSID\\{D27CDB6E-AE6D-11cf-96B8-444553540000}\\InprocServer32"; |
44 | 44 |
45 using base::TimeDelta; | 45 using base::TimeDelta; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 TimeTicks start_time, end_time; | 336 TimeTicks start_time, end_time; |
337 | 337 |
338 RunStartupTestImpl(&start_time, &end_time); | 338 RunStartupTestImpl(&start_time, &end_time); |
339 | 339 |
340 timings[i] = end_time - start_time; | 340 timings[i] = end_time - start_time; |
341 | 341 |
342 CoFreeUnusedLibraries(); | 342 CoFreeUnusedLibraries(); |
343 | 343 |
344 // TODO(beng): Can't shut down so quickly. Figure out why, and fix. If we | 344 // TODO(beng): Can't shut down so quickly. Figure out why, and fix. If we |
345 // do, we crash. | 345 // do, we crash. |
346 PlatformThread::Sleep(50); | 346 base::PlatformThread::Sleep(50); |
347 } | 347 } |
348 | 348 |
349 std::string times; | 349 std::string times; |
350 for (int i = 0; i < kNumCycles; ++i) | 350 for (int i = 0; i < kNumCycles; ++i) |
351 base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); | 351 base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); |
352 | 352 |
353 PrintResultList(graph, "", trace, times, "ms", important); | 353 PrintResultList(graph, "", trace, times, "ms", important); |
354 } | 354 } |
355 | 355 |
356 FilePath dir_app_; | 356 FilePath dir_app_; |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 chrome_frame_container_->CreateChromeFrameWindow(url.c_str()); | 803 chrome_frame_container_->CreateChromeFrameWindow(url.c_str()); |
804 chrome_frame_container_->CreateControl(true); | 804 chrome_frame_container_->CreateControl(true); |
805 | 805 |
806 module.RunMessageLoop(); | 806 module.RunMessageLoop(); |
807 | 807 |
808 chrome_frame_container_->Release(); | 808 chrome_frame_container_->Release(); |
809 | 809 |
810 PrintResults(test_name_.c_str()); | 810 PrintResults(test_name_.c_str()); |
811 | 811 |
812 CoFreeUnusedLibraries(); | 812 CoFreeUnusedLibraries(); |
813 PlatformThread::Sleep(100); | 813 base::PlatformThread::Sleep(100); |
814 } | 814 } |
815 | 815 |
816 void NavigateImpl(const std::string& url) { | 816 void NavigateImpl(const std::string& url) { |
817 ASSERT_TRUE(chrome_frame_container_ != NULL); | 817 ASSERT_TRUE(chrome_frame_container_ != NULL); |
818 ASSERT_TRUE(!url.empty()); | 818 ASSERT_TRUE(!url.empty()); |
819 chrome_frame_container_->Navigate(url.c_str()); | 819 chrome_frame_container_->Navigate(url.c_str()); |
820 } | 820 } |
821 | 821 |
822 void TestCompleted() { | 822 void TestCompleted() { |
823 // This can get called multiple times if the last url results in a | 823 // This can get called multiple times if the last url results in a |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, | 1457 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, |
1458 "automationproviderconnect"); | 1458 "automationproviderconnect"); |
1459 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, | 1459 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, |
1460 "externaltabnavigate"); | 1460 "externaltabnavigate"); |
1461 PrintPerfTestResults(renderer_main_monitor, kNumCycles, | 1461 PrintPerfTestResults(renderer_main_monitor, kNumCycles, |
1462 "beginrenderermain"); | 1462 "beginrenderermain"); |
1463 #ifdef NDEBUG | 1463 #ifdef NDEBUG |
1464 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); | 1464 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); |
1465 #endif // NDEBUG | 1465 #endif // NDEBUG |
1466 } | 1466 } |
OLD | NEW |