diff options
author | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 21:42:39 +0000 |
---|---|---|
committer | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 21:42:39 +0000 |
commit | e9d91ff8ae5d3c6412db8bc81aefdf62bb7f5200 (patch) | |
tree | 48f072a88f6829441793299495b423d7f3178f17 /sync | |
parent | 04782106da17474fd72ac06988fcbef155c784ae (diff) | |
download | chromium_src-e9d91ff8ae5d3c6412db8bc81aefdf62bb7f5200.zip chromium_src-e9d91ff8ae5d3c6412db8bc81aefdf62bb7f5200.tar.gz chromium_src-e9d91ff8ae5d3c6412db8bc81aefdf62bb7f5200.tar.bz2 |
Prioritize configuration of data types in data type manager.
Download and associate high-priority types (control types, priority preference and managed users for now) before other types.
BUG=236456
Review URL: https://chromiumcodereview.appspot.com/15067016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/internal_api/debug_info_event_listener.cc | 37 | ||||
-rw-r--r-- | sync/internal_api/debug_info_event_listener.h | 4 | ||||
-rw-r--r-- | sync/internal_api/public/data_type_association_stats.cc | 3 | ||||
-rw-r--r-- | sync/internal_api/public/data_type_association_stats.h | 10 | ||||
-rw-r--r-- | sync/internal_api/public/data_type_debug_info_listener.cc | 15 | ||||
-rw-r--r-- | sync/internal_api/public/data_type_debug_info_listener.h | 31 | ||||
-rw-r--r-- | sync/protocol/client_debug_info.proto | 32 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.cc | 4 | ||||
-rw-r--r-- | sync/sync_internal_api.gypi | 1 | ||||
-rw-r--r-- | sync/syncable/model_type.cc | 2 |
10 files changed, 111 insertions, 28 deletions
diff --git a/sync/internal_api/debug_info_event_listener.cc b/sync/internal_api/debug_info_event_listener.cc index 97ff3eb..ae02a7c 100644 --- a/sync/internal_api/debug_info_event_listener.cc +++ b/sync/internal_api/debug_info_event_listener.cc @@ -171,15 +171,19 @@ base::WeakPtr<DataTypeDebugInfoListener> DebugInfoEventListener::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } -void DebugInfoEventListener::OnDataTypeAssociationComplete( - const DataTypeAssociationStats& association_stats) { +void DebugInfoEventListener::OnSingleDataTypeConfigureComplete( + const DataTypeConfigurationStats& configuration_stats) { DCHECK(thread_checker_.CalledOnValidThread()); - DCHECK(ProtocolTypes().Has(association_stats.model_type)); + 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(association_stats.model_type)); + 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( @@ -201,12 +205,31 @@ void DebugInfoEventListener::OnDataTypeAssociationComplete( datatype_stats->set_num_sync_items_modified( association_stats.num_sync_items_modified); datatype_stats->set_had_error(association_stats.had_error); - datatype_stats->set_download_time_us( - association_stats.download_time.InMicroseconds()); - datatype_stats->set_association_wait_time_us( + 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())); + } AddEventToQueue(association_event); } diff --git a/sync/internal_api/debug_info_event_listener.h b/sync/internal_api/debug_info_event_listener.h index 8aa72f8..a3c15eb 100644 --- a/sync/internal_api/debug_info_event_listener.h +++ b/sync/internal_api/debug_info_event_listener.h @@ -78,8 +78,8 @@ class SYNC_EXPORT_PRIVATE DebugInfoEventListener virtual void GetAndClearDebugInfo(sync_pb::DebugInfo* debug_info) OVERRIDE; // DataTypeDebugInfoListener implementation. - virtual void OnDataTypeAssociationComplete( - const DataTypeAssociationStats& association_stats) OVERRIDE; + virtual void OnSingleDataTypeConfigureComplete( + const DataTypeConfigurationStats& configuration_stats) OVERRIDE; virtual void OnConfigureComplete() OVERRIDE; // Returns a weak pointer to this object. diff --git a/sync/internal_api/public/data_type_association_stats.cc b/sync/internal_api/public/data_type_association_stats.cc index 0a77a7c..4ae4bd1 100644 --- a/sync/internal_api/public/data_type_association_stats.cc +++ b/sync/internal_api/public/data_type_association_stats.cc @@ -7,8 +7,7 @@ namespace syncer { DataTypeAssociationStats::DataTypeAssociationStats() - : model_type(UNSPECIFIED), - num_local_items_before_association(0), + : num_local_items_before_association(0), num_sync_items_before_association(0), num_local_items_after_association(0), num_sync_items_after_association(0), diff --git a/sync/internal_api/public/data_type_association_stats.h b/sync/internal_api/public/data_type_association_stats.h index c779dcd..bda8ff3 100644 --- a/sync/internal_api/public/data_type_association_stats.h +++ b/sync/internal_api/public/data_type_association_stats.h @@ -7,7 +7,6 @@ #include "base/time.h" #include "sync/base/sync_export.h" -#include "sync/internal_api/public/base/model_type.h" namespace syncer { @@ -16,9 +15,6 @@ struct SYNC_EXPORT DataTypeAssociationStats { DataTypeAssociationStats(); ~DataTypeAssociationStats(); - // The datatype that was associated. - ModelType model_type; - // The state of the world before association. int num_local_items_before_association; int num_sync_items_before_association; @@ -39,10 +35,8 @@ struct SYNC_EXPORT DataTypeAssociationStats { // Whether a datatype unrecoverable error was encountered during association. bool had_error; - // Time spent on downloading data for association. - base::TimeDelta download_time; - - // Time waiting for local model loading and preceding data types to finish. + // Waiting time within association manager for loading local models and + // associating other types. base::TimeDelta association_wait_time; // Time spent on association. diff --git a/sync/internal_api/public/data_type_debug_info_listener.cc b/sync/internal_api/public/data_type_debug_info_listener.cc new file mode 100644 index 0000000..08355dd --- /dev/null +++ b/sync/internal_api/public/data_type_debug_info_listener.cc @@ -0,0 +1,15 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sync/internal_api/public/data_type_debug_info_listener.h" + +namespace syncer { + +DataTypeConfigurationStats::DataTypeConfigurationStats() + : model_type(UNSPECIFIED) {} + +DataTypeConfigurationStats::~DataTypeConfigurationStats() {} + +} // namespace syncer + 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 81ee889..82d6459 100644 --- a/sync/internal_api/public/data_type_debug_info_listener.h +++ b/sync/internal_api/public/data_type_debug_info_listener.h @@ -10,12 +10,37 @@ namespace syncer { +struct SYNC_EXPORT DataTypeConfigurationStats { + DataTypeConfigurationStats(); + ~DataTypeConfigurationStats(); + + // The datatype that was configured. + ModelType model_type; + + // Waiting time before downloading starts. + base::TimeDelta download_wait_time; + + // Time spent on downloading data for first-sync data types. + base::TimeDelta download_time; + + // Waiting time for association of higher priority types to finish before + // asking association manager to associate. + base::TimeDelta association_wait_time_for_high_priority; + + // Types configured before this type. + ModelTypeSet high_priority_types_configured_before; + ModelTypeSet same_priority_types_configured_before; + + // Association stats. + DataTypeAssociationStats association_stats; +}; + // Interface for the sync internals to listen to external sync events. class DataTypeDebugInfoListener { public: - // Notify the listener that a datatype's association has completed. - virtual void OnDataTypeAssociationComplete( - const DataTypeAssociationStats& association_stats) = 0; + // 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; diff --git a/sync/protocol/client_debug_info.proto b/sync/protocol/client_debug_info.proto index dee1c34..7ae5a3c 100644 --- a/sync/protocol/client_debug_info.proto +++ b/sync/protocol/client_debug_info.proto @@ -89,6 +89,11 @@ message DatatypeAssociationStats { // The data type ran into an error during model association. optional bool had_error = 12; + // Waiting time before downloading starts. This measures the time between + // receiving configuration request for a set of data types to starting + // downloading data of this type. + optional int64 download_wait_time_us = 15; + // Time spent on downloading sync data for first time sync. // Note: This measures the time between asking backend to download data to // being notified of download-ready by backend. So it consists of @@ -98,13 +103,30 @@ message DatatypeAssociationStats { // |data_type_id| instead of just one data type. optional int64 download_time_us = 13; - // Time between when data of the type becomes ready to when association of - // the type starts. This measures the waiting time for local model loading - // and association of other preceding data types. - optional int64 association_wait_time_us = 14; + // Waiting time for higher priority types to finish association. This + // measures the time between finishing downloading data to requesting + // association manager to associate this batch of types. High priority types + // have near zero waiting time. + optional int64 association_wait_time_for_high_priority_us = 16; + + // Waiting time for other types with same priority during association. + // Data type manger sends types of same priority to association manager to + // configure as a batch. Association manager configures one type at a time. + // This measures the time between when a type is sent to association manager + // (among other types) to when association manager starts configuring the + // type. Total wait time before association is + // |association_wait_time_for_high_priority_us| + + // |association_wait_time_for_same_priority_us| + optional int64 association_wait_time_for_same_priority_us = 14; // Time spent on model association. - optional int64 association_time_us = 15; + optional int64 association_time_us = 17; + + // Higher priority type that's configured before this type. + repeated int32 high_priority_type_configured_before = 18; + + // Same priority type that's configured before this type. + repeated int32 same_priority_type_configured_before = 19; } message DebugEventInfo { diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index c25bbeb..7d3b267 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -801,6 +801,10 @@ base::DictionaryValue* DatatypeAssociationStatsToValue( SET_INT32(num_sync_items_deleted); SET_INT32(num_sync_items_modified); SET_BOOL(had_error); + SET_INT64(download_wait_time_us); + SET_INT64(download_time_us); + SET_INT64(association_wait_time_for_high_priority_us); + SET_INT64(association_wait_time_for_same_priority_us); return value; } diff --git a/sync/sync_internal_api.gypi b/sync/sync_internal_api.gypi index 9016a80..b07762f 100644 --- a/sync/sync_internal_api.gypi +++ b/sync/sync_internal_api.gypi @@ -51,6 +51,7 @@ 'internal_api/public/configure_reason.h', 'internal_api/public/data_type_association_stats.cc', 'internal_api/public/data_type_association_stats.h', + 'internal_api/public/data_type_debug_info_listener.cc', 'internal_api/public/data_type_debug_info_listener.h', 'internal_api/public/delete_journal.h', 'internal_api/public/engine/model_safe_worker.cc', diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc index 22ea71e..9bcd5b2 100644 --- a/sync/syncable/model_type.cc +++ b/sync/syncable/model_type.cc @@ -380,7 +380,7 @@ ModelTypeSet EncryptableUserTypes() { } ModelTypeSet PriorityUserTypes() { - return ModelTypeSet(PRIORITY_PREFERENCES); + return ModelTypeSet(PRIORITY_PREFERENCES, MANAGED_USERS); } ModelTypeSet ControlTypes() { |