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_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 int g_category_index = g_num_builtin_categories; // Skip default categories. | 82 int g_category_index = g_num_builtin_categories; // Skip default categories. |
83 | 83 |
84 // The name of the current thread. This is used to decide if the current | 84 // The name of the current thread. This is used to decide if the current |
85 // thread name has changed. We combine all the seen thread names into the | 85 // thread name has changed. We combine all the seen thread names into the |
86 // output name for the thread. | 86 // output name for the thread. |
87 LazyInstance<ThreadLocalPointer<const char> >::Leaky | 87 LazyInstance<ThreadLocalPointer<const char> >::Leaky |
88 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; | 88 g_current_thread_name = LAZY_INSTANCE_INITIALIZER; |
89 | 89 |
90 const char kRecordUntilFull[] = "record-until-full"; | 90 const char kRecordUntilFull[] = "record-until-full"; |
91 const char kRecordContinuously[] = "record-continuously"; | 91 const char kRecordContinuously[] = "record-continuously"; |
| 92 const char kEnableSampling[] = "enable-sampling"; |
92 | 93 |
93 size_t NextIndex(size_t index) { | 94 size_t NextIndex(size_t index) { |
94 index++; | 95 index++; |
95 if (index >= kTraceEventBufferSize) | 96 if (index >= kTraceEventBufferSize) |
96 index = 0; | 97 index = 0; |
97 return index; | 98 return index; |
98 } | 99 } |
99 | 100 |
100 } // namespace | 101 } // namespace |
101 | 102 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 std::vector<std::string> split; | 755 std::vector<std::string> split; |
755 base::SplitString(options, ',', &split); | 756 base::SplitString(options, ',', &split); |
756 int ret = 0; | 757 int ret = 0; |
757 for (std::vector<std::string>::iterator iter = split.begin(); | 758 for (std::vector<std::string>::iterator iter = split.begin(); |
758 iter != split.end(); | 759 iter != split.end(); |
759 ++iter) { | 760 ++iter) { |
760 if (*iter == kRecordUntilFull) { | 761 if (*iter == kRecordUntilFull) { |
761 ret |= RECORD_UNTIL_FULL; | 762 ret |= RECORD_UNTIL_FULL; |
762 } else if (*iter == kRecordContinuously) { | 763 } else if (*iter == kRecordContinuously) { |
763 ret |= RECORD_CONTINUOUSLY; | 764 ret |= RECORD_CONTINUOUSLY; |
| 765 } else if (*iter == kEnableSampling) { |
| 766 ret |= ENABLE_SAMPLING; |
764 } else { | 767 } else { |
765 NOTREACHED(); // Unknown option provided. | 768 NOTREACHED(); // Unknown option provided. |
766 } | 769 } |
767 } | 770 } |
768 if (!(ret & RECORD_UNTIL_FULL) && !(ret & RECORD_CONTINUOUSLY)) | 771 if (!(ret & RECORD_UNTIL_FULL) && !(ret & RECORD_CONTINUOUSLY)) |
769 ret |= RECORD_UNTIL_FULL; // Default when no options are specified. | 772 ret |= RECORD_UNTIL_FULL; // Default when no options are specified. |
770 | 773 |
771 return static_cast<Options>(ret); | 774 return static_cast<Options>(ret); |
772 } | 775 } |
773 | 776 |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 0, // num_args | 1549 0, // num_args |
1547 NULL, // arg_names | 1550 NULL, // arg_names |
1548 NULL, // arg_types | 1551 NULL, // arg_types |
1549 NULL, // arg_values | 1552 NULL, // arg_values |
1550 NULL, // convertable values | 1553 NULL, // convertable values |
1551 TRACE_EVENT_FLAG_NONE); // flags | 1554 TRACE_EVENT_FLAG_NONE); // flags |
1552 } | 1555 } |
1553 } | 1556 } |
1554 | 1557 |
1555 } // namespace trace_event_internal | 1558 } // namespace trace_event_internal |
OLD | NEW |