| 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 <stddef.h> |
| 7 #include <stdint.h> |
| 8 |
| 6 #include <cstdlib> | 9 #include <cstdlib> |
| 7 | 10 |
| 8 #include "base/bind.h" | 11 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 11 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 12 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted_memory.h" | 17 #include "base/memory/ref_counted_memory.h" |
| 14 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/singleton.h" | 19 #include "base/memory/singleton.h" |
| 16 #include "base/process/process_handle.h" | 20 #include "base/process/process_handle.h" |
| 17 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
| 18 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 19 #include "base/strings/pattern.h" | 23 #include "base/strings/pattern.h" |
| 20 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 21 #include "base/synchronization/waitable_event.h" | 25 #include "base/synchronization/waitable_event.h" |
| 22 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
| (...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 trace_log->OffsetNow().ToInternalValue()); | 2622 trace_log->OffsetNow().ToInternalValue()); |
| 2619 } | 2623 } |
| 2620 | 2624 |
| 2621 TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) { | 2625 TEST_F(TraceEventTestFixture, TraceBufferRingBufferGetReturnChunk) { |
| 2622 TraceLog::GetInstance()->SetEnabled( | 2626 TraceLog::GetInstance()->SetEnabled( |
| 2623 TraceConfig(kRecordAllCategoryFilter, RECORD_CONTINUOUSLY), | 2627 TraceConfig(kRecordAllCategoryFilter, RECORD_CONTINUOUSLY), |
| 2624 TraceLog::RECORDING_MODE); | 2628 TraceLog::RECORDING_MODE); |
| 2625 TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer(); | 2629 TraceBuffer* buffer = TraceLog::GetInstance()->trace_buffer(); |
| 2626 size_t capacity = buffer->Capacity(); | 2630 size_t capacity = buffer->Capacity(); |
| 2627 size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize; | 2631 size_t num_chunks = capacity / TraceBufferChunk::kTraceBufferChunkSize; |
| 2628 uint32 last_seq = 0; | 2632 uint32_t last_seq = 0; |
| 2629 size_t chunk_index; | 2633 size_t chunk_index; |
| 2630 EXPECT_EQ(0u, buffer->Size()); | 2634 EXPECT_EQ(0u, buffer->Size()); |
| 2631 | 2635 |
| 2632 scoped_ptr<TraceBufferChunk*[]> chunks(new TraceBufferChunk*[num_chunks]); | 2636 scoped_ptr<TraceBufferChunk*[]> chunks(new TraceBufferChunk*[num_chunks]); |
| 2633 for (size_t i = 0; i < num_chunks; ++i) { | 2637 for (size_t i = 0; i < num_chunks; ++i) { |
| 2634 chunks[i] = buffer->GetChunk(&chunk_index).release(); | 2638 chunks[i] = buffer->GetChunk(&chunk_index).release(); |
| 2635 EXPECT_TRUE(chunks[i]); | 2639 EXPECT_TRUE(chunks[i]); |
| 2636 EXPECT_EQ(i, chunk_index); | 2640 EXPECT_EQ(i, chunk_index); |
| 2637 EXPECT_GT(chunks[i]->seq(), last_seq); | 2641 EXPECT_GT(chunks[i]->seq(), last_seq); |
| 2638 EXPECT_EQ((i + 1) * TraceBufferChunk::kTraceBufferChunkSize, | 2642 EXPECT_EQ((i + 1) * TraceBufferChunk::kTraceBufferChunkSize, |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3023 } | 3027 } |
| 3024 | 3028 |
| 3025 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { | 3029 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { |
| 3026 const char filter[] = "DELAY(test.Delay;16;oneshot)"; | 3030 const char filter[] = "DELAY(test.Delay;16;oneshot)"; |
| 3027 TraceConfig config(filter, ""); | 3031 TraceConfig config(filter, ""); |
| 3028 EXPECT_EQ(filter, config.ToCategoryFilterString()); | 3032 EXPECT_EQ(filter, config.ToCategoryFilterString()); |
| 3029 } | 3033 } |
| 3030 | 3034 |
| 3031 } // namespace trace_event | 3035 } // namespace trace_event |
| 3032 } // namespace base | 3036 } // namespace base |
| OLD | NEW |