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

Side by Side Diff: chrome/test/live_sync/performance/bookmarks_sync_perf_test.cc

Issue 7464046: Sync performance tests: Cleanup TODOs and print in dashboard friendly format (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add benchmark points TODO to all datatypes Created 9 years, 4 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 4
5 #include "chrome/browser/sync/profile_sync_service_harness.h" 5 #include "chrome/browser/sync/profile_sync_service_harness.h"
6 #include "chrome/test/live_sync/live_bookmarks_sync_test.h" 6 #include "chrome/test/live_sync/live_bookmarks_sync_test.h"
7 #include "chrome/test/live_sync/performance/sync_timing_helper.h" 7 #include "chrome/test/live_sync/performance/sync_timing_helper.h"
8 8
9 // TODO(braffert): Move kNumBenchmarkPoints and kBenchmarkPoints for all
10 // datatypes into a performance test base class, once it is possible to do so.
9 static const int kNumBookmarks = 150; 11 static const int kNumBookmarks = 150;
10
11 // TODO(braffert): Consider the range / resolution of these test points.
12 static const int kNumBenchmarkPoints = 18; 12 static const int kNumBenchmarkPoints = 18;
13 static const int kBenchmarkPoints[] = {1, 10, 20, 30, 40, 50, 75, 100, 125, 13 static const int kBenchmarkPoints[] = {1, 10, 20, 30, 40, 50, 75, 100, 125,
14 150, 175, 200, 225, 250, 300, 350, 400, 14 150, 175, 200, 225, 250, 300, 350, 400,
15 500}; 15 500};
16 16
17 // TODO(braffert): Move this class into its own .h/.cc files. What should the
18 // class files be named as opposed to the file containing the tests themselves?
19 class BookmarksSyncPerfTest 17 class BookmarksSyncPerfTest
20 : public TwoClientLiveBookmarksSyncTest { 18 : public TwoClientLiveBookmarksSyncTest {
21 public: 19 public:
22 BookmarksSyncPerfTest() : url_number(0), url_title_number(0) {} 20 BookmarksSyncPerfTest() : url_number(0), url_title_number(0) {}
23 21
24 // Adds |num_urls| new unique bookmarks to the bookmark bar for |profile|. 22 // Adds |num_urls| new unique bookmarks to the bookmark bar for |profile|.
25 void AddURLs(int profile, int num_urls); 23 void AddURLs(int profile, int num_urls);
26 24
27 // Updates the URL for all bookmarks in the bookmark bar for |profile|. 25 // Updates the URL for all bookmarks in the bookmark bar for |profile|.
28 void UpdateURLs(int profile); 26 void UpdateURLs(int profile);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, Add) { 85 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, Add) {
88 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 86 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
89 DisableVerifier(); 87 DisableVerifier();
90 88
91 AddURLs(0, kNumBookmarks); 89 AddURLs(0, kNumBookmarks);
92 base::TimeDelta dt = 90 base::TimeDelta dt =
93 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 91 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
94 ASSERT_EQ(kNumBookmarks, GetBookmarkBarNode(0)->child_count()); 92 ASSERT_EQ(kNumBookmarks, GetBookmarkBarNode(0)->child_count());
95 ASSERT_TRUE(AllModelsMatch()); 93 ASSERT_TRUE(AllModelsMatch());
96 94
97 // TODO(braffert): Compare timings against some target value. 95 SyncTimingHelper::PrintResult("bookmarks", "add", dt);
98 VLOG(0) << std::endl << "dt: " << dt.InSecondsF() << " s";
99 } 96 }
100 97
101 // TCM ID - 7564762. 98 // TCM ID - 7564762.
102 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, Update) { 99 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, Update) {
103 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 100 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
104 DisableVerifier(); 101 DisableVerifier();
105 102
106 AddURLs(0, kNumBookmarks); 103 AddURLs(0, kNumBookmarks);
107 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 104 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
108 105
109 UpdateURLs(0); 106 UpdateURLs(0);
110 base::TimeDelta dt = 107 base::TimeDelta dt =
111 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 108 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
112 ASSERT_EQ(kNumBookmarks, GetBookmarkBarNode(0)->child_count()); 109 ASSERT_EQ(kNumBookmarks, GetBookmarkBarNode(0)->child_count());
113 ASSERT_TRUE(AllModelsMatch()); 110 ASSERT_TRUE(AllModelsMatch());
114 111
115 // TODO(braffert): Compare timings against some target value. 112 SyncTimingHelper::PrintResult("bookmarks", "update", dt);
116 VLOG(0) << std::endl << "dt: " << dt.InSecondsF() << " s";
117 } 113 }
118 114
119 // TCM ID - 7566626. 115 // TCM ID - 7566626.
120 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, Delete) { 116 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, Delete) {
121 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 117 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
122 DisableVerifier(); 118 DisableVerifier();
123 119
124 AddURLs(0, kNumBookmarks); 120 AddURLs(0, kNumBookmarks);
125 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 121 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
126 122
127 RemoveURLs(0); 123 RemoveURLs(0);
128 base::TimeDelta dt = 124 base::TimeDelta dt =
129 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 125 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
130 ASSERT_EQ(0, GetBookmarkBarNode(0)->child_count()); 126 ASSERT_EQ(0, GetBookmarkBarNode(0)->child_count());
131 ASSERT_TRUE(AllModelsMatch()); 127 ASSERT_TRUE(AllModelsMatch());
132 128
133 // TODO(braffert): Compare timings against some target value. 129 SyncTimingHelper::PrintResult("bookmarks", "delete", dt);
134 VLOG(0) << std::endl << "dt: " << dt.InSecondsF() << " s";
135 } 130 }
136 131
137 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, DISABLED_Benchmark) { 132 IN_PROC_BROWSER_TEST_F(BookmarksSyncPerfTest, DISABLED_Benchmark) {
138 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 133 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
139 DisableVerifier(); 134 DisableVerifier();
140 135
141 for (int i = 0; i < kNumBenchmarkPoints; ++i) { 136 for (int i = 0; i < kNumBenchmarkPoints; ++i) {
142 int num_bookmarks = kBenchmarkPoints[i]; 137 int num_bookmarks = kBenchmarkPoints[i];
143 AddURLs(0, num_bookmarks); 138 AddURLs(0, num_bookmarks);
144 base::TimeDelta dt_add = 139 base::TimeDelta dt_add =
(...skipping 15 matching lines...) Expand all
160 base::TimeDelta dt_delete = 155 base::TimeDelta dt_delete =
161 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); 156 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1));
162 ASSERT_EQ(0, GetBookmarkBarNode(0)->child_count()); 157 ASSERT_EQ(0, GetBookmarkBarNode(0)->child_count());
163 ASSERT_TRUE(AllModelsMatch()); 158 ASSERT_TRUE(AllModelsMatch());
164 VLOG(0) << std::endl << "Delete: " << num_bookmarks << " " 159 VLOG(0) << std::endl << "Delete: " << num_bookmarks << " "
165 << dt_delete.InSecondsF(); 160 << dt_delete.InSecondsF();
166 161
167 Cleanup(); 162 Cleanup();
168 } 163 }
169 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698