| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/registry.h" | 16 #include "base/registry.h" |
| 17 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
| 18 #include "base/scoped_bstr_win.h" | 18 #include "base/scoped_bstr_win.h" |
| 19 #include "base/scoped_comptr_win.h" | 19 #include "base/scoped_comptr_win.h" |
| 20 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 21 #include "base/time.h" | 21 #include "base/time.h" |
| 22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_paths_internal.h" | 24 #include "chrome/common/chrome_paths_internal.h" |
| 25 #include "chrome/test/chrome_process_util.h" | 25 #include "chrome/test/chrome_process_util.h" |
| 26 #include "chrome/test/perf/mem_usage.h" | |
| 27 #include "chrome/test/ui/ui_test.h" | 26 #include "chrome/test/ui/ui_test.h" |
| 28 | 27 |
| 29 #include "chrome_frame/test_utils.h" | 28 #include "chrome_frame/test_utils.h" |
| 30 #include "chrome_frame/utils.h" | 29 #include "chrome_frame/utils.h" |
| 31 | 30 |
| 32 const wchar_t kSilverlightControlKey[] = | 31 const wchar_t kSilverlightControlKey[] = |
| 33 L"CLSID\\{DFEAF541-F3E1-4c24-ACAC-99C30715084A}\\InprocServer32"; | 32 L"CLSID\\{DFEAF541-F3E1-4c24-ACAC-99C30715084A}\\InprocServer32"; |
| 34 | 33 |
| 35 const wchar_t kFlashControlKey[] = | 34 const wchar_t kFlashControlKey[] = |
| 36 L"CLSID\\{D27CDB6E-AE6D-11cf-96B8-444553540000}\\InprocServer32"; | 35 L"CLSID\\{D27CDB6E-AE6D-11cf-96B8-444553540000}\\InprocServer32"; |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 chrome_frame_registrar_.reset(new ScopedChromeFrameRegistrar); | 572 chrome_frame_registrar_.reset(new ScopedChromeFrameRegistrar); |
| 574 } | 573 } |
| 575 | 574 |
| 576 void RunTest(const char* test_name, char* urls[], int total_urls) { | 575 void RunTest(const char* test_name, char* urls[], int total_urls) { |
| 577 ASSERT_TRUE(urls != NULL); | 576 ASSERT_TRUE(urls != NULL); |
| 578 ASSERT_GT(total_urls, 0); | 577 ASSERT_GT(total_urls, 0); |
| 579 | 578 |
| 580 // Record the initial CommitCharge. This is a system-wide measurement, | 579 // Record the initial CommitCharge. This is a system-wide measurement, |
| 581 // so if other applications are running, they can create variance in this | 580 // so if other applications are running, they can create variance in this |
| 582 // test. | 581 // test. |
| 583 start_commit_charge_ = GetSystemCommitCharge(); | 582 start_commit_charge_ = base::GetSystemCommitCharge(); |
| 584 | 583 |
| 585 for (int i = 0; i < total_urls; i++) | 584 for (int i = 0; i < total_urls; i++) |
| 586 urls_.push_back(urls[i]); | 585 urls_.push_back(urls[i]); |
| 587 | 586 |
| 588 std::string url; | 587 std::string url; |
| 589 GetNextUrl(&url); | 588 GetNextUrl(&url); |
| 590 ASSERT_TRUE(!url.empty()); | 589 ASSERT_TRUE(!url.empty()); |
| 591 | 590 |
| 592 StartTest(url, test_name); | 591 StartTest(url, test_name); |
| 593 } | 592 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 682 } |
| 684 | 683 |
| 685 void PrintResults(const char* test_name) { | 684 void PrintResults(const char* test_name) { |
| 686 PrintMemoryUsageInfo(test_name); | 685 PrintMemoryUsageInfo(test_name); |
| 687 memory_consumption_map_.clear(); | 686 memory_consumption_map_.clear(); |
| 688 | 687 |
| 689 // Added to give the OS some time to flush the used pages for the | 688 // Added to give the OS some time to flush the used pages for the |
| 690 // chrome processes which would have exited by now. | 689 // chrome processes which would have exited by now. |
| 691 Sleep(200); | 690 Sleep(200); |
| 692 | 691 |
| 693 size_t end_commit_charge = GetSystemCommitCharge(); | 692 size_t end_commit_charge = base::GetSystemCommitCharge(); |
| 694 size_t commit_size = end_commit_charge - start_commit_charge_; | 693 size_t commit_size = (end_commit_charge - start_commit_charge_) * 1024; |
| 695 | 694 |
| 696 std::string trace_name(test_name); | 695 std::string trace_name(test_name); |
| 697 trace_name.append("_cc"); | 696 trace_name.append("_cc"); |
| 698 | 697 |
| 699 PrintResult("commit_charge", "", trace_name, | 698 PrintResult("commit_charge", "", trace_name, |
| 700 commit_size / 1024, "KB", true /* important */); | 699 commit_size / 1024, "KB", true /* important */); |
| 701 printf("\n"); | 700 printf("\n"); |
| 702 } | 701 } |
| 703 | 702 |
| 704 ChromeProcessList GetBrowserChildren() { | 703 ChromeProcessList GetBrowserChildren() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 756 |
| 758 // Should never get called. | 757 // Should never get called. |
| 759 virtual void NavigateImpl(const std::string& url) = 0 { | 758 virtual void NavigateImpl(const std::string& url) = 0 { |
| 760 ASSERT_FALSE(false); | 759 ASSERT_FALSE(false); |
| 761 } | 760 } |
| 762 | 761 |
| 763 virtual void TestCompleted() = 0 { | 762 virtual void TestCompleted() = 0 { |
| 764 ASSERT_FALSE(false); | 763 ASSERT_FALSE(false); |
| 765 } | 764 } |
| 766 | 765 |
| 767 // Holds the commit charge at the start of the memory test run. | 766 // Holds the commit charge in KBytes at the start of the memory test run. |
| 768 size_t start_commit_charge_; | 767 size_t start_commit_charge_; |
| 769 | 768 |
| 770 // The index of the URL being tested. | 769 // The index of the URL being tested. |
| 771 size_t current_url_index_; | 770 size_t current_url_index_; |
| 772 | 771 |
| 773 // The chrome browser pid. | 772 // The chrome browser pid. |
| 774 base::ProcessId browser_pid_; | 773 base::ProcessId browser_pid_; |
| 775 | 774 |
| 776 // Contains the list of urls against which the tests are run. | 775 // Contains the list of urls against which the tests are run. |
| 777 std::vector<std::string> urls_; | 776 std::vector<std::string> urls_; |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 ASSERT_TRUE(silverlight_key.ReadValue(L"", &plugin_path)); | 1137 ASSERT_TRUE(silverlight_key.ReadValue(L"", &plugin_path)); |
| 1139 ASSERT_FALSE(plugin_path.empty()); | 1138 ASSERT_FALSE(plugin_path.empty()); |
| 1140 | 1139 |
| 1141 FilePath silverlight_path = FilePath::FromWStringHack(plugin_path); | 1140 FilePath silverlight_path = FilePath::FromWStringHack(plugin_path); |
| 1142 FilePath binaries_to_evict[] = {silverlight_path}; | 1141 FilePath binaries_to_evict[] = {silverlight_path}; |
| 1143 | 1142 |
| 1144 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, | 1143 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, |
| 1145 arraysize(binaries_to_evict), binaries_to_evict, | 1144 arraysize(binaries_to_evict), binaries_to_evict, |
| 1146 false /* important */, true); | 1145 false /* important */, true); |
| 1147 } | 1146 } |
| OLD | NEW |