| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/debug/trace_event_unittest.h" | 5 #include "base/debug/trace_event_unittest.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 } | 834 } |
| 835 | 835 |
| 836 EXPECT_FALSE(results[-1][-1]); | 836 EXPECT_FALSE(results[-1][-1]); |
| 837 for (int thread = 0; thread < num_threads; thread++) { | 837 for (int thread = 0; thread < num_threads; thread++) { |
| 838 for (int event = 0; event < num_events; event++) { | 838 for (int event = 0; event < num_events; event++) { |
| 839 EXPECT_TRUE(results[thread][event]); | 839 EXPECT_TRUE(results[thread][event]); |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 | 843 |
| 844 void TraceCallsWithCachedCategoryPointersPointers(const char* name_str) { | |
| 845 TRACE_EVENT0("category name1", name_str); | |
| 846 TRACE_EVENT_INSTANT0("category name2", name_str, TRACE_EVENT_SCOPE_THREAD); | |
| 847 TRACE_EVENT_BEGIN0("category name3", name_str); | |
| 848 TRACE_EVENT_END0("category name4", name_str); | |
| 849 } | |
| 850 | |
| 851 } // namespace | 844 } // namespace |
| 852 | 845 |
| 853 void HighResSleepForTraceTest(base::TimeDelta elapsed) { | 846 void HighResSleepForTraceTest(base::TimeDelta elapsed) { |
| 854 base::TimeTicks end_time = base::TimeTicks::HighResNow() + elapsed; | 847 base::TimeTicks end_time = base::TimeTicks::HighResNow() + elapsed; |
| 855 do { | 848 do { |
| 856 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); | 849 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); |
| 857 } while (base::TimeTicks::HighResNow() < end_time); | 850 } while (base::TimeTicks::HighResNow() < end_time); |
| 858 } | 851 } |
| 859 | 852 |
| 860 // Simple Test for emitting data and validating it was received. | 853 // Simple Test for emitting data and validating it was received. |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 double timestamp; | 2432 double timestamp; |
| 2440 EXPECT_TRUE(item->GetDouble("ts", ×tamp)); | 2433 EXPECT_TRUE(item->GetDouble("ts", ×tamp)); |
| 2441 EXPECT_GE(timestamp, last_timestamp); | 2434 EXPECT_GE(timestamp, last_timestamp); |
| 2442 EXPECT_LE(timestamp, end_time); | 2435 EXPECT_LE(timestamp, end_time); |
| 2443 last_timestamp = timestamp; | 2436 last_timestamp = timestamp; |
| 2444 } | 2437 } |
| 2445 } | 2438 } |
| 2446 | 2439 |
| 2447 } // namespace debug | 2440 } // namespace debug |
| 2448 } // namespace base | 2441 } // namespace base |
| OLD | NEW |