/* Copyright 2017 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. ==============================================================================*/ #ifndef TENSORFLOW_LITE_CORE_API_PROFILER_H_ #define TENSORFLOW_LITE_CORE_API_PROFILER_H_ #include <cstdint> namespace tflite { // A simple utility for enabling profiled event tracing in TensorFlow Lite. class Profiler { … }; // Adds a profile event to `profiler` that begins with the construction // of the object and ends when the object goes out of scope. // The lifetime of tag should be at least the lifetime of `profiler`. // `profiler` may be null, in which case nothing is profiled. class ScopedProfile { … }; class ScopedOperatorProfile : public ScopedProfile { … }; class ScopedDelegateOperatorProfile : public ScopedProfile { … }; class ScopedDelegateProfiledOperatorProfile : public ScopedProfile { … }; // Similar to ScopedProfile but has extra event metadata for EndEvent. class ScopedRuntimeInstrumentationProfile { … }; } // namespace tflite #define TFLITE_VARNAME_UNIQ_IMPL(name, ctr) … #define TFLITE_VARNAME_UNIQ(name, ctr) … #define TFLITE_SCOPED_TAGGED_DEFAULT_PROFILE(profiler, tag) … #define TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler, tag, node_index) … #define TFLITE_SCOPED_DELEGATE_OPERATOR_PROFILE(profiler, tag, node_index) … #define TFLITE_SCOPED_DELEGATE_PROFILED_OPERATOR_PROFILE(profiler, tag, \ node_index) … #define TFLITE_ADD_RUNTIME_INSTRUMENTATION_EVENT( \ profiler, tag, event_metadata1, event_metadata2) … #endif // TENSORFLOW_LITE_CORE_API_PROFILER_H_