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

Side by Side Diff: net/http/disk_cache_based_quic_server_info.cc

Issue 708033002: QUIC - track disk cache API calls and failure reasons in separate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged with TOT Created 6 years, 1 month 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
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/http/disk_cache_based_quic_server_info.h" 5 #include "net/http/disk_cache_based_quic_server_info.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/http/http_cache.h" 14 #include "net/http/http_cache.h"
15 #include "net/http/http_network_session.h" 15 #include "net/http/http_network_session.h"
16 #include "net/quic/quic_server_id.h" 16 #include "net/quic/quic_server_id.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 // Histogram that tracks number of times data read/parse/write API calls of
21 // QuicServerInfo to and from disk cache is called.
22 enum QuicServerInfoAPICall {
23 QUIC_SERVER_INFO_START = 0,
24 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY = 1,
25 QUIC_SERVER_INFO_PARSE = 2,
26 QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL = 3,
27 QUIC_SERVER_INFO_READY_TO_PERSIST = 4,
28 QUIC_SERVER_INFO_PERSIST = 5,
29 QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT = 6,
30 QUIC_SERVER_INFO_NUM_OF_API_CALLS = 7,
31 };
32
33 // Histogram that tracks failure reasons to read/load/write of QuicServerInfo to
34 // and from disk cache.
35 enum FailureReason {
36 WAIT_FOR_DATA_READY_INVALID_ARGUMENT_FAILURE = 0,
37 GET_BACKEND_FAILURE = 1,
38 OPEN_FAILURE = 2,
39 CREATE_OR_OPEN_FAILURE = 3,
40 PARSE_NO_DATA_FAILURE = 4,
41 PARSE_FAILURE = 5,
42 READ_FAILURE = 6,
43 READY_TO_PERSIST_FAILURE = 7,
44 PERSIST_NO_BACKEND_FAILURE = 8,
45 WRITE_FAILURE = 9,
46 NUM_OF_FAILURES = 10,
47 };
48
49 void RecordQuicServerInfoStatus(QuicServerInfoAPICall call) {
50 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall", call,
51 QUIC_SERVER_INFO_NUM_OF_API_CALLS);
52 }
53
54 void RecordQuicServerInfoFailure(FailureReason failure) {
55 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason", failure,
56 NUM_OF_FAILURES);
57 }
58
59 // Some APIs inside disk_cache take a handle that the caller must keep alive 20 // Some APIs inside disk_cache take a handle that the caller must keep alive
60 // until the API has finished its asynchronous execution. 21 // until the API has finished its asynchronous execution.
61 // 22 //
62 // Unfortunately, DiskCacheBasedQuicServerInfo may be deleted before the 23 // Unfortunately, DiskCacheBasedQuicServerInfo may be deleted before the
63 // operation completes causing a use-after-free. 24 // operation completes causing a use-after-free.
64 // 25 //
65 // This data shim struct is meant to provide a location for the disk_cache 26 // This data shim struct is meant to provide a location for the disk_cache
66 // APIs to write into even if the originating DiskCacheBasedQuicServerInfo 27 // APIs to write into even if the originating DiskCacheBasedQuicServerInfo
67 // object has been deleted. The lifetime for instances of this struct 28 // object has been deleted. The lifetime for instances of this struct
68 // should be bound to the CompletionCallback that is passed to the disk_cache 29 // should be bound to the CompletionCallback that is passed to the disk_cache
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 349
389 int DiskCacheBasedQuicServerInfo::DoSetDone() { 350 int DiskCacheBasedQuicServerInfo::DoSetDone() {
390 if (entry_) 351 if (entry_)
391 entry_->Close(); 352 entry_->Close();
392 entry_ = NULL; 353 entry_ = NULL;
393 new_data_.clear(); 354 new_data_.clear();
394 state_ = NONE; 355 state_ = NONE;
395 return OK; 356 return OK;
396 } 357 }
397 358
359 void DiskCacheBasedQuicServerInfo::RecordQuicServerInfoStatus(
360 QuicServerInfoAPICall call) {
361 if (!backend_) {
362 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.NoBackend", call,
363 QUIC_SERVER_INFO_NUM_OF_API_CALLS);
364 } else if (backend_->GetCacheType() == net::MEMORY_CACHE) {
365 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.MemoryCache", call,
366 QUIC_SERVER_INFO_NUM_OF_API_CALLS);
367 } else {
368 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.DiskCache", call,
369 QUIC_SERVER_INFO_NUM_OF_API_CALLS);
370 }
371 }
372
373 void DiskCacheBasedQuicServerInfo::RecordQuicServerInfoFailure(
374 FailureReason failure) {
375 if (!backend_) {
376 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.NoBackend",
377 failure, NUM_OF_FAILURES);
378 } else if (backend_->GetCacheType() == net::MEMORY_CACHE) {
379 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache",
380 failure, NUM_OF_FAILURES);
381 } else {
382 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache",
383 failure, NUM_OF_FAILURES);
384 }
385 }
386
398 } // namespace net 387 } // namespace net
OLDNEW
« no previous file with comments | « net/http/disk_cache_based_quic_server_info.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698