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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1540 for (int i = 0; i < kNumThreads; i++) | 1540 for (int i = 0; i < kNumThreads; i++) |
1541 threads[i] = new Thread(StringPrintf("Thread %d", i)); | 1541 threads[i] = new Thread(StringPrintf("Thread %d", i)); |
1542 | 1542 |
1543 // Enable tracing. | 1543 // Enable tracing. |
1544 BeginTrace(); | 1544 BeginTrace(); |
1545 | 1545 |
1546 // Now run some trace code on these threads. | 1546 // Now run some trace code on these threads. |
1547 WaitableEvent* task_complete_events[kNumThreads]; | 1547 WaitableEvent* task_complete_events[kNumThreads]; |
1548 for (int i = 0; i < kNumThreads; i++) { | 1548 for (int i = 0; i < kNumThreads; i++) { |
1549 task_complete_events[i] = new WaitableEvent(false, false); | 1549 task_complete_events[i] = new WaitableEvent(false, false); |
1550 threads[i]->Start(); | 1550 threads[i]->StartAndWaitForTesting(); |
gab
2015/07/09 18:19:00
Why is this related to this CL?
Takashi Toyoshima
2015/07/14 10:47:28
This is because now thread_id() can return a valid
| |
1551 thread_ids[i] = threads[i]->thread_id(); | 1551 thread_ids[i] = threads[i]->thread_id(); |
1552 threads[i]->task_runner()->PostTask( | 1552 threads[i]->task_runner()->PostTask( |
1553 FROM_HERE, base::Bind(&TraceManyInstantEvents, i, kNumEvents, | 1553 FROM_HERE, base::Bind(&TraceManyInstantEvents, i, kNumEvents, |
1554 task_complete_events[i])); | 1554 task_complete_events[i])); |
1555 } | 1555 } |
1556 for (int i = 0; i < kNumThreads; i++) { | 1556 for (int i = 0; i < kNumThreads; i++) { |
1557 task_complete_events[i]->Wait(); | 1557 task_complete_events[i]->Wait(); |
1558 } | 1558 } |
1559 | 1559 |
1560 // Shut things down. | 1560 // Shut things down. |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2958 } | 2958 } |
2959 | 2959 |
2960 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 2960 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
2961 const char filter[] = "DELAY(test.Delay;16;oneshot)"; | 2961 const char filter[] = "DELAY(test.Delay;16;oneshot)"; |
2962 TraceConfig config(filter, ""); | 2962 TraceConfig config(filter, ""); |
2963 EXPECT_EQ(filter, config.ToCategoryFilterString()); | 2963 EXPECT_EQ(filter, config.ToCategoryFilterString()); |
2964 } | 2964 } |
2965 | 2965 |
2966 } // namespace trace_event | 2966 } // namespace trace_event |
2967 } // namespace base | 2967 } // namespace base |
OLD | NEW |