From 3f095c0a8f6a5ee43e205be6add05276c42bd240 Mon Sep 17 00:00:00 2001 From: "joth@chromium.org" Date: Mon, 31 Oct 2011 15:32:08 +0000 Subject: Revert 107895 - Fully enable about:tracking by default This is a re-land of: http://codereview.chromium.org/8391019/ Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=107793 Original landing had trouble with message_loop_x.h, due to header include ordering. I pulled out the structure that was really needed by tracked_objects.h into a new file tracked_info.*. This allows tracked_objects to inlude this tracked_info, but not have to include the message_loop.h totality. I also removed a DCHECK that that was triggering on a test, and added yet one more file (browser_main.cc) where I removed a #ifdef for TRACKING_ALL_OBJECTS. The changes were minor, and I'm hoping to get clear perf runs with tihs landing, so I'm going to TBR it and reland early in the morning. Comments from original landing: Support is now controlled by the flag: --enable-tracking and the default is always on. To turn it off, use: --enable-tracking=0 All profiler code is compiled now in release and official builds (in addition to debug, where it was already active), but most entry points can be disabled (turned into no-ops) by a single const bool setting atop tracked_objects.cc (in case folks want to revert the perf-impact of this change). Transition to faster Now() service on Windows for the profiler use only. The TimeTicks::Now() function on Window uses locking to get a 64 bit time value. This CL transitions times used for profiling to more directly use a 32 bit Time interface, which is actually what drives the 64 bit TimeTicks. By using the smaller value, we avoid the need for locks, or even atomic operations for the most part in the tracking system. On linux, we just down-sample the standard TimeTicks to 32 bits for consistency (clean ability to snapshot asyncronously without atomics... but I should verify that such is helpful to performance). I've also put in yet more cleanup and refactoring. tbr=rtenneti bug=101856 Review URL: http://codereview.chromium.org/8414036 TBR=jar@chromium.org Review URL: http://codereview.chromium.org/8430004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107961 0039d316-1c4b-4281-b951-d872f2087c98 --- base/tracked_objects_unittest.cc | 401 ++++++++++----------------------------- 1 file changed, 104 insertions(+), 297 deletions(-) (limited to 'base/tracked_objects_unittest.cc') diff --git a/base/tracked_objects_unittest.cc b/base/tracked_objects_unittest.cc index b457cb1..ef88183 100644 --- a/base/tracked_objects_unittest.cc +++ b/base/tracked_objects_unittest.cc @@ -15,18 +15,15 @@ namespace tracked_objects { class TrackedObjectsTest : public testing::Test { public: - TrackedObjectsTest() { - ThreadData::ShutdownSingleThreadedCleanup(); - } + ~TrackedObjectsTest() { + ThreadData::ShutdownSingleThreadedCleanup(); + } - ~TrackedObjectsTest() { - ThreadData::ShutdownSingleThreadedCleanup(); - } }; TEST_F(TrackedObjectsTest, MinimalStartupShutdown) { // Minimal test doesn't even create any tasks. - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; EXPECT_FALSE(ThreadData::first()); // No activity even on this thread. @@ -44,7 +41,7 @@ TEST_F(TrackedObjectsTest, MinimalStartupShutdown) { ThreadData::ShutdownSingleThreadedCleanup(); // Do it again, just to be sure we reset state completely. - ThreadData::InitializeAndSetTrackingStatus(true); + ThreadData::StartTracking(true); EXPECT_FALSE(ThreadData::first()); // No activity even on this thread. data = ThreadData::Get(); EXPECT_TRUE(ThreadData::first()); // Now class was constructed. @@ -60,7 +57,7 @@ TEST_F(TrackedObjectsTest, MinimalStartupShutdown) { } TEST_F(TrackedObjectsTest, TinyStartupShutdown) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; // Instigate tracking on a single tracked object, on our thread. @@ -80,14 +77,14 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) { EXPECT_EQ(0u, death_map.size()); // No deaths. - // Now instigate another birth, and a first death at the same location. - // TrackingInfo will call TallyABirth() during construction. - base::TimeTicks kBogusStartTime; - base::TrackingInfo pending_task(location, kBogusStartTime); - TrackedTime kBogusStartRunTime; - TrackedTime kBogusEndRunTime; - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, kBogusStartRunTime, - kBogusEndRunTime); + // Now instigate a birth, and a death. + const Births* second_birth = ThreadData::TallyABirthIfActive(location); + ThreadData::TallyADeathIfActive( + second_birth, + base::TimeTicks(), /* Bogus post_time. */ + base::TimeTicks(), /* Bogus delayed_start_time. */ + base::TimeTicks(), /* Bogus start_run_time. */ + base::TimeTicks() /* Bogus end_run_time */ ); birth_map.clear(); data->SnapshotBirthMap(&birth_map); @@ -103,13 +100,13 @@ TEST_F(TrackedObjectsTest, TinyStartupShutdown) { } TEST_F(TrackedObjectsTest, DeathDataTest) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; scoped_ptr data(new DeathData()); ASSERT_NE(data, reinterpret_cast(NULL)); - EXPECT_EQ(data->run_duration(), Duration()); - EXPECT_EQ(data->queue_duration(), Duration()); + EXPECT_EQ(data->run_duration(), base::TimeDelta()); + EXPECT_EQ(data->queue_duration(), base::TimeDelta()); EXPECT_EQ(data->AverageMsRunDuration(), 0); EXPECT_EQ(data->AverageMsQueueDuration(), 0); EXPECT_EQ(data->count(), 0); @@ -117,8 +114,8 @@ TEST_F(TrackedObjectsTest, DeathDataTest) { int run_ms = 42; int queue_ms = 8; - Duration run_duration = Duration().FromMilliseconds(run_ms); - Duration queue_duration = Duration().FromMilliseconds(queue_ms); + base::TimeDelta run_duration = base::TimeDelta().FromMilliseconds(run_ms); + base::TimeDelta queue_duration = base::TimeDelta().FromMilliseconds(queue_ms); data->RecordDeath(queue_duration, run_duration); EXPECT_EQ(data->run_duration(), run_duration); EXPECT_EQ(data->queue_duration(), queue_duration); @@ -154,69 +151,20 @@ TEST_F(TrackedObjectsTest, DeathDataTest) { EXPECT_EQ(json, birth_only_result); } -TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToValueWorkerThread) { - // Transition to Deactivated state before doing anything. - if (!ThreadData::InitializeAndSetTrackingStatus(false)) - return; - // We don't initialize system with a thread name, so we're viewed as a worker - // thread. - const int kFakeLineNumber = 173; - const char* kFile = "FixedFileName"; - const char* kFunction = "BirthOnlyToValueWorkerThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); - Births* birth = ThreadData::TallyABirthIfActive(location); - // We should now see a NULL birth record. - EXPECT_EQ(birth, reinterpret_cast(NULL)); - - scoped_ptr value(ThreadData::ToValue()); - std::string json; - base::JSONWriter::Write(value.get(), false, &json); - std::string birth_only_result = "{" - "\"list\":[" - "]" - "}"; - EXPECT_EQ(json, birth_only_result); -} - -TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToValueMainThread) { - // Start in the deactivated state. - if (!ThreadData::InitializeAndSetTrackingStatus(false)) - return; - - // Use a well named thread. - ThreadData::InitializeThreadContext("SomeMainThreadName"); - const int kFakeLineNumber = 173; - const char* kFile = "FixedFileName"; - const char* kFunction = "BirthOnlyToValueMainThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); - // Do not delete birth. We don't own it. - Births* birth = ThreadData::TallyABirthIfActive(location); - // We expect to not get a birth record. - EXPECT_EQ(birth, reinterpret_cast(NULL)); - - scoped_ptr value(ThreadData::ToValue()); - std::string json; - base::JSONWriter::Write(value.get(), false, &json); - std::string birth_only_result = "{" - "\"list\":[" - "]" - "}"; - EXPECT_EQ(json, birth_only_result); -} - TEST_F(TrackedObjectsTest, BirthOnlyToValueWorkerThread) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; // We don't initialize system with a thread name, so we're viewed as a worker // thread. - const int kFakeLineNumber = 173; + int fake_line_number = 173; const char* kFile = "FixedFileName"; const char* kFunction = "BirthOnlyToValueWorkerThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); + Location location(kFunction, kFile, fake_line_number, NULL); Births* birth = ThreadData::TallyABirthIfActive(location); EXPECT_NE(birth, reinterpret_cast(NULL)); - scoped_ptr value(ThreadData::ToValue()); + int process_type = 3; + scoped_ptr value(ThreadData::ToValue(process_type)); std::string json; base::JSONWriter::Write(value.get(), false, &json); std::string birth_only_result = "{" @@ -235,26 +183,28 @@ TEST_F(TrackedObjectsTest, BirthOnlyToValueWorkerThread) { "\"line_number\":173" "}" "}" - "]" + "]," + "\"process\":3" "}"; EXPECT_EQ(json, birth_only_result); } TEST_F(TrackedObjectsTest, BirthOnlyToValueMainThread) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; // Use a well named thread. ThreadData::InitializeThreadContext("SomeMainThreadName"); - const int kFakeLineNumber = 173; + int fake_line_number = 173; const char* kFile = "FixedFileName"; const char* kFunction = "BirthOnlyToValueMainThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); + Location location(kFunction, kFile, fake_line_number, NULL); // Do not delete birth. We don't own it. Births* birth = ThreadData::TallyABirthIfActive(location); EXPECT_NE(birth, reinterpret_cast(NULL)); - scoped_ptr value(ThreadData::ToValue()); + int process_type = 34; + scoped_ptr value(ThreadData::ToValue(process_type)); std::string json; base::JSONWriter::Write(value.get(), false, &json); std::string birth_only_result = "{" @@ -273,39 +223,40 @@ TEST_F(TrackedObjectsTest, BirthOnlyToValueMainThread) { "\"line_number\":173" "}" "}" - "]" + "]," + "\"process\":34" "}"; EXPECT_EQ(json, birth_only_result); } TEST_F(TrackedObjectsTest, LifeCycleToValueMainThread) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; // Use a well named thread. ThreadData::InitializeThreadContext("SomeMainThreadName"); - const int kFakeLineNumber = 236; + int fake_line_number = 236; const char* kFile = "FixedFileName"; const char* kFunction = "LifeCycleToValueMainThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); + Location location(kFunction, kFile, fake_line_number, NULL); // Do not delete birth. We don't own it. Births* birth = ThreadData::TallyABirthIfActive(location); EXPECT_NE(birth, reinterpret_cast(NULL)); - const base::TimeTicks kTimePosted = base::TimeTicks() - + base::TimeDelta::FromMilliseconds(1); - const base::TimeTicks kDelayedStartTime = base::TimeTicks(); - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task(location, kDelayedStartTime); - pending_task.time_posted = kTimePosted; // Overwrite implied Now(). - - const TrackedTime kStartOfRun = TrackedTime() + - Duration::FromMilliseconds(5); - const TrackedTime kEndOfRun = TrackedTime() + Duration::FromMilliseconds(7); - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, - kStartOfRun, kEndOfRun); - - scoped_ptr value(ThreadData::ToValue()); + // TimeTicks initializers ar ein microseconds. Durations are calculated in + // milliseconds, so we need to use 1000x. + const base::TimeTicks time_posted = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(1); + const base::TimeTicks delayed_start_time = base::TimeTicks(); + const base::TimeTicks start_of_run = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(5); + const base::TimeTicks end_of_run = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(7); + ThreadData::TallyADeathIfActive(birth, time_posted, delayed_start_time, + start_of_run, end_of_run); + + int process_type = 7; + scoped_ptr value(ThreadData::ToValue(process_type)); std::string json; base::JSONWriter::Write(value.get(), false, &json); std::string one_line_result = "{" @@ -324,190 +275,44 @@ TEST_F(TrackedObjectsTest, LifeCycleToValueMainThread) { "\"line_number\":236" "}" "}" - "]" + "]," + "\"process\":7" "}"; - EXPECT_EQ(one_line_result, json); -} - -// We will deactivate tracking after the birth, and before the death, and -// demonstrate that the lifecycle is completely tallied. This ensures that -// our tallied births are matched by tallied deaths (except for when the -// task is still running, or is queued). -TEST_F(TrackedObjectsTest, LifeCycleMidDeactivatedToValueMainThread) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) - return; - - // Use a well named thread. - ThreadData::InitializeThreadContext("SomeMainThreadName"); - const int kFakeLineNumber = 236; - const char* kFile = "FixedFileName"; - const char* kFunction = "LifeCycleToValueMainThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); - // Do not delete birth. We don't own it. - Births* birth = ThreadData::TallyABirthIfActive(location); - EXPECT_NE(birth, reinterpret_cast(NULL)); - - const base::TimeTicks kTimePosted = base::TimeTicks() - + base::TimeDelta::FromMilliseconds(1); - const base::TimeTicks kDelayedStartTime = base::TimeTicks(); - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task(location, kDelayedStartTime); - pending_task.time_posted = kTimePosted; // Overwrite implied Now(). - - // Turn off tracking now that we have births. - EXPECT_TRUE(ThreadData::InitializeAndSetTrackingStatus(false)); - - const TrackedTime kStartOfRun = TrackedTime() + - Duration::FromMilliseconds(5); - const TrackedTime kEndOfRun = TrackedTime() + Duration::FromMilliseconds(7); - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, - kStartOfRun, kEndOfRun); - - scoped_ptr value(ThreadData::ToValue()); - std::string json; - base::JSONWriter::Write(value.get(), false, &json); - std::string one_line_result = "{" - "\"list\":[" - "{" - "\"birth_thread\":\"SomeMainThreadName\"," - "\"death_data\":{" - "\"count\":1," - "\"queue_ms\":4," - "\"run_ms\":2" - "}," - "\"death_thread\":\"SomeMainThreadName\"," - "\"location\":{" - "\"file_name\":\"FixedFileName\"," - "\"function_name\":\"LifeCycleToValueMainThread\"," - "\"line_number\":236" - "}" - "}" - "]" - "}"; - EXPECT_EQ(one_line_result, json); -} - -// We will deactivate tracking before starting a life cycle, and neither -// the birth nor the death will be recorded. -TEST_F(TrackedObjectsTest, LifeCyclePreDeactivatedToValueMainThread) { - if (!ThreadData::InitializeAndSetTrackingStatus(false)) - return; - - // Use a well named thread. - ThreadData::InitializeThreadContext("SomeMainThreadName"); - const int kFakeLineNumber = 236; - const char* kFile = "FixedFileName"; - const char* kFunction = "LifeCycleToValueMainThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); - // Do not delete birth. We don't own it. - Births* birth = ThreadData::TallyABirthIfActive(location); - EXPECT_EQ(birth, reinterpret_cast(NULL)); - - const base::TimeTicks kTimePosted = base::TimeTicks() - + base::TimeDelta::FromMilliseconds(1); - const base::TimeTicks kDelayedStartTime = base::TimeTicks(); - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task(location, kDelayedStartTime); - pending_task.time_posted = kTimePosted; // Overwrite implied Now(). - - const TrackedTime kStartOfRun = TrackedTime() + - Duration::FromMilliseconds(5); - const TrackedTime kEndOfRun = TrackedTime() + Duration::FromMilliseconds(7); - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, - kStartOfRun, kEndOfRun); - - scoped_ptr value(ThreadData::ToValue()); - std::string json; - base::JSONWriter::Write(value.get(), false, &json); - std::string one_line_result = "{" - "\"list\":[" - "]" - "}"; - EXPECT_EQ(one_line_result, json); -} - -TEST_F(TrackedObjectsTest, LifeCycleToValueWorkerThread) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) - return; - - // Don't initialize thread, so that we appear as a worker thread. - // ThreadData::InitializeThreadContext("SomeMainThreadName"); - - const int kFakeLineNumber = 236; - const char* kFile = "FixedFileName"; - const char* kFunction = "LifeCycleToValueWorkerThread"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); - // Do not delete birth. We don't own it. - Births* birth = ThreadData::TallyABirthIfActive(location); - EXPECT_NE(birth, reinterpret_cast(NULL)); - - const TrackedTime kTimePosted = TrackedTime() + Duration::FromMilliseconds(1); - const TrackedTime kStartOfRun = TrackedTime() + - Duration::FromMilliseconds(5); - const TrackedTime kEndOfRun = TrackedTime() + Duration::FromMilliseconds(7); - ThreadData::TallyRunOnWorkerThreadIfTracking(birth, kTimePosted, - kStartOfRun, kEndOfRun); - - scoped_ptr value(ThreadData::ToValue()); - std::string json; - base::JSONWriter::Write(value.get(), false, &json); - std::string one_line_result = "{" - "\"list\":[" - "{" - "\"birth_thread\":\"WorkerThread-1\"," - "\"death_data\":{" - "\"count\":1," - "\"queue_ms\":4," - "\"run_ms\":2" - "}," - "\"death_thread\":\"WorkerThread-1\"," - "\"location\":{" - "\"file_name\":\"FixedFileName\"," - "\"function_name\":\"LifeCycleToValueWorkerThread\"," - "\"line_number\":236" - "}" - "}" - "]" - "}"; - EXPECT_EQ(one_line_result, json); + EXPECT_EQ(json, one_line_result); } TEST_F(TrackedObjectsTest, TwoLives) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; // Use a well named thread. ThreadData::InitializeThreadContext("SomeFileThreadName"); - const int kFakeLineNumber = 222; + int fake_line_number = 222; const char* kFile = "AnotherFileName"; const char* kFunction = "TwoLives"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); + Location location(kFunction, kFile, fake_line_number, NULL); // Do not delete birth. We don't own it. Births* birth = ThreadData::TallyABirthIfActive(location); EXPECT_NE(birth, reinterpret_cast(NULL)); - - const base::TimeTicks kTimePosted = base::TimeTicks() - + base::TimeDelta::FromMilliseconds(1); - const base::TimeTicks kDelayedStartTime = base::TimeTicks(); - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task(location, kDelayedStartTime); - pending_task.time_posted = kTimePosted; // Overwrite implied Now(). - - const TrackedTime kStartOfRun = TrackedTime() + - Duration::FromMilliseconds(5); - const TrackedTime kEndOfRun = TrackedTime() + Duration::FromMilliseconds(7); - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, - kStartOfRun, kEndOfRun); - - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task2(location, kDelayedStartTime); - pending_task2.time_posted = kTimePosted; // Overwrite implied Now(). - - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task2, - kStartOfRun, kEndOfRun); - - scoped_ptr value(ThreadData::ToValue()); + // TimeTicks initializers ar ein microseconds. Durations are calculated in + // milliseconds, so we need to use 1000x. + const base::TimeTicks time_posted = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(1); + const base::TimeTicks delayed_start_time = base::TimeTicks(); + const base::TimeTicks start_of_run = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(5); + const base::TimeTicks end_of_run = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(7); + ThreadData::TallyADeathIfActive(birth, time_posted, delayed_start_time, + start_of_run, end_of_run); + + birth = ThreadData::TallyABirthIfActive(location); + ThreadData::TallyADeathIfActive(birth, time_posted, delayed_start_time, + start_of_run, end_of_run); + + int process_type = 7; + scoped_ptr value(ThreadData::ToValue(process_type)); std::string json; base::JSONWriter::Write(value.get(), false, &json); std::string one_line_result = "{" @@ -526,43 +331,44 @@ TEST_F(TrackedObjectsTest, TwoLives) { "\"line_number\":222" "}" "}" - "]" + "]," + "\"process\":7" "}"; - EXPECT_EQ(one_line_result, json); + EXPECT_EQ(json, one_line_result); } TEST_F(TrackedObjectsTest, DifferentLives) { - if (!ThreadData::InitializeAndSetTrackingStatus(true)) + if (!ThreadData::StartTracking(true)) return; // Use a well named thread. ThreadData::InitializeThreadContext("SomeFileThreadName"); - const int kFakeLineNumber = 567; + int fake_line_number = 567; const char* kFile = "AnotherFileName"; const char* kFunction = "DifferentLives"; - Location location(kFunction, kFile, kFakeLineNumber, NULL); - - const base::TimeTicks kTimePosted = base::TimeTicks() - + base::TimeDelta::FromMilliseconds(1); - const base::TimeTicks kDelayedStartTime = base::TimeTicks(); - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task(location, kDelayedStartTime); - pending_task.time_posted = kTimePosted; // Overwrite implied Now(). - - const TrackedTime kStartOfRun = TrackedTime() + - Duration::FromMilliseconds(5); - const TrackedTime kEndOfRun = TrackedTime() + Duration::FromMilliseconds(7); - ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, - kStartOfRun, kEndOfRun); - - const int kSecondFakeLineNumber = 999; - Location second_location(kFunction, kFile, kSecondFakeLineNumber, NULL); - - // TrackingInfo will call TallyABirth() during construction. - base::TrackingInfo pending_task2(second_location, kDelayedStartTime); - pending_task2.time_posted = kTimePosted; // Overwrite implied Now(). + Location location(kFunction, kFile, fake_line_number, NULL); + // Do not delete birth. We don't own it. + Births* birth = ThreadData::TallyABirthIfActive(location); + EXPECT_NE(birth, reinterpret_cast(NULL)); - scoped_ptr value(ThreadData::ToValue()); + // TimeTicks initializers ar ein microseconds. Durations are calculated in + // milliseconds, so we need to use 1000x. + const base::TimeTicks time_posted = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(1); + const base::TimeTicks delayed_start_time = base::TimeTicks(); + const base::TimeTicks start_of_run = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(5); + const base::TimeTicks end_of_run = base::TimeTicks() + + base::TimeDelta::FromMilliseconds(7); + ThreadData::TallyADeathIfActive(birth, time_posted, delayed_start_time, + start_of_run, end_of_run); + + int second_fake_line_number = 999; + Location second_location(kFunction, kFile, second_fake_line_number, NULL); + birth = ThreadData::TallyABirthIfActive(second_location); + + int process_type = 2; + scoped_ptr value(ThreadData::ToValue(process_type)); std::string json; base::JSONWriter::Write(value.get(), false, &json); std::string one_line_result = "{" @@ -595,9 +401,10 @@ TEST_F(TrackedObjectsTest, DifferentLives) { "\"line_number\":999" "}" "}" - "]" + "]," + "\"process\":2" "}"; - EXPECT_EQ(one_line_result, json); + EXPECT_EQ(json, one_line_result); } } // namespace tracked_objects -- cgit v1.1