| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 NOTREACHED() | 1281 NOTREACHED() |
| 1282 << "The same transaction shouldn't start twice without new timing."; | 1282 << "The same transaction shouldn't start twice without new timing."; |
| 1283 return; | 1283 return; |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 base::TimeDelta to_start = base::Time::Now() - request_creation_time_; | 1286 base::TimeDelta to_start = base::Time::Now() - request_creation_time_; |
| 1287 request_creation_time_ = base::Time(); | 1287 request_creation_time_ = base::Time(); |
| 1288 | 1288 |
| 1289 UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpTimeToFirstByte", to_start); | 1289 UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpTimeToFirstByte", to_start); |
| 1290 | 1290 |
| 1291 static const bool use_overlapped_read_histogram = |
| 1292 base::FieldTrialList::TrialExists("OverlappedReadImpact"); |
| 1293 if (use_overlapped_read_histogram) { |
| 1294 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 1295 base::FieldTrial::MakeName("Net.HttpTimeToFirstByte", |
| 1296 "OverlappedReadImpact"), |
| 1297 to_start); |
| 1298 } |
| 1299 |
| 1291 static const bool use_warm_socket_impact_histogram = | 1300 static const bool use_warm_socket_impact_histogram = |
| 1292 base::FieldTrialList::TrialExists("WarmSocketImpact"); | 1301 base::FieldTrialList::TrialExists("WarmSocketImpact"); |
| 1293 if (use_warm_socket_impact_histogram) { | 1302 if (use_warm_socket_impact_histogram) { |
| 1294 UMA_HISTOGRAM_MEDIUM_TIMES( | 1303 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 1295 base::FieldTrial::MakeName("Net.HttpTimeToFirstByte", | 1304 base::FieldTrial::MakeName("Net.HttpTimeToFirstByte", |
| 1296 "WarmSocketImpact"), | 1305 "WarmSocketImpact"), |
| 1297 to_start); | 1306 to_start); |
| 1298 } | 1307 } |
| 1299 | 1308 |
| 1300 static const bool use_prefetch_histogram = | 1309 static const bool use_prefetch_histogram = |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 } | 1483 } |
| 1475 | 1484 |
| 1476 if (response_info_) { | 1485 if (response_info_) { |
| 1477 if (response_info_->was_cached) { | 1486 if (response_info_->was_cached) { |
| 1478 UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeCached", total_time); | 1487 UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeCached", total_time); |
| 1479 } else { | 1488 } else { |
| 1480 UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeNotCached", total_time); | 1489 UMA_HISTOGRAM_TIMES("Net.HttpJob.TotalTimeNotCached", total_time); |
| 1481 } | 1490 } |
| 1482 } | 1491 } |
| 1483 | 1492 |
| 1493 static const bool use_overlapped_read_histogram = |
| 1494 base::FieldTrialList::TrialExists("OverlappedReadImpact"); |
| 1495 if (use_overlapped_read_histogram) { |
| 1496 UMA_HISTOGRAM_TIMES( |
| 1497 base::FieldTrial::MakeName("Net.HttpJob.TotalTime", |
| 1498 "OverlappedReadImpact"), |
| 1499 total_time); |
| 1500 |
| 1501 if (reason == FINISHED) { |
| 1502 UMA_HISTOGRAM_TIMES( |
| 1503 base::FieldTrial::MakeName("Net.HttpJob.TotalTimeSuccess", |
| 1504 "OverlappedReadImpact"), |
| 1505 total_time); |
| 1506 } else { |
| 1507 UMA_HISTOGRAM_TIMES( |
| 1508 base::FieldTrial::MakeName("Net.HttpJob.TotalTimeCancel", |
| 1509 "OverlappedReadImpact"), |
| 1510 total_time); |
| 1511 } |
| 1512 |
| 1513 if (response_info_) { |
| 1514 if (response_info_->was_cached) { |
| 1515 UMA_HISTOGRAM_TIMES( |
| 1516 base::FieldTrial::MakeName("Net.HttpJob.TotalTimeCached", |
| 1517 "OverlappedReadImpact"), |
| 1518 total_time); |
| 1519 } else { |
| 1520 UMA_HISTOGRAM_TIMES( |
| 1521 base::FieldTrial::MakeName("Net.HttpJob.TotalTimeNotCached", |
| 1522 "OverlappedReadImpact"), |
| 1523 total_time); |
| 1524 } |
| 1525 } |
| 1526 } |
| 1527 |
| 1484 start_time_ = base::TimeTicks(); | 1528 start_time_ = base::TimeTicks(); |
| 1485 } | 1529 } |
| 1486 | 1530 |
| 1487 void URLRequestHttpJob::DoneWithRequest(CompletionCause reason) { | 1531 void URLRequestHttpJob::DoneWithRequest(CompletionCause reason) { |
| 1488 if (done_) | 1532 if (done_) |
| 1489 return; | 1533 return; |
| 1490 done_ = true; | 1534 done_ = true; |
| 1491 | 1535 |
| 1492 RecordPerfHistograms(reason); | 1536 RecordPerfHistograms(reason); |
| 1493 if (reason == FINISHED) | 1537 if (reason == FINISHED) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1504 | 1548 |
| 1505 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1549 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1506 awaiting_callback_ = false; | 1550 awaiting_callback_ = false; |
| 1507 } | 1551 } |
| 1508 | 1552 |
| 1509 void URLRequestHttpJob::OnDetachRequest() { | 1553 void URLRequestHttpJob::OnDetachRequest() { |
| 1510 http_transaction_delegate_->OnDetachRequest(); | 1554 http_transaction_delegate_->OnDetachRequest(); |
| 1511 } | 1555 } |
| 1512 | 1556 |
| 1513 } // namespace net | 1557 } // namespace net |
| OLD | NEW |