1 /* Copyright 2020 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_CORE_TPU_KERNELS_TPU_COMPILATION_METRICS_H_ 16 #define TENSORFLOW_CORE_TPU_KERNELS_TPU_COMPILATION_METRICS_H_ 17 18 #include "absl/strings/string_view.h" 19 #include "tensorflow/core/platform/types.h" 20 21 namespace tensorflow { 22 namespace tpu { 23 24 // Tracks Tpu compilation and cache metrics. 25 class TpuCompilationMetrics { 26 public: 27 // Increments the number of cache lookup count. 28 static void IncrementCacheLookupCount(bool is_cache_hit, 29 absl::string_view session_name); 30 31 // Sets the total count of cache entries. 32 static void SetCacheEntryCount(int64_t count); 33 34 // Increments number of compilation. 35 static void IncrementCompilationCount(absl::string_view session_name); 36 }; 37 38 } // namespace tpu 39 } // namespace tensorflow 40 41 #endif // TENSORFLOW_CORE_TPU_KERNELS_TPU_COMPILATION_METRICS_H_ 42