chromium/third_party/perfetto/src/trace_processor/importers/android_bugreport/android_log_reader.cc

/*
 * Copyright (C) 2022 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/android_bugreport/android_log_reader.h"

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <ctime>
#include <optional>
#include <string>
#include <utility>

#include "perfetto/base/status.h"
#include "perfetto/base/time.h"
#include "protos/perfetto/common/android_log_constants.pbzero.h"
#include "protos/perfetto/trace/clock_snapshot.pbzero.h"
#include "src/trace_processor/importers/android_bugreport/android_log_event.h"
#include "src/trace_processor/importers/common/clock_converter.h"
#include "src/trace_processor/importers/common/clock_tracker.h"
#include "src/trace_processor/sorter/trace_sorter.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "src/trace_processor/util/status_macros.h"

namespace perfetto::trace_processor {

namespace {

// Reads a base-10 number and advances the passed StringView beyond the *last*
// instance of `sep`. Example:
// Input:  it="1234   bar".
// Output: it="bar", ret=1234.
//
// `decimal_scale` is used to parse decimals and defines the output resolution.
// E.g. input="1",    decimal_scale=1000 -> res=100
//      input="12",   decimal_scale=1000 -> res=120
//      input="123",  decimal_scale=1000 -> res=123
//      input="1234", decimal_scale=1000 -> res=123
//      input="1234", decimal_scale=1000000 -> res=123400
std::optional<int> ReadNumAndAdvance(base::StringView* it,
                                     char sep,
                                     int decimal_scale = 0) {}

int32_t ToYear(std::chrono::seconds epoch) {}

int32_t GetCurrentYear() {}

int32_t GuessYear(TraceProcessorContext* context) {}

}  // namespace
AndroidLogReader::AndroidLogReader(TraceProcessorContext* context)
    :{}

AndroidLogReader::AndroidLogReader(TraceProcessorContext* context, int32_t year)
    :{}

AndroidLogReader::~AndroidLogReader() = default;

util::Status AndroidLogReader::ParseLine(base::StringView line) {}

util::Status AndroidLogReader::ProcessEvent(std::chrono::nanoseconds event_ts,
                                            AndroidLogEvent event) {}

util::Status AndroidLogReader::SendToSorter(std::chrono::nanoseconds event_ts,
                                            AndroidLogEvent event) {}

void AndroidLogReader::EndOfStream(base::StringView) {}

BufferingAndroidLogReader::~BufferingAndroidLogReader() = default;

base::Status BufferingAndroidLogReader::ProcessEvent(
    std::chrono::nanoseconds event_ts,
    AndroidLogEvent event) {}

DedupingAndroidLogReader::DedupingAndroidLogReader(
    TraceProcessorContext* context,
    int32_t year,
    std::vector<TimestampedAndroidLogEvent> events)
    :{}

DedupingAndroidLogReader::~DedupingAndroidLogReader() {}

base::Status DedupingAndroidLogReader::ProcessEvent(
    std::chrono::nanoseconds event_ts,
    AndroidLogEvent event) {}

}  // namespace perfetto::trace_processor