#include "base/trace_event/trace_config.h"
#include <stddef.h>
#include <algorithm>
#include <optional>
#include <string_view>
#include <utility>
#include "base/containers/contains.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/strings/string_split.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/trace_event.h"
#include "third_party/perfetto/protos/perfetto/config/track_event/track_event_config.gen.h"
namespace base::trace_event {
namespace {
const char kRecordUntilFull[] = …;
const char kRecordContinuously[] = …;
const char kRecordAsMuchAsPossible[] = …;
const char kTraceToConsole[] = …;
const char kEnableSystrace[] = …;
constexpr int kEnableSystraceLength = …;
const char kEnableArgumentFilter[] = …;
const char kRecordModeParam[] = …;
const char kTraceBufferSizeInEvents[] = …;
const char kTraceBufferSizeInKb[] = …;
const char kEnableSystraceParam[] = …;
const char kSystraceEventsParam[] = …;
const char kEnableArgumentFilterParam[] = …;
const char kEnableEventPackageNameFilterParam[] = …;
const char kMemoryDumpConfigParam[] = …;
const char kAllowedDumpModesParam[] = …;
const char kTriggersParam[] = …;
const char kTriggerModeParam[] = …;
const char kMinTimeBetweenDumps[] = …;
const char kTriggerTypeParam[] = …;
const char kPeriodicIntervalLegacyParam[] = …;
const char kHeapProfilerOptions[] = …;
const char kBreakdownThresholdBytes[] = …;
const char kEventFiltersParam[] = …;
const char kFilterPredicateParam[] = …;
const char kFilterArgsParam[] = …;
const char kIncludedProcessesParam[] = …;
const char kHistogramNamesParam[] = …;
class ConvertableTraceConfigToTraceFormat
: public base::trace_event::ConvertableToTraceFormat { … };
std::set<MemoryDumpLevelOfDetail> GetDefaultAllowedMemoryDumpModes() { … }
}
TraceConfig::MemoryDumpConfig::HeapProfiler::HeapProfiler()
: … { … }
void TraceConfig::MemoryDumpConfig::HeapProfiler::Clear() { … }
void TraceConfig::ResetMemoryDumpConfig(
const TraceConfig::MemoryDumpConfig& memory_dump_config) { … }
TraceConfig::MemoryDumpConfig::MemoryDumpConfig() = default;
TraceConfig::MemoryDumpConfig::MemoryDumpConfig(
const MemoryDumpConfig& other) = default;
TraceConfig::MemoryDumpConfig::~MemoryDumpConfig() = default;
void TraceConfig::MemoryDumpConfig::Clear() { … }
void TraceConfig::MemoryDumpConfig::Merge(
const TraceConfig::MemoryDumpConfig& config) { … }
TraceConfig::ProcessFilterConfig::ProcessFilterConfig() = default;
TraceConfig::ProcessFilterConfig::ProcessFilterConfig(
const ProcessFilterConfig& other) = default;
TraceConfig::ProcessFilterConfig::ProcessFilterConfig(
const std::unordered_set<base::ProcessId>& included_process_ids)
: … { … }
TraceConfig::ProcessFilterConfig::~ProcessFilterConfig() = default;
void TraceConfig::ProcessFilterConfig::Clear() { … }
void TraceConfig::ProcessFilterConfig::Merge(
const ProcessFilterConfig& config) { … }
void TraceConfig::ProcessFilterConfig::InitializeFromConfigDict(
const Value::Dict& dict) { … }
void TraceConfig::ProcessFilterConfig::ToDict(Value::Dict& dict) const { … }
bool TraceConfig::ProcessFilterConfig::IsEnabled(
base::ProcessId process_id) const { … }
TraceConfig::EventFilterConfig::EventFilterConfig(
const std::string& predicate_name)
: … { … }
TraceConfig::EventFilterConfig::~EventFilterConfig() = default;
TraceConfig::EventFilterConfig::EventFilterConfig(const EventFilterConfig& tc) { … }
TraceConfig::EventFilterConfig& TraceConfig::EventFilterConfig::operator=(
const TraceConfig::EventFilterConfig& rhs) { … }
bool TraceConfig::EventFilterConfig::IsEquivalentTo(
const EventFilterConfig& other) const { … }
void TraceConfig::EventFilterConfig::InitializeFromConfigDict(
const Value::Dict& event_filter) { … }
void TraceConfig::EventFilterConfig::SetCategoryFilter(
const TraceConfigCategoryFilter& category_filter) { … }
void TraceConfig::EventFilterConfig::ToDict(Value::Dict& filter_dict) const { … }
bool TraceConfig::EventFilterConfig::GetArgAsSet(
const char* key,
std::unordered_set<std::string>* out_set) const { … }
bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled(
std::string_view category_group_name) const { … }
std::string TraceConfig::TraceRecordModeToStr(TraceRecordMode record_mode) { … }
TraceConfig::TraceConfig() { … }
TraceConfig::TraceConfig(std::string_view category_filter_string,
std::string_view trace_options_string) { … }
TraceConfig::TraceConfig(std::string_view category_filter_string,
TraceRecordMode record_mode) { … }
TraceConfig::TraceConfig(const Value::Dict& config) { … }
TraceConfig::TraceConfig(std::string_view config_string) { … }
TraceConfig::TraceConfig(const TraceConfig& tc) = default;
TraceConfig::~TraceConfig() = default;
TraceConfig& TraceConfig::operator=(const TraceConfig& rhs) { … }
bool TraceConfig::IsEquivalentTo(const TraceConfig& other) const { … }
std::string TraceConfig::ToString() const { … }
std::unique_ptr<ConvertableToTraceFormat>
TraceConfig::AsConvertableToTraceFormat() const { … }
std::string TraceConfig::ToCategoryFilterString() const { … }
bool TraceConfig::IsCategoryGroupEnabled(
std::string_view category_group_name) const { … }
void TraceConfig::Merge(const TraceConfig& config) { … }
void TraceConfig::Clear() { … }
void TraceConfig::InitializeDefault() { … }
void TraceConfig::InitializeFromConfigDict(const Value::Dict& dict) { … }
void TraceConfig::InitializeFromConfigString(std::string_view config_string) { … }
void TraceConfig::InitializeFromStrings(std::string_view category_filter_string,
std::string_view trace_options_string) { … }
void TraceConfig::SetMemoryDumpConfigFromConfigDict(
const Value::Dict& memory_dump_config) { … }
void TraceConfig::SetDefaultMemoryDumpConfig() { … }
void TraceConfig::SetProcessFilterConfig(const ProcessFilterConfig& config) { … }
void TraceConfig::SetHistogramNamesFromConfigList(
const Value::List& histogram_names) { … }
void TraceConfig::SetEventFiltersFromConfigList(
const Value::List& category_event_filters) { … }
Value TraceConfig::ToValue() const { … }
void TraceConfig::EnableSystraceEvent(const std::string& systrace_event) { … }
void TraceConfig::EnableHistogram(const std::string& histogram_name) { … }
std::string TraceConfig::ToTraceOptionsString() const { … }
std::string TraceConfig::ToPerfettoTrackEventConfigRaw(
bool privacy_filtering_enabled) const { … }
}