| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "src/counters-inl.h" | 7 #include "src/counters-inl.h" |
| 8 #include "src/counters.h" | 8 #include "src/counters.h" |
| 9 #include "src/handles-inl.h" | 9 #include "src/handles-inl.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 void AddSample(int value) { samples_.push_back(value); } | 21 void AddSample(int value) { samples_.push_back(value); } |
| 22 std::vector<int>* samples() { return &samples_; } | 22 std::vector<int>* samples() { return &samples_; } |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 std::vector<int> samples_; | 25 std::vector<int> samples_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 | 28 |
| 29 class AggregatedMemoryHistogramTest : public ::testing::Test { | 29 class AggregatedMemoryHistogramTest : public ::testing::Test { |
| 30 public: | 30 public: |
| 31 AggregatedMemoryHistogramTest() { | 31 AggregatedMemoryHistogramTest() : aggregated_(&mock_) {} |
| 32 aggregated_ = AggregatedMemoryHistogram<MockHistogram>(&mock_); | |
| 33 } | |
| 34 virtual ~AggregatedMemoryHistogramTest() {} | 32 virtual ~AggregatedMemoryHistogramTest() {} |
| 35 | 33 |
| 36 void AddSample(double current_ms, double current_value) { | 34 void AddSample(double current_ms, double current_value) { |
| 37 aggregated_.AddSample(current_ms, current_value); | 35 aggregated_.AddSample(current_ms, current_value); |
| 38 } | 36 } |
| 39 | 37 |
| 40 std::vector<int>* samples() { return mock_.samples(); } | 38 std::vector<int>* samples() { return mock_.samples(); } |
| 41 | 39 |
| 42 private: | 40 private: |
| 43 AggregatedMemoryHistogram<MockHistogram> aggregated_; | 41 AggregatedMemoryHistogram<MockHistogram> aggregated_; |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 EXPECT_EQ(1, counter()->count()); | 499 EXPECT_EQ(1, counter()->count()); |
| 502 EXPECT_EQ(2, counter2()->count()); | 500 EXPECT_EQ(2, counter2()->count()); |
| 503 EXPECT_EQ(2, counter3()->count()); | 501 EXPECT_EQ(2, counter3()->count()); |
| 504 EXPECT_IN_RANGE(250, counter()->time().InMilliseconds(), 250 + kEpsilonMs); | 502 EXPECT_IN_RANGE(250, counter()->time().InMilliseconds(), 250 + kEpsilonMs); |
| 505 EXPECT_IN_RANGE(300, counter2()->time().InMilliseconds(), 300 + kEpsilonMs); | 503 EXPECT_IN_RANGE(300, counter2()->time().InMilliseconds(), 300 + kEpsilonMs); |
| 506 EXPECT_IN_RANGE(100, counter3()->time().InMilliseconds(), 100 + kEpsilonMs); | 504 EXPECT_IN_RANGE(100, counter3()->time().InMilliseconds(), 100 + kEpsilonMs); |
| 507 } | 505 } |
| 508 | 506 |
| 509 } // namespace internal | 507 } // namespace internal |
| 510 } // namespace v8 | 508 } // namespace v8 |
| OLD | NEW |