chromium/third_party/perfetto/src/trace_processor/importers/perf/features.cc

/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/importers/perf/features.h"

#include <cstdint>
#include <utility>

#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/trace_processor/status.h"
#include "perfetto/trace_processor/trace_blob_view.h"
#include "src/trace_processor/importers/perf/perf_event.h"
#include "src/trace_processor/importers/perf/reader.h"
#include "src/trace_processor/util/status_macros.h"

namespace perfetto::trace_processor::perf_importer::feature {
namespace {

struct BuildIdRecord {};

uint8_t CountTrailingZeros(const BuildIdRecord& build_id) {}

// BuildIds are usually SHA-1 hashes (20 bytes), sometimes MD5 (16 bytes),
// sometimes 8 bytes long. Simpleperf adds trailing zeros up to 20. Do a best
// guess based on the number of trailing zeros.
uint8_t GuessBuildIdSize(const BuildIdRecord& build_id) {}

bool ParseString(Reader& reader, std::string& out) {}

bool ParseBuildId(const perf_event_header& header,
                  TraceBlobView blob,
                  BuildId& out) {}

util::Status ParseEventTypeInfo(std::string value, SimpleperfMetaInfo& out) {}

util::Status ParseSimpleperfMetaInfoEntry(
    std::pair<std::string, std::string> entry,
    SimpleperfMetaInfo& out) {}

}  // namespace

// static
util::Status BuildId::Parse(TraceBlobView bytes,
                            std::function<util::Status(BuildId)> cb) {}

// static
util::Status SimpleperfMetaInfo::Parse(const TraceBlobView& bytes,
                                       SimpleperfMetaInfo& out) {}

// static
util::Status EventDescription::Parse(
    TraceBlobView bytes,
    std::function<util::Status(EventDescription)> cb) {}

util::Status ParseSimpleperfFile2(TraceBlobView bytes,
                                  std::function<void(TraceBlobView)> cb) {}

// static
util::Status HeaderGroupDesc::Parse(TraceBlobView bytes, HeaderGroupDesc& out) {}

base::StatusOr<std::vector<std::string>> ParseCmdline(TraceBlobView bytes) {}

}  // namespace perfetto::trace_processor::perf_importer::feature