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

Unified Diff: components/metrics/call_stack_profile_metrics_provider_unittest.cc

Issue 2444143002: Add process lifetime annotations to stack samples. (Closed)
Patch Set: Created 4 years, 2 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
Index: components/metrics/call_stack_profile_metrics_provider_unittest.cc
diff --git a/components/metrics/call_stack_profile_metrics_provider_unittest.cc b/components/metrics/call_stack_profile_metrics_provider_unittest.cc
index e5dfb9ad9f6017c2dda8b0930815db6afe92c9f7..eee72372563a8055f4efb9a94d8fe198814cb3bf 100644
--- a/components/metrics/call_stack_profile_metrics_provider_unittest.cc
+++ b/components/metrics/call_stack_profile_metrics_provider_unittest.cc
@@ -191,9 +191,9 @@ TEST_F(CallStackProfileMetricsProviderTest, MultipleProfiles) {
for (size_t j = 0; j < arraysize(profile_sample_frames[i]); ++j) {
profile.samples.push_back(Sample());
Sample& sample = profile.samples.back();
- sample.insert(sample.end(), &profile_sample_frames[i][j][0],
- &profile_sample_frames[i][j][0] +
- arraysize(profile_sample_frames[i][j]));
+ sample.frames.insert(sample.frames.end(), &profile_sample_frames[i][j][0],
+ &profile_sample_frames[i][j][0] +
+ arraysize(profile_sample_frames[i][j]));
}
profile.profile_duration = profile_durations[i];
@@ -310,8 +310,8 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksUnordered) {
for (size_t i = 0; i < arraysize(sample_frames); ++i) {
profile.samples.push_back(Sample());
Sample& sample = profile.samples.back();
- sample.insert(sample.end(), &sample_frames[i][0],
- &sample_frames[i][0] + arraysize(sample_frames[i]));
+ sample.frames.insert(sample.frames.end(), &sample_frames[i][0],
+ &sample_frames[i][0] + arraysize(sample_frames[i]));
}
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
@@ -393,8 +393,8 @@ TEST_F(CallStackProfileMetricsProviderTest, RepeatedStacksOrdered) {
for (size_t i = 0; i < arraysize(sample_frames); ++i) {
profile.samples.push_back(Sample());
Sample& sample = profile.samples.back();
- sample.insert(sample.end(), &sample_frames[i][0],
- &sample_frames[i][0] + arraysize(sample_frames[i]));
+ sample.frames.insert(sample.frames.end(), &sample_frames[i][0],
+ &sample_frames[i][0] + arraysize(sample_frames[i]));
}
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
@@ -448,8 +448,9 @@ TEST_F(CallStackProfileMetricsProviderTest, UnknownModule) {
const Frame frame(0x1000, Frame::kUnknownModuleIndex);
Profile profile;
-
- profile.samples.push_back(Sample(1, frame));
+ Sample sample;
+ sample.frames.push_back(frame);
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -488,8 +489,9 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesProvidedOnlyOnce) {
CallStackProfileMetricsProvider provider;
for (int i = 0; i < 2; ++i) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample sample;
+ sample.frames.push_back(Frame(0x1000, Frame::kUnknownModuleIndex));
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
// Use the sampling period to distinguish the two profiles.
@@ -520,8 +522,9 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesProvidedOnlyOnce) {
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesProvidedWhenCollectedBeforeInstantiation) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample sample;
+ sample.frames.push_back(Frame(0x1000, Frame::kUnknownModuleIndex));
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -545,8 +548,9 @@ TEST_F(CallStackProfileMetricsProviderTest,
// while recording is disabled.
TEST_F(CallStackProfileMetricsProviderTest, ProfilesNotProvidedWhileDisabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample sample;
+ sample.frames.push_back(Frame(0x1000, Frame::kUnknownModuleIndex));
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -570,8 +574,9 @@ TEST_F(CallStackProfileMetricsProviderTest, ProfilesNotProvidedWhileDisabled) {
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesNotProvidedAfterChangeToDisabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample sample;
+ sample.frames.push_back(Frame(0x1000, Frame::kUnknownModuleIndex));
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -598,8 +603,9 @@ TEST_F(CallStackProfileMetricsProviderTest,
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesNotProvidedAfterChangeToDisabledThenEnabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample sample;
+ sample.frames.push_back(Frame(0x1000, Frame::kUnknownModuleIndex));
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);
@@ -627,8 +633,9 @@ TEST_F(CallStackProfileMetricsProviderTest,
TEST_F(CallStackProfileMetricsProviderTest,
ProfilesNotProvidedAfterChangeFromDisabled) {
Profile profile;
- profile.samples.push_back(
- Sample(1, Frame(0x1000, Frame::kUnknownModuleIndex)));
+ Sample sample;
+ sample.frames.push_back(Frame(0x1000, Frame::kUnknownModuleIndex));
+ profile.samples.push_back(std::move(sample));
profile.profile_duration = base::TimeDelta::FromMilliseconds(100);
profile.sampling_period = base::TimeDelta::FromMilliseconds(10);

Powered by Google App Engine
This is Rietveld 408576698