0

Adjust histograms to get better data for latency experiments

r=openvcdiff,huanr
Review URL: http://codereview.chromium.org/11810

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5891 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
jar@google.com
2008-11-22 01:40:22 +00:00
parent 4fea401af7
commit e08cb64009
5 changed files with 57 additions and 27 deletions

@ -109,6 +109,13 @@ static const int kUmaTargetedHistogramFlag = 0x1;
counter.AddTime(sample); \
} while (0)
#define UMA_HISTOGRAM_MEDIUM_TIMES(name, sample) do { \
static Histogram counter((name), base::TimeDelta::FromMilliseconds(10), \
base::TimeDelta::FromMinutes(3), 50); \
counter.SetFlags(kUmaTargetedHistogramFlag); \
counter.AddTime(sample); \
} while (0)
// Use this macro when times can routinely be much longer than 10 seconds.
#define UMA_HISTOGRAM_LONG_TIMES(name, sample) do { \
static Histogram counter((name), base::TimeDelta::FromMilliseconds(1), \
@ -199,7 +206,7 @@ class Histogram : public StatsRate {
// input the stats counter sees.
virtual void Add(int value);
// The following methods provide a graphical histogram displays.
// The following methods provide graphical histogram displays.
void WriteHTMLGraph(std::string* output) const;
void WriteAscii(bool graph_it, const std::string& newline,
std::string* output) const;

@ -92,8 +92,19 @@ void Filter::FixupEncodingTypes(
return;
}
if (!is_sdch_response)
if (!is_sdch_response) {
if (1 < encoding_types->size()) {
// Multiple filters were intended to only be used for SDCH (thus far!)
SdchManager::SdchErrorRecovery(
SdchManager::MULTIENCODING_FOR_NON_SDCH_REQUEST);
}
if ((1 == encoding_types->size()) &&
(FILTER_TYPE_SDCH == encoding_types->front())) {
SdchManager::SdchErrorRecovery(
SdchManager::SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST);
}
return;
}
// If content encoding included SDCH, then everything is fine.
if (!encoding_types->empty() &&
@ -103,8 +114,11 @@ void Filter::FixupEncodingTypes(
// payload. To handle this gracefully, we simulate the "probably" deleted
// ",gzip" by appending a tentative gzip decode, which will default to a
// no-op pass through filter if it doesn't get gzip headers where expected.
if (1 == encoding_types->size())
if (1 == encoding_types->size()) {
encoding_types->push_back(FILTER_TYPE_GZIP_HELPING_SDCH);
SdchManager::SdchErrorRecovery(
SdchManager::OPTIONAL_GUNZIP_ENCODING_ADDED);
}
return;
}

@ -48,11 +48,12 @@ SdchFilter::~SdchFilter() {
// would DCHECK in histogram as the square of the value is summed. The
// relatively precise histogram only properly covers the range 1ms to 10
// seconds, so the discarded data would not be that readable anyway.
if (30 >= duration.InSeconds()) {
if (180 >= duration.InSeconds()) {
if (DECODING_IN_PROGRESS == decoding_status_)
UMA_HISTOGRAM_TIMES(L"Sdch.Transit_Latency_2", duration);
UMA_HISTOGRAM_MEDIUM_TIMES(L"Sdch.Transit_Latency_M", duration);
if (PASS_THROUGH == decoding_status_)
UMA_HISTOGRAM_TIMES(L"Sdch.Transit_Pass-through_Latency_2", duration);
UMA_HISTOGRAM_MEDIUM_TIMES(L"Sdch.Transit_Pass-through_Latency_M",
duration);
}
}

@ -65,7 +65,7 @@ bool SdchManager::BlacklistDomain(const GURL& url) {
if (!global_ )
return false;
std::string domain(url.host());
UMA_HISTOGRAM_TIMES(L"Sdch.UptimeBeforeBlacklisting",
UMA_HISTOGRAM_MEDIUM_TIMES(L"Sdch.UptimeBeforeBlacklisting_M",
Time::Now() - FieldTrialList::application_start_time());
global_->blacklisted_domains_.insert(url.host());
return true;

@ -56,7 +56,7 @@ class SdchManager {
enum ProblemCodes {
MIN_PROBLEM_CODE,
// Content Decode problems.
// Content-encoding correction problems.
ADDED_CONTENT_ENCODING,
FIXED_CONTENT_ENCODING,
FIXED_CONTENT_ENCODINGS,
@ -65,39 +65,47 @@ class SdchManager {
DECODE_HEADER_ERROR,
DECODE_BODY_ERROR,
// More content-encoding correction problems.
OPTIONAL_GUNZIP_ENCODING_ADDED,
// Dictionary selection for use problems.
DICTIONARY_FOUND_HAS_WRONG_DOMAIN = 10,
DICTIONARY_FOUND_HAS_WRONG_PORT_LIST,
DICTIONARY_FOUND_HAS_WRONG_PATH,
DICTIONARY_FOUND_HAS_WRONG_SCHEME,
DICTIONARY_HASH_NOT_FOUND,
DICTIONARY_HASH_MALFORMED,
DICTIONARY_FOUND_HAS_WRONG_PORT_LIST = 11,
DICTIONARY_FOUND_HAS_WRONG_PATH = 12,
DICTIONARY_FOUND_HAS_WRONG_SCHEME = 13,
DICTIONARY_HASH_NOT_FOUND = 14,
DICTIONARY_HASH_MALFORMED = 15,
// Decode recovery methods.
META_REFRESH_RECOVERY,
PASSING_THROUGH_NON_SDCH,
UNRECOVERABLE_ERROR,
META_REFRESH_RECOVERY = 16,
PASSING_THROUGH_NON_SDCH = 17,
UNRECOVERABLE_ERROR = 18,
// Dictionary saving problems.
DICTIONARY_HAS_NO_HEADER = 20,
DICTIONARY_HEADER_LINE_MISSING_COLON,
DICTIONARY_MISSING_DOMAIN_SPECIFIER,
DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN,
DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL,
DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL,
DICTIONARY_HAS_NO_TEXT,
DICTIONARY_HEADER_LINE_MISSING_COLON = 21,
DICTIONARY_MISSING_DOMAIN_SPECIFIER = 22,
DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN = 23,
DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL = 24,
DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL = 25,
DICTIONARY_HAS_NO_TEXT = 26,
// Dictionary loading problems.
DICTIONARY_LOAD_ATTEMPT_FROM_DIFFERENT_HOST = 30,
DICTIONARY_SELECTED_FOR_SSL,
DICTIONARY_ALREADY_LOADED,
DICTIONARY_SELECTED_FROM_NON_HTTP,
DICTIONARY_IS_TOO_LARGE,
DICTIONARY_COUNT_EXCEEDED,
DICTIONARY_SELECTED_FOR_SSL = 31,
DICTIONARY_ALREADY_LOADED = 32,
DICTIONARY_SELECTED_FROM_NON_HTTP = 33,
DICTIONARY_IS_TOO_LARGE= 34,
DICTIONARY_COUNT_EXCEEDED = 35,
// Failsafe hack.
ATTEMPT_TO_DECODE_NON_HTTP_DATA = 40,
// Content-Encoding problems detected, with no action taken.
MULTIENCODING_FOR_NON_SDCH_REQUEST = 50,
SDCH_CONTENT_ENCODE_FOR_NON_SDCH_REQUEST = 51,
MAX_PROBLEM_CODE // Used to bound histogram.
};