OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/net/network_stats.h" | 5 #include "chrome/browser/net/network_stats.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 410 } |
411 | 411 |
412 bool NetworkStats::UpdateReception(const ProbePacket& probe_packet) { | 412 bool NetworkStats::UpdateReception(const ProbePacket& probe_packet) { |
413 uint32 packet_index = probe_packet.packet_index(); | 413 uint32 packet_index = probe_packet.packet_index(); |
414 if (packet_index >= packet_rtt_.size()) | 414 if (packet_index >= packet_rtt_.size()) |
415 return false; | 415 return false; |
416 packets_received_mask_.set(packet_index); | 416 packets_received_mask_.set(packet_index); |
417 TestType test_type = test_sequence_[current_test_index_]; | 417 TestType test_type = test_sequence_[current_test_index_]; |
418 uint32 received_packets = packets_received_mask_.count(); | 418 uint32 received_packets = packets_received_mask_.count(); |
419 | 419 |
420 // Now() has resolution ~1-15ms. HighResNow() has high resolution but it | |
421 // is warned not to use it unless necessary. | |
422 base::TimeTicks current_time = base::TimeTicks::Now(); | 420 base::TimeTicks current_time = base::TimeTicks::Now(); |
423 last_arrival_time_ = current_time; | 421 last_arrival_time_ = current_time; |
424 if (first_arrival_time_.is_null()) | 422 if (first_arrival_time_.is_null()) |
425 first_arrival_time_ = current_time; | 423 first_arrival_time_ = current_time; |
426 | 424 |
427 // Need to do this after updating the last_arrival_time_ since NAT_BIND_TEST | 425 // Need to do this after updating the last_arrival_time_ since NAT_BIND_TEST |
428 // and PACKET_SIZE_TEST record the SendToLastRecvDelay. | 426 // and PACKET_SIZE_TEST record the SendToLastRecvDelay. |
429 if (test_type == NAT_BIND_TEST) { | 427 if (test_type == NAT_BIND_TEST) { |
430 return received_packets >= maximum_NAT_packets_; | 428 return received_packets >= maximum_NAT_packets_; |
431 } | 429 } |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 udp_stats_client->Start(host_resolver, | 953 udp_stats_client->Start(host_resolver, |
956 server_address, | 954 server_address, |
957 histogram_port, | 955 histogram_port, |
958 has_proxy_server, | 956 has_proxy_server, |
959 kProbePacketBytes[probe_choice], | 957 kProbePacketBytes[probe_choice], |
960 bytes_for_packet_size_test, | 958 bytes_for_packet_size_test, |
961 net::CompletionCallback()); | 959 net::CompletionCallback()); |
962 } | 960 } |
963 | 961 |
964 } // namespace chrome_browser_net | 962 } // namespace chrome_browser_net |
OLD | NEW |