| OLD | NEW |
| 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/test/integration/performance/sync_timing_helper.h" | 5 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 SyncTimingHelper::SyncTimingHelper() {} | 12 SyncTimingHelper::SyncTimingHelper() {} |
| 13 | 13 |
| 14 SyncTimingHelper::~SyncTimingHelper() {} | 14 SyncTimingHelper::~SyncTimingHelper() {} |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 base::TimeDelta SyncTimingHelper::TimeSyncCycle( | 17 base::TimeDelta SyncTimingHelper::TimeSyncCycle( |
| 18 ProfileSyncServiceHarness* client) { | 18 ProfileSyncServiceHarness* client) { |
| 19 base::Time start = base::Time::Now(); | 19 base::Time start = base::Time::Now(); |
| 20 EXPECT_TRUE(client->AwaitFullSyncCompletion()); | 20 EXPECT_TRUE(client->AwaitCommitActivityCompletion()); |
| 21 return base::Time::Now() - start; | 21 return base::Time::Now() - start; |
| 22 } | 22 } |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 base::TimeDelta SyncTimingHelper::TimeMutualSyncCycle( | 25 base::TimeDelta SyncTimingHelper::TimeMutualSyncCycle( |
| 26 ProfileSyncServiceHarness* client, ProfileSyncServiceHarness* partner) { | 26 ProfileSyncServiceHarness* client, ProfileSyncServiceHarness* partner) { |
| 27 base::Time start = base::Time::Now(); | 27 base::Time start = base::Time::Now(); |
| 28 EXPECT_TRUE(client->AwaitMutualSyncCycleCompletion(partner)); | 28 EXPECT_TRUE(client->AwaitMutualSyncCycleCompletion(partner)); |
| 29 return base::Time::Now() - start; | 29 return base::Time::Now() - start; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 base::TimeDelta SyncTimingHelper::TimeUntilQuiescence( | 33 base::TimeDelta SyncTimingHelper::TimeUntilQuiescence( |
| 34 std::vector<ProfileSyncServiceHarness*>& clients) { | 34 std::vector<ProfileSyncServiceHarness*>& clients) { |
| 35 base::Time start = base::Time::Now(); | 35 base::Time start = base::Time::Now(); |
| 36 EXPECT_TRUE(ProfileSyncServiceHarness::AwaitQuiescence(clients)); | 36 EXPECT_TRUE(ProfileSyncServiceHarness::AwaitQuiescence(clients)); |
| 37 return base::Time::Now() - start; | 37 return base::Time::Now() - start; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 void SyncTimingHelper::PrintResult(const std::string& measurement, | 41 void SyncTimingHelper::PrintResult(const std::string& measurement, |
| 42 const std::string& trace, | 42 const std::string& trace, |
| 43 const base::TimeDelta& dt) { | 43 const base::TimeDelta& dt) { |
| 44 printf("*RESULT %s: %s= %s ms\n", measurement.c_str(), trace.c_str(), | 44 printf("*RESULT %s: %s= %s ms\n", measurement.c_str(), trace.c_str(), |
| 45 base::IntToString(dt.InMillisecondsF()).c_str()); | 45 base::IntToString(dt.InMillisecondsF()).c_str()); |
| 46 } | 46 } |
| OLD | NEW |