All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bytedeco.tensorflowlite.TelemetryProfiler Maven / Gradle / Ivy

// Targeted by JavaCPP version 1.5.11: DO NOT EDIT THIS FILE

package org.bytedeco.tensorflowlite;

import java.nio.*;
import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;

import static org.bytedeco.tensorflowlite.global.tensorflowlite.*;


// Telemetry profiler interface.
// When installed, the telemetry profilers accepts profiler events exported from
// TFLite runtime profiler instrumentation points, interprets the events
// based on the event type and forward to corresponding `Report` function.
// The implementation of the `Report` functions are responsible for dumping the
// profiling events to the data sink.
// The implementation of TelemetryProfiler is required to be thread safe.
@Namespace("tflite::telemetry") @Properties(inherit = org.bytedeco.tensorflowlite.presets.tensorflowlite.class)
public class TelemetryProfiler extends Profiler {
    static { Loader.load(); }
    /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
    public TelemetryProfiler(Pointer p) { super(p); }

  // General Telemetry events.

  // Reports a telemetry event with status.
  // `event_name` indicates the name of the event (e.g. "Invoke") and should not
  // be nullptr.
  // `status` shows 1) the source of the event, interpreter or which delegate,
  // 2) the return status of the event.
  public native void ReportTelemetryEvent(@Cast("const char*") BytePointer event_name,
                                      @ByVal TelemetryStatusCode status);
  public native void ReportTelemetryEvent(String event_name,
                                      @ByVal TelemetryStatusCode status);

  // Reports an op telemetry event with status.
  // Same as `ReportTelemetryEvent`, with additional args `op_idx` and
  // `subgraph_idx`.
  public native void ReportTelemetryOpEvent(@Cast("const char*") BytePointer event_name, @Cast("int64_t") long op_idx,
                                        @Cast("int64_t") long subgraph_idx,
                                        @ByVal TelemetryStatusCode status);
  public native void ReportTelemetryOpEvent(String event_name, @Cast("int64_t") long op_idx,
                                        @Cast("int64_t") long subgraph_idx,
                                        @ByVal TelemetryStatusCode status);

  // Telemetry ReportSettings events.

  // Reports the model and interpreter settings.
  // `setting_name` indicates the name of the setting and should not be nullptr.
  // `settings`'s lifespan is not guaranteed outside the scope of
  // `ReportSettings` call.
  public native void ReportSettings(@Cast("const char*") BytePointer setting_name,
                                @Const TfLiteTelemetrySettings settings);
  public native void ReportSettings(String setting_name,
                                @Const TfLiteTelemetrySettings settings);

  // Performance measurement events.

  // Signals the beginning of an operator invocation.
  // `op_name` is the name of the operator and should not be nullptr.
  // Op invoke event are triggered with OPERATOR_INVOKE_EVENT type for TfLite
  // ops and delegate kernels, and DELEGATE_OPERATOR_INVOKE_EVENT for delegate
  // ops within a delegate kernels, if the instrumentation is in place.
  // Returns event handle which can be passed to `EndOpInvokeEvent` later.
  public native @Cast("uint32_t") int ReportBeginOpInvokeEvent(@Cast("const char*") BytePointer op_name, @Cast("int64_t") long op_idx,
                                              @Cast("int64_t") long subgraph_idx);
  public native @Cast("uint32_t") int ReportBeginOpInvokeEvent(String op_name, @Cast("int64_t") long op_idx,
                                              @Cast("int64_t") long subgraph_idx);

  // Signals the end to the event specified by `event_handle`.
  public native void ReportEndOpInvokeEvent(@Cast("uint32_t") int event_handle);

  // For op / delegate op with built-in performance measurements, they
  // are able to report the elapsed time directly.
  // `elapsed_time` is in microsecond.
  public native void ReportOpInvokeEvent(@Cast("const char*") BytePointer op_name, @Cast("uint64_t") long elapsed_time,
                                     @Cast("int64_t") long op_idx, @Cast("int64_t") long subgraph_idx);
  public native void ReportOpInvokeEvent(String op_name, @Cast("uint64_t") long elapsed_time,
                                     @Cast("int64_t") long op_idx, @Cast("int64_t") long subgraph_idx);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy