diff options
author | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 00:15:54 +0000 |
---|---|---|
committer | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-20 00:15:54 +0000 |
commit | aa00bc21adb737f4fc6f2a125cbe813327a0dad0 (patch) | |
tree | a7013ff84b144ee7c5500d0ca2bdb155dc59a4f1 /sync | |
parent | f01ad959b1d23349779c6e22887146ceed78510d (diff) | |
download | chromium_src-aa00bc21adb737f4fc6f2a125cbe813327a0dad0.zip chromium_src-aa00bc21adb737f4fc6f2a125cbe813327a0dad0.tar.gz chromium_src-aa00bc21adb737f4fc6f2a125cbe813327a0dad0.tar.bz2 |
Send configuration stats together at the end of data type configuration so that
the stats will appear in one GWS log to make it easy to analyze.
BUG=236466
Review URL: https://chromiumcodereview.appspot.com/23866012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/engine/download_unittest.cc | 5 | ||||
-rw-r--r-- | sync/internal_api/debug_info_event_listener.cc | 132 | ||||
-rw-r--r-- | sync/internal_api/debug_info_event_listener.h | 6 | ||||
-rw-r--r-- | sync/internal_api/public/data_type_debug_info_listener.h | 11 |
4 files changed, 78 insertions, 76 deletions
diff --git a/sync/engine/download_unittest.cc b/sync/engine/download_unittest.cc index 6aac31d..fb4431a 100644 --- a/sync/engine/download_unittest.cc +++ b/sync/engine/download_unittest.cc @@ -144,7 +144,10 @@ TEST_F(DownloadUpdatesTest, VerifyAppendDebugInfo) { // Create a new session, record an event, and try again. scoped_ptr<sessions::SyncSession> session2( sessions::SyncSession::Build(context(), delegate())); - debug_info_event_listener()->OnConfigureComplete(); + DataTypeConfigurationStats stats; + stats.model_type = BOOKMARKS; + debug_info_event_listener()->OnDataTypeConfigureComplete( + std::vector<DataTypeConfigurationStats>(1, stats)); sync_pb::ClientToServerMessage msg2; BuildNormalDownloadUpdates(session2.get(), false, diff --git a/sync/internal_api/debug_info_event_listener.cc b/sync/internal_api/debug_info_event_listener.cc index 64bbab8..51e6c0f 100644 --- a/sync/internal_api/debug_info_event_listener.cc +++ b/sync/internal_api/debug_info_event_listener.cc @@ -177,76 +177,76 @@ base::WeakPtr<DataTypeDebugInfoListener> DebugInfoEventListener::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } -void DebugInfoEventListener::OnSingleDataTypeConfigureComplete( - const DataTypeConfigurationStats& configuration_stats) { +void DebugInfoEventListener::OnDataTypeConfigureComplete( + const std::vector<DataTypeConfigurationStats>& configuration_stats) { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(ProtocolTypes().Has(configuration_stats.model_type)); - - const DataTypeAssociationStats& association_stats = - configuration_stats.association_stats; - - sync_pb::DebugEventInfo association_event; - sync_pb::DatatypeAssociationStats* datatype_stats = - association_event.mutable_datatype_association_stats(); - datatype_stats->set_data_type_id( - GetSpecificsFieldNumberFromModelType(configuration_stats.model_type)); - datatype_stats->set_num_local_items_before_association( - association_stats.num_local_items_before_association); - datatype_stats->set_num_sync_items_before_association( - association_stats.num_sync_items_before_association); - datatype_stats->set_num_local_items_after_association( - association_stats.num_local_items_after_association); - datatype_stats->set_num_sync_items_after_association( - association_stats.num_sync_items_after_association); - datatype_stats->set_num_local_items_added( - association_stats.num_local_items_added); - datatype_stats->set_num_local_items_deleted( - association_stats.num_local_items_deleted); - datatype_stats->set_num_local_items_modified( - association_stats.num_local_items_modified); - datatype_stats->set_num_sync_items_added( - association_stats.num_sync_items_added); - datatype_stats->set_num_sync_items_deleted( - association_stats.num_sync_items_deleted); - datatype_stats->set_num_sync_items_modified( - association_stats.num_sync_items_modified); - datatype_stats->set_local_version_pre_association( - association_stats.local_version_pre_association); - datatype_stats->set_sync_version_pre_association( - association_stats.sync_version_pre_association); - datatype_stats->set_had_error(association_stats.had_error); - datatype_stats->set_association_wait_time_for_same_priority_us( - association_stats.association_wait_time.InMicroseconds()); - datatype_stats->set_association_time_us( - association_stats.association_time.InMicroseconds()); - datatype_stats->set_download_wait_time_us( - configuration_stats.download_wait_time.InMicroseconds()); - datatype_stats->set_download_time_us( - configuration_stats.download_time.InMicroseconds()); - datatype_stats->set_association_wait_time_for_high_priority_us( - configuration_stats.association_wait_time_for_high_priority - .InMicroseconds()); - - for (ModelTypeSet::Iterator it = - configuration_stats.high_priority_types_configured_before.First(); - it.Good(); it.Inc()) { - datatype_stats->add_high_priority_type_configured_before( - GetSpecificsFieldNumberFromModelType(it.Get())); - } - for (ModelTypeSet::Iterator it = - configuration_stats.same_priority_types_configured_before.First(); - it.Good(); it.Inc()) { - datatype_stats->add_same_priority_type_configured_before( - GetSpecificsFieldNumberFromModelType(it.Get())); - } + for (size_t i = 0; i < configuration_stats.size(); ++i) { + DCHECK(ProtocolTypes().Has(configuration_stats[i].model_type)); + const DataTypeAssociationStats& association_stats = + configuration_stats[i].association_stats; + + sync_pb::DebugEventInfo association_event; + sync_pb::DatatypeAssociationStats* datatype_stats = + association_event.mutable_datatype_association_stats(); + datatype_stats->set_data_type_id( + GetSpecificsFieldNumberFromModelType( + configuration_stats[i].model_type)); + datatype_stats->set_num_local_items_before_association( + association_stats.num_local_items_before_association); + datatype_stats->set_num_sync_items_before_association( + association_stats.num_sync_items_before_association); + datatype_stats->set_num_local_items_after_association( + association_stats.num_local_items_after_association); + datatype_stats->set_num_sync_items_after_association( + association_stats.num_sync_items_after_association); + datatype_stats->set_num_local_items_added( + association_stats.num_local_items_added); + datatype_stats->set_num_local_items_deleted( + association_stats.num_local_items_deleted); + datatype_stats->set_num_local_items_modified( + association_stats.num_local_items_modified); + datatype_stats->set_num_sync_items_added( + association_stats.num_sync_items_added); + datatype_stats->set_num_sync_items_deleted( + association_stats.num_sync_items_deleted); + datatype_stats->set_num_sync_items_modified( + association_stats.num_sync_items_modified); + datatype_stats->set_local_version_pre_association( + association_stats.local_version_pre_association); + datatype_stats->set_sync_version_pre_association( + association_stats.sync_version_pre_association); + datatype_stats->set_had_error(association_stats.had_error); + datatype_stats->set_association_wait_time_for_same_priority_us( + association_stats.association_wait_time.InMicroseconds()); + datatype_stats->set_association_time_us( + association_stats.association_time.InMicroseconds()); + datatype_stats->set_download_wait_time_us( + configuration_stats[i].download_wait_time.InMicroseconds()); + datatype_stats->set_download_time_us( + configuration_stats[i].download_time.InMicroseconds()); + datatype_stats->set_association_wait_time_for_high_priority_us( + configuration_stats[i].association_wait_time_for_high_priority + .InMicroseconds()); + + for (ModelTypeSet::Iterator it = + configuration_stats[i].high_priority_types_configured_before + .First(); + it.Good(); it.Inc()) { + datatype_stats->add_high_priority_type_configured_before( + GetSpecificsFieldNumberFromModelType(it.Get())); + } - AddEventToQueue(association_event); -} + for (ModelTypeSet::Iterator it = + configuration_stats[i].same_priority_types_configured_before + .First(); + it.Good(); it.Inc()) { + datatype_stats->add_same_priority_type_configured_before( + GetSpecificsFieldNumberFromModelType(it.Get())); + } -void DebugInfoEventListener::OnConfigureComplete() { - DCHECK(thread_checker_.CalledOnValidThread()); - CreateAndAddEvent(sync_pb::DebugEventInfo::CONFIGURE_COMPLETE); + AddEventToQueue(association_event); + } } void DebugInfoEventListener::CreateAndAddEvent( diff --git a/sync/internal_api/debug_info_event_listener.h b/sync/internal_api/debug_info_event_listener.h index 022fafb..c3aa9d0 100644 --- a/sync/internal_api/debug_info_event_listener.h +++ b/sync/internal_api/debug_info_event_listener.h @@ -77,9 +77,9 @@ class SYNC_EXPORT_PRIVATE DebugInfoEventListener virtual void GetAndClearDebugInfo(sync_pb::DebugInfo* debug_info) OVERRIDE; // DataTypeDebugInfoListener implementation. - virtual void OnSingleDataTypeConfigureComplete( - const DataTypeConfigurationStats& configuration_stats) OVERRIDE; - virtual void OnConfigureComplete() OVERRIDE; + virtual void OnDataTypeConfigureComplete( + const std::vector<DataTypeConfigurationStats>& configuration_stats) + OVERRIDE; // Returns a weak pointer to this object. base::WeakPtr<DataTypeDebugInfoListener> GetWeakPtr(); diff --git a/sync/internal_api/public/data_type_debug_info_listener.h b/sync/internal_api/public/data_type_debug_info_listener.h index 82d6459..6395a04 100644 --- a/sync/internal_api/public/data_type_debug_info_listener.h +++ b/sync/internal_api/public/data_type_debug_info_listener.h @@ -5,6 +5,8 @@ #ifndef SYNC_INTERNAL_API_PUBLIC_DATA_TYPE_DEBUG_INFO_LISTENER_H_ #define SYNC_INTERNAL_API_PUBLIC_DATA_TYPE_DEBUG_INFO_LISTENER_H_ +#include <vector> + #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/data_type_association_stats.h" @@ -38,12 +40,9 @@ struct SYNC_EXPORT DataTypeConfigurationStats { // Interface for the sync internals to listen to external sync events. class DataTypeDebugInfoListener { public: - // Notify the listener that configuration of one data type has completed. - virtual void OnSingleDataTypeConfigureComplete( - const DataTypeConfigurationStats& configuration_stats) = 0; - - // Notify the listener that configuration has completed and sync has begun. - virtual void OnConfigureComplete() = 0; + // Notify the listener that configuration of data types has completed. + virtual void OnDataTypeConfigureComplete( + const std::vector<DataTypeConfigurationStats>& configuration_stats) = 0; }; } // namespace syncer |