Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: test/cctest/test-profile-generator.cc

Issue 21105003: Simplify sampling rate calculation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/profile-generator.cc ('K') | « test/cctest/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-profile-generator.cc
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
index 7b8278ba660d4d490a026af108308b1c756e3043..f56275c1beef1e0b6ec8efcc5d9d5207bf7d0296 100644
--- a/test/cctest/test-profile-generator.cc
+++ b/test/cctest/test-profile-generator.cc
@@ -41,7 +41,6 @@ using i::CpuProfilesCollection;
using i::ProfileNode;
using i::ProfileTree;
using i::ProfileGenerator;
-using i::SampleRateCalculator;
using i::TickSample;
using i::Vector;
@@ -485,7 +484,7 @@ TEST(RecordTickSample) {
sample3.frames_count = 2;
generator.RecordTickSample(sample3);
- CpuProfile* profile = profiles.StopProfiling("", 1);
+ CpuProfile* profile = profiles.StopProfiling("");
CHECK_NE(NULL, profile);
ProfileTreeTestHelper top_down_test_helper(profile->top_down());
CHECK_EQ(NULL, top_down_test_helper.Walk(entry2));
@@ -505,56 +504,6 @@ TEST(RecordTickSample) {
}
-TEST(SampleRateCalculator) {
- const double kSamplingIntervalMs = i::Logger::kSamplingIntervalMs;
-
- // Verify that ticking exactly in query intervals results in the
- // initial sampling interval.
- double time = 0.0;
- SampleRateCalculator calc1;
- CHECK_EQ(kSamplingIntervalMs, calc1.ticks_per_ms());
- calc1.UpdateMeasurements(time);
- CHECK_EQ(kSamplingIntervalMs, calc1.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs;
- calc1.UpdateMeasurements(time);
- CHECK_EQ(kSamplingIntervalMs, calc1.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs;
- calc1.UpdateMeasurements(time);
- CHECK_EQ(kSamplingIntervalMs, calc1.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs;
- calc1.UpdateMeasurements(time);
- CHECK_EQ(kSamplingIntervalMs, calc1.ticks_per_ms());
-
- SampleRateCalculator calc2;
- time = 0.0;
- CHECK_EQ(kSamplingIntervalMs, calc2.ticks_per_ms());
- calc2.UpdateMeasurements(time);
- CHECK_EQ(kSamplingIntervalMs, calc2.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs * 0.5;
- calc2.UpdateMeasurements(time);
- // (1.0 + 2.0) / 2
- CHECK_EQ(kSamplingIntervalMs * 1.5, calc2.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs * 0.75;
- calc2.UpdateMeasurements(time);
- // (1.0 + 2.0 + 2.0) / 3
- CHECK_EQ(kSamplingIntervalMs * 5.0, floor(calc2.ticks_per_ms() * 3.0 + 0.5));
-
- SampleRateCalculator calc3;
- time = 0.0;
- CHECK_EQ(kSamplingIntervalMs, calc3.ticks_per_ms());
- calc3.UpdateMeasurements(time);
- CHECK_EQ(kSamplingIntervalMs, calc3.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs * 2;
- calc3.UpdateMeasurements(time);
- // (1.0 + 0.5) / 2
- CHECK_EQ(kSamplingIntervalMs * 0.75, calc3.ticks_per_ms());
- time += SampleRateCalculator::kWallTimeQueryIntervalMs * 1.5;
- calc3.UpdateMeasurements(time);
- // (1.0 + 0.5 + 0.5) / 3
- CHECK_EQ(kSamplingIntervalMs * 2.0, floor(calc3.ticks_per_ms() * 3.0 + 0.5));
-}
-
-
static void CheckNodeIds(ProfileNode* node, int* expectedId) {
CHECK_EQ((*expectedId)++, node->id());
for (int i = 0; i < node->children()->length(); i++) {
@@ -598,7 +547,7 @@ TEST(SampleIds) {
sample3.frames_count = 2;
generator.RecordTickSample(sample3);
- CpuProfile* profile = profiles.StopProfiling("", 1);
+ CpuProfile* profile = profiles.StopProfiling("");
int nodeId = 1;
CheckNodeIds(profile->top_down()->root(), &nodeId);
CHECK_EQ(7, nodeId - 1);
@@ -627,7 +576,7 @@ TEST(NoSamples) {
sample1.frames_count = 1;
generator.RecordTickSample(sample1);
- CpuProfile* profile = profiles.StopProfiling("", 1);
+ CpuProfile* profile = profiles.StopProfiling("");
int nodeId = 1;
CheckNodeIds(profile->top_down()->root(), &nodeId);
CHECK_EQ(3, nodeId - 1);
« src/profile-generator.cc ('K') | « test/cctest/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698