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/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 | 977 |
978 TraceBucketData::~TraceBucketData() { | 978 TraceBucketData::~TraceBucketData() { |
979 } | 979 } |
980 | 980 |
981 //////////////////////////////////////////////////////////////////////////////// | 981 //////////////////////////////////////////////////////////////////////////////// |
982 // | 982 // |
983 // TraceOptions | 983 // TraceOptions |
984 // | 984 // |
985 //////////////////////////////////////////////////////////////////////////////// | 985 //////////////////////////////////////////////////////////////////////////////// |
986 | 986 |
987 TraceOptions::TraceOptions(const std::string& options_string) | 987 bool TraceOptions::SetFromString(const std::string& options_string) { |
988 : record_mode(RECORD_UNTIL_FULL), | 988 record_mode = RECORD_UNTIL_FULL; |
989 enable_sampling(false), | 989 enable_sampling = false; |
990 enable_systrace(false) { | 990 enable_systrace = false; |
| 991 |
991 std::vector<std::string> split; | 992 std::vector<std::string> split; |
992 std::vector<std::string>::iterator iter; | 993 std::vector<std::string>::iterator iter; |
993 | |
994 base::SplitString(options_string, ',', &split); | 994 base::SplitString(options_string, ',', &split); |
995 for (iter = split.begin(); iter != split.end(); ++iter) { | 995 for (iter = split.begin(); iter != split.end(); ++iter) { |
996 if (*iter == kRecordUntilFull) { | 996 if (*iter == kRecordUntilFull) { |
997 record_mode = RECORD_UNTIL_FULL; | 997 record_mode = RECORD_UNTIL_FULL; |
998 } else if (*iter == kRecordContinuously) { | 998 } else if (*iter == kRecordContinuously) { |
999 record_mode = RECORD_CONTINUOUSLY; | 999 record_mode = RECORD_CONTINUOUSLY; |
1000 } else if (*iter == kTraceToConsole) { | 1000 } else if (*iter == kTraceToConsole) { |
1001 record_mode = ECHO_TO_CONSOLE; | 1001 record_mode = ECHO_TO_CONSOLE; |
1002 } else if (*iter == kRecordAsMuchAsPossible) { | 1002 } else if (*iter == kRecordAsMuchAsPossible) { |
1003 record_mode = RECORD_AS_MUCH_AS_POSSIBLE; | 1003 record_mode = RECORD_AS_MUCH_AS_POSSIBLE; |
1004 } else if (*iter == kEnableSampling) { | 1004 } else if (*iter == kEnableSampling) { |
1005 enable_sampling = true; | 1005 enable_sampling = true; |
1006 } else if (*iter == kEnableSystrace) { | 1006 } else if (*iter == kEnableSystrace) { |
1007 enable_systrace = true; | 1007 enable_systrace = true; |
1008 } else { | 1008 } else { |
1009 NOTREACHED(); | 1009 return false; |
1010 } | 1010 } |
1011 } | 1011 } |
| 1012 return true; |
1012 } | 1013 } |
1013 | 1014 |
1014 std::string TraceOptions::ToString() const { | 1015 std::string TraceOptions::ToString() const { |
1015 std::string ret; | 1016 std::string ret; |
1016 switch (record_mode) { | 1017 switch (record_mode) { |
1017 case RECORD_UNTIL_FULL: | 1018 case RECORD_UNTIL_FULL: |
1018 ret = kRecordUntilFull; | 1019 ret = kRecordUntilFull; |
1019 break; | 1020 break; |
1020 case RECORD_CONTINUOUSLY: | 1021 case RECORD_CONTINUOUSLY: |
1021 ret = kRecordContinuously; | 1022 ret = kRecordContinuously; |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 } | 2562 } |
2562 | 2563 |
2563 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2564 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
2564 if (*category_group_enabled_) { | 2565 if (*category_group_enabled_) { |
2565 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2566 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
2566 name_, event_handle_); | 2567 name_, event_handle_); |
2567 } | 2568 } |
2568 } | 2569 } |
2569 | 2570 |
2570 } // namespace trace_event_internal | 2571 } // namespace trace_event_internal |
OLD | NEW |