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

Unified Diff: base/trace_event/trace_event_unittest.cc

Issue 1678503002: Tracing: Removed monitoring mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « base/trace_event/trace_buffer.cc ('k') | base/trace_event/trace_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_unittest.cc
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc
index d407b04e856c77e3846eae74c8f3e5359f5c5d0f..a39c190d4bdf49b0f38ef810bef18b339604412f 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -134,19 +134,6 @@ class TraceEventTestFixture : public testing::Test {
base::Unretained(flush_complete_event)));
}
- void FlushMonitoring() {
- WaitableEvent flush_complete_event(false, false);
- FlushMonitoring(&flush_complete_event);
- flush_complete_event.Wait();
- }
-
- void FlushMonitoring(WaitableEvent* flush_complete_event) {
- TraceLog::GetInstance()->FlushButLeaveBufferIntact(
- base::Bind(&TraceEventTestFixture::OnTraceDataCollected,
- base::Unretained(static_cast<TraceEventTestFixture*>(this)),
- base::Unretained(flush_complete_event)));
- }
-
void SetUp() override {
const char* name = PlatformThread::GetName();
old_thread_name_ = name ? strdup(name) : NULL;
@@ -1275,25 +1262,6 @@ TEST_F(TraceEventTestFixture, AddMetadataEvent) {
BeginTrace();
EndTraceAndFlush();
ASSERT_EQ(1, num_calls);
-
- // Flushing should cause |AppendAsTraceFormat| to be called, but if the buffer
- // is left intact, it the flush at the end of the trace should still call it;
- // the metadata event should not be removed.
- TraceLog::GetInstance()->SetEnabled(
- TraceConfig(kRecordAllCategoryFilter,
- "record-until-full,enable-sampling"),
- TraceLog::MONITORING_MODE);
- TRACE_EVENT_API_ADD_METADATA_EVENT("metadata_event_name", "metadata_arg_name",
- convertable);
- FlushMonitoring();
- ASSERT_EQ(2, num_calls);
-
- // Flushing the trace at this point will case |AppendAsTraceFormat| to be
- // called twice: once for the event that was added by the monitoring flush,
- // and once for the end trace flush; the metadata event will be duplicated.
- // This is consistent with the other metadata events.
- EndTraceAndFlush();
- ASSERT_EQ(4, num_calls);
}
// Test that categories work.
@@ -2059,52 +2027,6 @@ TEST_F(TraceEventTestFixture, TraceSamplingScope) {
EndTraceAndFlush();
}
-TEST_F(TraceEventTestFixture, TraceContinuousSampling) {
- TraceLog::GetInstance()->SetEnabled(
- TraceConfig(kRecordAllCategoryFilter, "record-until-full,enable-sampling"),
- TraceLog::MONITORING_MODE);
-
- TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "AAA");
- TraceLog::GetInstance()->WaitSamplingEventForTesting();
- TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "BBB");
- TraceLog::GetInstance()->WaitSamplingEventForTesting();
-
- FlushMonitoring();
-
- // Make sure we can get the profiled data.
- EXPECT_TRUE(FindNamePhase("AAA", "P"));
- EXPECT_TRUE(FindNamePhase("BBB", "P"));
-
- Clear();
- TraceLog::GetInstance()->WaitSamplingEventForTesting();
-
- TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "CCC");
- TraceLog::GetInstance()->WaitSamplingEventForTesting();
- TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(1, "category", "DDD");
- TraceLog::GetInstance()->WaitSamplingEventForTesting();
-
- FlushMonitoring();
-
- // Make sure the profiled data is accumulated.
- EXPECT_TRUE(FindNamePhase("AAA", "P"));
- EXPECT_TRUE(FindNamePhase("BBB", "P"));
- EXPECT_TRUE(FindNamePhase("CCC", "P"));
- EXPECT_TRUE(FindNamePhase("DDD", "P"));
-
- Clear();
-
- TraceLog::GetInstance()->SetDisabled();
-
- // Make sure disabling the continuous sampling thread clears
- // the profiled data.
- EXPECT_FALSE(FindNamePhase("AAA", "P"));
- EXPECT_FALSE(FindNamePhase("BBB", "P"));
- EXPECT_FALSE(FindNamePhase("CCC", "P"));
- EXPECT_FALSE(FindNamePhase("DDD", "P"));
-
- Clear();
-}
-
class MyData : public ConvertableToTraceFormat {
public:
MyData() {}
« no previous file with comments | « base/trace_event/trace_buffer.cc ('k') | base/trace_event/trace_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698