#include "perfetto/ext/trace_processor/export_json.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#include "perfetto/base/build_config.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/string_splitter.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/public/compiler.h"
#include "perfetto/trace_processor/basic_types.h"
#include "src/trace_processor/containers/null_term_string_view.h"
#include "src/trace_processor/export_json.h"
#include "src/trace_processor/storage/metadata.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/tables/metadata_tables_py.h"
#include "src/trace_processor/tables/profiler_tables_py.h"
#include "src/trace_processor/trace_processor_storage_impl.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "src/trace_processor/types/variadic.h"
#include "src/trace_processor/util/status_macros.h"
#if PERFETTO_BUILDFLAG(PERFETTO_TP_JSON)
#include <json/config.h>
#include <json/reader.h>
#include <json/value.h>
#include <json/writer.h>
#endif
namespace perfetto::trace_processor::json {
namespace {
class FileWriter : public OutputWriter { … };
#if PERFETTO_BUILDFLAG(PERFETTO_TP_JSON)
IndexMap;
const char kLegacyEventArgsKey[] = …;
const char kLegacyEventPassthroughUtidKey[] = …;
const char kLegacyEventCategoryKey[] = …;
const char kLegacyEventNameKey[] = …;
const char kLegacyEventPhaseKey[] = …;
const char kLegacyEventDurationNsKey[] = …;
const char kLegacyEventThreadTimestampNsKey[] = …;
const char kLegacyEventThreadDurationNsKey[] = …;
const char kLegacyEventThreadInstructionCountKey[] = …;
const char kLegacyEventThreadInstructionDeltaKey[] = …;
const char kLegacyEventUseAsyncTtsKey[] = …;
const char kLegacyEventUnscopedIdKey[] = …;
const char kLegacyEventGlobalIdKey[] = …;
const char kLegacyEventLocalIdKey[] = …;
const char kLegacyEventIdScopeKey[] = …;
const char kStrippedArgument[] = …;
const char* GetNonNullString(const TraceStorage* storage,
std::optional<StringId> id) { … }
class JsonExporter { … };
#endif
}
OutputWriter::OutputWriter() = default;
OutputWriter::~OutputWriter() = default;
base::Status ExportJson(const TraceStorage* storage,
OutputWriter* output,
ArgumentFilterPredicate argument_filter,
MetadataFilterPredicate metadata_filter,
LabelFilterPredicate label_filter) { … }
base::Status ExportJson(TraceProcessorStorage* tp,
OutputWriter* output,
ArgumentFilterPredicate argument_filter,
MetadataFilterPredicate metadata_filter,
LabelFilterPredicate label_filter) { … }
base::Status ExportJson(const TraceStorage* storage, FILE* output) { … }
}