Chromium Code Reviews| 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/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 job_controller_set_.size() <= last_logged_job_controller_count_) { | 365 job_controller_set_.size() <= last_logged_job_controller_count_) { |
| 366 return; | 366 return; |
| 367 } | 367 } |
| 368 last_logged_job_controller_count_ = job_controller_set_.size(); | 368 last_logged_job_controller_count_ = job_controller_set_.size(); |
| 369 | 369 |
| 370 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobController", | 370 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobController", |
| 371 job_controller_set_.size()); | 371 job_controller_set_.size()); |
| 372 | 372 |
| 373 int alt_job_count = 0; | 373 int alt_job_count = 0; |
| 374 int main_job_count = 0; | 374 int main_job_count = 0; |
| 375 int pending_request_count = 0; | 375 size_t pending_request_count = 0; |
|
xunjieli
2017/04/19 15:12:13
nit: s/pending_request_count/num_controllers_with_
Zhongyi Shi
2017/04/19 17:38:53
Done.
| |
| 376 int preconnect_controller_count = 0; | 376 size_t preconnect_controller_count = 0; |
|
xunjieli
2017/04/19 15:12:13
nit: s/preconnect_controller_count/num_controllers
Zhongyi Shi
2017/04/19 17:38:53
Done.
| |
| 377 for (const auto& job_controller : job_controller_set_) { | 377 for (const auto& job_controller : job_controller_set_) { |
| 378 DCHECK(job_controller->HasPendingAltJob() || | 378 DCHECK(job_controller->HasPendingAltJob() || |
| 379 job_controller->HasPendingMainJob()); | 379 job_controller->HasPendingMainJob()); |
| 380 // Additionally logs the states of the jobs if there are at least 500 | 380 // Additionally logs the states of the jobs if there are at least 500 |
| 381 // controllers, which suggests that there might be a leak. | 381 // controllers, which suggests that there might be a leak. |
| 382 if (job_controller_set_.size() >= 500) | 382 if (job_controller_set_.size() >= 500) |
| 383 job_controller->LogHistograms(); | 383 job_controller->LogHistograms(); |
| 384 // For a preconnect controller, it should have exactly the main job. | 384 // For a preconnect controller, it should have exactly the main job. |
| 385 if (job_controller->is_preconnect()) { | 385 if (job_controller->is_preconnect()) { |
| 386 preconnect_controller_count++; | 386 preconnect_controller_count++; |
| 387 continue; | 387 continue; |
| 388 } | 388 } |
| 389 // For non-preconnects. | 389 // For non-preconnects. |
| 390 if (job_controller->HasPendingRequest()) | 390 if (job_controller->HasPendingRequest()) |
| 391 pending_request_count++; | 391 pending_request_count++; |
| 392 if (job_controller->HasPendingAltJob()) | 392 if (job_controller->HasPendingAltJob()) |
| 393 alt_job_count++; | 393 alt_job_count++; |
| 394 if (job_controller->HasPendingMainJob()) | 394 if (job_controller->HasPendingMainJob()) |
| 395 main_job_count++; | 395 main_job_count++; |
| 396 } | 396 } |
| 397 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfPreconnect", | 397 UMA_HISTOGRAM_COUNTS_1M( |
| 398 preconnect_controller_count); | 398 "Net.JobControllerSet.CountOfJobController.Preconnect", |
| 399 preconnect_controller_count); | |
| 400 UMA_HISTOGRAM_COUNTS_1M( | |
| 401 "Net.JobControllerSet.CountOfJobCOntroller.NonPerconnect.PendingRequest", | |
|
xunjieli
2017/04/19 15:12:14
s/COntroller/Controller
s/Perconnect/Preconnect
Zhongyi Shi
2017/04/19 17:38:53
Done.
| |
| 402 pending_request_count); | |
| 403 | |
| 404 DCHECK_GE(job_controller_set_.size() - preconnect_controller_count, | |
| 405 pending_request_count); | |
|
xunjieli
2017/04/19 15:12:13
nit: can we calculate this value and DCHECK on it?
Zhongyi Shi
2017/04/19 17:38:53
DCHECK_GE(job_controller_set_.size() - preconnect_
xunjieli
2017/04/19 17:50:04
We can't depend on DCHECK doing the overflow check
| |
| 406 UMA_HISTOGRAM_COUNTS_1M( | |
| 407 "Net.JobControllerSet.CountOfJobController.NonPreconnect.RequestGone", | |
| 408 job_controller_set_.size() - preconnect_controller_count - | |
| 409 pending_request_count); | |
| 410 | |
| 399 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectAltJob", | 411 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectAltJob", |
| 400 alt_job_count); | 412 alt_job_count); |
| 401 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectMainJob", | 413 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectMainJob", |
| 402 main_job_count); | 414 main_job_count); |
| 403 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfPendingRequest", | |
| 404 pending_request_count); | |
| 405 } | 415 } |
| 406 | 416 |
| 407 void HttpStreamFactoryImpl::DumpMemoryStats( | 417 void HttpStreamFactoryImpl::DumpMemoryStats( |
| 408 base::trace_event::ProcessMemoryDump* pmd, | 418 base::trace_event::ProcessMemoryDump* pmd, |
| 409 const std::string& parent_absolute_name) const { | 419 const std::string& parent_absolute_name) const { |
| 410 if (job_controller_set_.empty()) | 420 if (job_controller_set_.empty()) |
| 411 return; | 421 return; |
| 412 std::string name = | 422 std::string name = |
| 413 base::StringPrintf("%s/stream_factory", parent_absolute_name.c_str()); | 423 base::StringPrintf("%s/stream_factory", parent_absolute_name.c_str()); |
| 414 base::trace_event::MemoryAllocatorDump* factory_dump = | 424 base::trace_event::MemoryAllocatorDump* factory_dump = |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 444 factory_dump->AddScalar("main_job_count", | 454 factory_dump->AddScalar("main_job_count", |
| 445 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 455 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 446 main_job_count); | 456 main_job_count); |
| 447 // The number of preconnect controllers. | 457 // The number of preconnect controllers. |
| 448 factory_dump->AddScalar("preconnect_count", | 458 factory_dump->AddScalar("preconnect_count", |
| 449 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 459 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 450 preconnect_controller_count); | 460 preconnect_controller_count); |
| 451 } | 461 } |
| 452 | 462 |
| 453 } // namespace net | 463 } // namespace net |
| OLD | NEW |