chromium/third_party/tflite/src/tensorflow/lite/profiling/telemetry/profiler.cc

/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

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 "tensorflow/lite/profiling/telemetry/profiler.h"

#include <cstdint>

#include "tensorflow/lite/core/api/profiler.h"

namespace tflite::telemetry {

void TelemetryProfiler::AddEvent(const char* tag, EventType event_type,
                                 uint64_t metric, int64_t event_metadata1,
                                 int64_t event_metadata2) {}

void TelemetryProfiler::AddEventWithData(const char* tag, EventType event_type,
                                         const void* data) {}

uint32_t TelemetryProfiler::BeginEvent(const char* tag, EventType event_type,
                                       int64_t event_metadata1,
                                       int64_t event_metadata2) {}

void TelemetryProfiler::EndEvent(uint32_t event_handle) {}

// This TfLiteTelemetryProfiler class wraps the `TfLiteTelemetryProfilerStruct`
// C API into the TelemetryProfiler interface. Users that uses the C API
// will provide `TfLiteTelemetryProfilerStruct` to TfLiteInterpreter and then
// TFLite runtime will build `TfLiteTelemetryProfiler` with it and register to
// the interpreter.
class TfLiteTelemetryProfiler : public TelemetryProfiler {};

void TfLiteTelemetryProfiler::ReportTelemetryEvent(const char* event_name,
                                                   TelemetryStatusCode status) {}

void TfLiteTelemetryProfiler::ReportTelemetryOpEvent(
    const char* event_name, int64_t op_idx, int64_t subgraph_idx,
    TelemetryStatusCode status) {}

void TfLiteTelemetryProfiler::ReportSettings(
    const char* setting_name, const TfLiteTelemetrySettings* settings) {}

uint32_t TfLiteTelemetryProfiler::ReportBeginOpInvokeEvent(
    const char* op_name, int64_t op_idx, int64_t subgraph_idx) {}

void TfLiteTelemetryProfiler::ReportEndOpInvokeEvent(uint32_t event_handle) {}

void TfLiteTelemetryProfiler::ReportOpInvokeEvent(const char* op_name,
                                                  uint64_t elapsed_time,
                                                  int64_t op_idx,
                                                  int64_t subgraph_idx) {}

TelemetryProfiler* MakeTfLiteTelemetryProfiler(
    TfLiteTelemetryProfilerStruct* profiler) {}

}  // namespace tflite::telemetry