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

Unified Diff: base/test/trace_event_analyzer_unittest.cc

Issue 12252058: Add a |scope| argument to TRACE_EVENT_INSTANT* and require its presence. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix builds 2 Created 7 years, 9 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/debug/trace_event_unittest.cc ('k') | cc/animation/animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/trace_event_analyzer_unittest.cc
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc
index 60043416456aa3eac205338c6749527dc2ccb430..33cacbff74e3c0ea13c07d42880b2d250b6ec8f6 100644
--- a/base/test/trace_event_analyzer_unittest.cc
+++ b/base/test/trace_event_analyzer_unittest.cc
@@ -208,10 +208,10 @@ TEST_F(TraceEventAnalyzerTest, BooleanOperators) {
BeginTracing();
{
- TRACE_EVENT_INSTANT1("cat1", "name1", "num", 1);
- TRACE_EVENT_INSTANT1("cat1", "name2", "num", 2);
- TRACE_EVENT_INSTANT1("cat2", "name3", "num", 3);
- TRACE_EVENT_INSTANT1("cat2", "name4", "num", 4);
+ TRACE_EVENT_INSTANT1("cat1", "name1", TRACE_EVENT_SCOPE_THREAD, "num", 1);
+ TRACE_EVENT_INSTANT1("cat1", "name2", TRACE_EVENT_SCOPE_THREAD, "num", 2);
+ TRACE_EVENT_INSTANT1("cat2", "name3", TRACE_EVENT_SCOPE_THREAD, "num", 3);
+ TRACE_EVENT_INSTANT1("cat2", "name4", TRACE_EVENT_SCOPE_THREAD, "num", 4);
}
EndTracing();
@@ -293,11 +293,15 @@ TEST_F(TraceEventAnalyzerTest, ArithmeticOperators) {
BeginTracing();
{
// These events are searched for:
- TRACE_EVENT_INSTANT2("cat1", "math1", "a", 10, "b", 5);
- TRACE_EVENT_INSTANT2("cat1", "math2", "a", 10, "b", 10);
+ TRACE_EVENT_INSTANT2("cat1", "math1", TRACE_EVENT_SCOPE_THREAD,
+ "a", 10, "b", 5);
+ TRACE_EVENT_INSTANT2("cat1", "math2", TRACE_EVENT_SCOPE_THREAD,
+ "a", 10, "b", 10);
// Extra events that never match, for noise:
- TRACE_EVENT_INSTANT2("noise", "math3", "a", 1, "b", 3);
- TRACE_EVENT_INSTANT2("noise", "math4", "c", 10, "d", 5);
+ TRACE_EVENT_INSTANT2("noise", "math3", TRACE_EVENT_SCOPE_THREAD,
+ "a", 1, "b", 3);
+ TRACE_EVENT_INSTANT2("noise", "math4", TRACE_EVENT_SCOPE_THREAD,
+ "c", 10, "d", 5);
}
EndTracing();
@@ -349,10 +353,10 @@ TEST_F(TraceEventAnalyzerTest, StringPattern) {
BeginTracing();
{
- TRACE_EVENT_INSTANT0("cat1", "name1");
- TRACE_EVENT_INSTANT0("cat1", "name2");
- TRACE_EVENT_INSTANT0("cat1", "no match");
- TRACE_EVENT_INSTANT0("cat1", "name3x");
+ TRACE_EVENT_INSTANT0("cat1", "name1", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "name2", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "no match", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "name3x", TRACE_EVENT_SCOPE_THREAD);
}
EndTracing();
@@ -393,7 +397,8 @@ TEST_F(TraceEventAnalyzerTest, Duration) {
TRACE_EVENT0("noise", "name2"); // not searched for, just noise
{
TRACE_EVENT0("cat2", "name3"); // found by duration query
- TRACE_EVENT_INSTANT0("noise", "name4"); // not searched for, just noise
+ // next event not searched for, just noise
+ TRACE_EVENT_INSTANT0("noise", "name4", TRACE_EVENT_SCOPE_THREAD);
base::debug::HighResSleepForTraceTest(kSleepTime);
TRACE_EVENT0("cat2", "name5"); // not found (duration too short)
}
@@ -426,7 +431,7 @@ TEST_F(TraceEventAnalyzerTest, BeginEndAssocations) {
{
TRACE_EVENT_END0("cat1", "name1"); // does not match out of order begin
TRACE_EVENT0("cat1", "name2");
- TRACE_EVENT_INSTANT0("cat1", "name3");
+ TRACE_EVENT_INSTANT0("cat1", "name3", TRACE_EVENT_SCOPE_THREAD);
TRACE_EVENT_BEGIN0("cat1", "name1");
}
EndTracing();
@@ -479,7 +484,7 @@ TEST_F(TraceEventAnalyzerTest, AsyncBeginEndAssocations) {
TRACE_EVENT_ASYNC_END0("cat1", "name1", 0xA); // no match / out of order
TRACE_EVENT_ASYNC_BEGIN0("cat1", "name1", 0xB);
TRACE_EVENT_ASYNC_BEGIN0("cat1", "name1", 0xC);
- TRACE_EVENT_INSTANT0("cat1", "name1"); // noise
+ TRACE_EVENT_INSTANT0("cat1", "name1", TRACE_EVENT_SCOPE_THREAD); // noise
TRACE_EVENT0("cat1", "name1"); // noise
TRACE_EVENT_ASYNC_END0("cat1", "name1", 0xB);
TRACE_EVENT_ASYNC_END0("cat1", "name1", 0xC);
@@ -559,12 +564,16 @@ TEST_F(TraceEventAnalyzerTest, CustomAssociations) {
// to match up the begin/end pairs.
BeginTracing();
{
- TRACE_EVENT_INSTANT1("cat1", "end", "id", 1); // no begin match
- TRACE_EVENT_INSTANT1("cat2", "begin", "id", 2); // end is cat4
- TRACE_EVENT_INSTANT1("cat3", "begin", "id", 3); // end is cat5
- TRACE_EVENT_INSTANT1("cat4", "end", "id", 2);
- TRACE_EVENT_INSTANT1("cat5", "end", "id", 3);
- TRACE_EVENT_INSTANT1("cat6", "begin", "id", 1); // no end match
+ // no begin match
+ TRACE_EVENT_INSTANT1("cat1", "end", TRACE_EVENT_SCOPE_THREAD, "id", 1);
+ // end is cat4
+ TRACE_EVENT_INSTANT1("cat2", "begin", TRACE_EVENT_SCOPE_THREAD, "id", 2);
+ // end is cat5
+ TRACE_EVENT_INSTANT1("cat3", "begin", TRACE_EVENT_SCOPE_THREAD, "id", 3);
+ TRACE_EVENT_INSTANT1("cat4", "end", TRACE_EVENT_SCOPE_THREAD, "id", 2);
+ TRACE_EVENT_INSTANT1("cat5", "end", TRACE_EVENT_SCOPE_THREAD, "id", 3);
+ // no end match
+ TRACE_EVENT_INSTANT1("cat6", "begin", TRACE_EVENT_SCOPE_THREAD, "id", 1);
}
EndTracing();
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | cc/animation/animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698