OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <ctype.h> | 5 #include <ctype.h> |
6 #include <algorithm> | 6 #include <algorithm> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Loading... |
41 if (base::Time() != connect_time() && base::Time() != time_of_last_read_) { | 41 if (base::Time() != connect_time() && base::Time() != time_of_last_read_) { |
42 base::TimeDelta duration = time_of_last_read_ - connect_time(); | 42 base::TimeDelta duration = time_of_last_read_ - connect_time(); |
43 // Note: connect_time may be somewhat incorrect if this is cached data, as | 43 // Note: connect_time may be somewhat incorrect if this is cached data, as |
44 // it will reflect the time the connect was done for the original read :-(. | 44 // it will reflect the time the connect was done for the original read :-(. |
45 // To avoid any chances of overflow, and since SDCH is meant to primarilly | 45 // To avoid any chances of overflow, and since SDCH is meant to primarilly |
46 // handle short downloads, we'll restrict what results we log to effectively | 46 // handle short downloads, we'll restrict what results we log to effectively |
47 // discard bogus large numbers. Note that IF the number is large enough, it | 47 // discard bogus large numbers. Note that IF the number is large enough, it |
48 // would DCHECK in histogram as the square of the value is summed. The | 48 // would DCHECK in histogram as the square of the value is summed. The |
49 // relatively precise histogram only properly covers the range 1ms to 10 | 49 // relatively precise histogram only properly covers the range 1ms to 10 |
50 // seconds, so the discarded data would not be that readable anyway. | 50 // seconds, so the discarded data would not be that readable anyway. |
51 if (30 >= duration.InSeconds()) { | 51 if (180 >= duration.InSeconds()) { |
52 if (DECODING_IN_PROGRESS == decoding_status_) | 52 if (DECODING_IN_PROGRESS == decoding_status_) |
53 UMA_HISTOGRAM_TIMES(L"Sdch.Transit_Latency_2", duration); | 53 UMA_HISTOGRAM_MEDIUM_TIMES(L"Sdch.Transit_Latency_M", duration); |
54 if (PASS_THROUGH == decoding_status_) | 54 if (PASS_THROUGH == decoding_status_) |
55 UMA_HISTOGRAM_TIMES(L"Sdch.Transit_Pass-through_Latency_2", duration); | 55 UMA_HISTOGRAM_MEDIUM_TIMES(L"Sdch.Transit_Pass-through_Latency_M", |
| 56 duration); |
56 } | 57 } |
57 } | 58 } |
58 | 59 |
59 UMA_HISTOGRAM_COUNTS(L"Sdch.Bytes read", source_bytes_); | 60 UMA_HISTOGRAM_COUNTS(L"Sdch.Bytes read", source_bytes_); |
60 UMA_HISTOGRAM_COUNTS(L"Sdch.Bytes output", output_bytes_); | 61 UMA_HISTOGRAM_COUNTS(L"Sdch.Bytes output", output_bytes_); |
61 | 62 |
62 if (dictionary_) | 63 if (dictionary_) |
63 dictionary_->Release(); | 64 dictionary_->Release(); |
64 } | 65 } |
65 | 66 |
(...skipping 175 matching lines...) Loading... |
241 memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_, | 242 memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_, |
242 amount); | 243 amount); |
243 dest_buffer_excess_index_ += amount; | 244 dest_buffer_excess_index_ += amount; |
244 if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) { | 245 if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) { |
245 DCHECK(dest_buffer_excess_.size() == dest_buffer_excess_index_); | 246 DCHECK(dest_buffer_excess_.size() == dest_buffer_excess_index_); |
246 dest_buffer_excess_.clear(); | 247 dest_buffer_excess_.clear(); |
247 dest_buffer_excess_index_ = 0; | 248 dest_buffer_excess_index_ = 0; |
248 } | 249 } |
249 return amount; | 250 return amount; |
250 } | 251 } |
OLD | NEW |