1 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 #ifndef TENSORFLOW_LITE_PROFILING_NOOP_PROFILER_H_ 16 #define TENSORFLOW_LITE_PROFILING_NOOP_PROFILER_H_ 17 18 #include <vector> 19 20 #include "tensorflow/lite/core/api/profiler.h" 21 #include "tensorflow/lite/profiling/profile_buffer.h" 22 23 namespace tflite { 24 namespace profiling { 25 26 // A noop version of profiler when profiling is disabled. 27 class NoopProfiler : public tflite::Profiler { 28 public: NoopProfiler()29 NoopProfiler() {} NoopProfiler(int max_profiling_buffer_entries)30 explicit NoopProfiler(int max_profiling_buffer_entries) {} 31 BeginEvent(const char *,EventType,int64_t,int64_t)32 uint32_t BeginEvent(const char*, EventType, int64_t, int64_t) override { 33 return 0; 34 } EndEvent(uint32_t)35 void EndEvent(uint32_t) override {} 36 StartProfiling()37 void StartProfiling() {} StopProfiling()38 void StopProfiling() {} Reset()39 void Reset() {} GetProfileEvents()40 std::vector<const ProfileEvent*> GetProfileEvents() { return {}; } 41 }; 42 43 } // namespace profiling 44 } // namespace tflite 45 46 #endif // TENSORFLOW_LITE_PROFILING_NOOP_PROFILER_H_ 47