OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/base/mime_sniffer.h" | 5 #include "net/base/mime_sniffer.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bits.h" | 9 #include "base/bits.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 static_cast<size_t>( | 92 static_cast<size_t>( |
93 1u << base::bits::Log2Ceiling(kTargetSize / plaintext.size())); | 93 1u << base::bits::Log2Ceiling(kTargetSize / plaintext.size())); |
94 plaintext.reserve(expected_size); | 94 plaintext.reserve(expected_size); |
95 while (plaintext.size() < kTargetSize) | 95 while (plaintext.size() < kTargetSize) |
96 plaintext += plaintext; | 96 plaintext += plaintext; |
97 DCHECK_EQ(expected_size, plaintext.size()); | 97 DCHECK_EQ(expected_size, plaintext.size()); |
98 RunLooksLikeBinary(plaintext, kWarmupIterations); | 98 RunLooksLikeBinary(plaintext, kWarmupIterations); |
99 base::ElapsedTimer elapsed_timer; | 99 base::ElapsedTimer elapsed_timer; |
100 RunLooksLikeBinary(plaintext, kMeasuredIterations); | 100 RunLooksLikeBinary(plaintext, kMeasuredIterations); |
101 LOG(INFO) << (elapsed_timer.Elapsed().InMicroseconds() * 1000 * 1024 / | 101 LOG(INFO) << (elapsed_timer.Elapsed().InMicroseconds() * 1000 * 1024 / |
102 (static_cast<int64>(plaintext.size()) * kMeasuredIterations)) | 102 (static_cast<int64_t>(plaintext.size()) * kMeasuredIterations)) |
103 << "ns per KB"; | 103 << "ns per KB"; |
104 } | 104 } |
105 | 105 |
106 } // namespace net | 106 } // namespace net |
107 } // namespace | 107 } // namespace |
OLD | NEW |