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

Unified Diff: runtime/vm/profiler_test.cc

Issue 174213002: Rework Sample class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
« runtime/vm/profiler.h ('K') | « runtime/vm/profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_test.cc
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index ffa9ab322306c67718322481349c8802a71c9c6d..63b77d4b97f7107d66fca9789f8dbf2d707022c2 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -17,15 +17,13 @@ class ProfileSampleBufferTestHelper {
static intptr_t IterateCount(const Isolate* isolate,
const SampleBuffer& sample_buffer) {
intptr_t c = 0;
- Sample* sample = Sample::Allocate();
for (intptr_t i = 0; i < sample_buffer.capacity(); i++) {
- sample_buffer.CopySample(i, sample);
+ Sample* sample = sample_buffer.At(i);
if (sample->isolate() != isolate) {
continue;
}
c++;
}
- free(sample);
return c;
}
@@ -33,15 +31,13 @@ class ProfileSampleBufferTestHelper {
static intptr_t IterateSumPC(const Isolate* isolate,
const SampleBuffer& sample_buffer) {
intptr_t c = 0;
- Sample* sample = Sample::Allocate();
for (intptr_t i = 0; i < sample_buffer.capacity(); i++) {
- sample_buffer.CopySample(i, sample);
+ Sample* sample = sample_buffer.At(i);
if (sample->isolate() != isolate) {
continue;
}
c += sample->At(0);
}
- free(sample);
return c;
}
};
@@ -53,19 +49,19 @@ TEST_CASE(ProfilerSampleBufferWrapTest) {
EXPECT_EQ(0, ProfileSampleBufferTestHelper::IterateSumPC(i, *sample_buffer));
Sample* s;
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
s->SetAt(0, 2);
EXPECT_EQ(2, ProfileSampleBufferTestHelper::IterateSumPC(i, *sample_buffer));
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
s->SetAt(0, 4);
EXPECT_EQ(6, ProfileSampleBufferTestHelper::IterateSumPC(i, *sample_buffer));
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
s->SetAt(0, 6);
EXPECT_EQ(12, ProfileSampleBufferTestHelper::IterateSumPC(i, *sample_buffer));
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
s->SetAt(0, 8);
EXPECT_EQ(18, ProfileSampleBufferTestHelper::IterateSumPC(i, *sample_buffer));
delete sample_buffer;
@@ -78,16 +74,16 @@ TEST_CASE(ProfilerSampleBufferIterateTest) {
EXPECT_EQ(0, ProfileSampleBufferTestHelper::IterateCount(i, *sample_buffer));
Sample* s;
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
EXPECT_EQ(1, ProfileSampleBufferTestHelper::IterateCount(i, *sample_buffer));
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
EXPECT_EQ(2, ProfileSampleBufferTestHelper::IterateCount(i, *sample_buffer));
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
EXPECT_EQ(3, ProfileSampleBufferTestHelper::IterateCount(i, *sample_buffer));
s = sample_buffer->ReserveSample();
- s->Init(Sample::kIsolateSample, i, 0, 0);
+ s->Init(i, 0, 0);
EXPECT_EQ(3, ProfileSampleBufferTestHelper::IterateCount(i, *sample_buffer));
delete sample_buffer;
}
« runtime/vm/profiler.h ('K') | « runtime/vm/profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698