| 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 <math.h> | 5 #include <math.h> |
| 6 #include <cstdlib> | 6 #include <cstdlib> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 for (int i = 0; i < kNumThreads; i++) | 1541 for (int i = 0; i < kNumThreads; i++) |
| 1542 threads[i] = new Thread(StringPrintf("Thread %d", i)); | 1542 threads[i] = new Thread(StringPrintf("Thread %d", i)); |
| 1543 | 1543 |
| 1544 // Enable tracing. | 1544 // Enable tracing. |
| 1545 BeginTrace(); | 1545 BeginTrace(); |
| 1546 | 1546 |
| 1547 // Now run some trace code on these threads. | 1547 // Now run some trace code on these threads. |
| 1548 WaitableEvent* task_complete_events[kNumThreads]; | 1548 WaitableEvent* task_complete_events[kNumThreads]; |
| 1549 for (int i = 0; i < kNumThreads; i++) { | 1549 for (int i = 0; i < kNumThreads; i++) { |
| 1550 task_complete_events[i] = new WaitableEvent(false, false); | 1550 task_complete_events[i] = new WaitableEvent(false, false); |
| 1551 threads[i]->Start(); | 1551 threads[i]->StartAndWaitForTesting(); |
| 1552 thread_ids[i] = threads[i]->thread_id(); | 1552 thread_ids[i] = threads[i]->thread_id(); |
| 1553 threads[i]->task_runner()->PostTask( | 1553 threads[i]->task_runner()->PostTask( |
| 1554 FROM_HERE, base::Bind(&TraceManyInstantEvents, i, kNumEvents, | 1554 FROM_HERE, base::Bind(&TraceManyInstantEvents, i, kNumEvents, |
| 1555 task_complete_events[i])); | 1555 task_complete_events[i])); |
| 1556 } | 1556 } |
| 1557 for (int i = 0; i < kNumThreads; i++) { | 1557 for (int i = 0; i < kNumThreads; i++) { |
| 1558 task_complete_events[i]->Wait(); | 1558 task_complete_events[i]->Wait(); |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 // Shut things down. | 1561 // Shut things down. |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2959 } | 2959 } |
| 2960 | 2960 |
| 2961 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 2961 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
| 2962 const char filter[] = "DELAY(test.Delay;16;oneshot)"; | 2962 const char filter[] = "DELAY(test.Delay;16;oneshot)"; |
| 2963 TraceConfig config(filter, ""); | 2963 TraceConfig config(filter, ""); |
| 2964 EXPECT_EQ(filter, config.ToCategoryFilterString()); | 2964 EXPECT_EQ(filter, config.ToCategoryFilterString()); |
| 2965 } | 2965 } |
| 2966 | 2966 |
| 2967 } // namespace trace_event | 2967 } // namespace trace_event |
| 2968 } // namespace base | 2968 } // namespace base |
| OLD | NEW |