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 16 #ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_STATS_H_ 17 #define TENSORFLOW_LITE_DELEGATES_GPU_GL_STATS_H_ 18 19 #include <numeric> 20 21 #include "absl/strings/str_cat.h" 22 23 namespace tflite { 24 namespace gpu { 25 namespace gl { 26 27 // A collection of compile-time stats exposed via API. 28 struct CompilerStats {}; 29 30 struct ObjectStats { 31 // Number of allocated objects. 32 int32_t count = 0; 33 34 // Total bytes allocated. 35 int64_t total_bytes = 0; 36 }; 37 38 struct ObjectsStats { 39 ObjectStats buffers; 40 41 ObjectStats textures; 42 }; 43 44 // A collection of runtime-time stats exposed via API. 45 struct RuntimeStats { 46 ObjectsStats internal_objects; 47 48 ObjectsStats const_objects; 49 50 ObjectsStats external_objects; 51 }; 52 ToString(const ObjectStats & stats)53inline std::string ToString(const ObjectStats& stats) { 54 return absl::StrCat("count = ", stats.count, 55 ", total bytes = ", stats.total_bytes); 56 } 57 58 } // namespace gl 59 } // namespace gpu 60 } // namespace tflite 61 62 #endif // TENSORFLOW_LITE_DELEGATES_GPU_GL_STATS_H_ 63