STT-tensorflow/tensorflow/stream_executor/tpu/tpu_timer.h
Frank Chen 23e387975e Rename tpu_load_library to tpu_api_dlsym_initializer.
This better reflects what the load library module does.

PiperOrigin-RevId: 317763973
Change-Id: I66169394c2f1d77b260323cb81d76f0f4e167579
2020-06-22 17:45:58 -07:00

46 lines
1.6 KiB
C++

/* Copyright 2020 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_STREAM_EXECUTOR_TPU_TPU_TIMER_H_
#define TENSORFLOW_STREAM_EXECUTOR_TPU_TPU_TIMER_H_
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/tpu/tpu_api.h"
#include "tensorflow/stream_executor/stream_executor_internal.h"
#include "tensorflow/stream_executor/tpu/tpu_executor_c_api.h"
namespace tensorflow {
class TpuTimer : public ::stream_executor::internal::TimerInterface {
public:
explicit TpuTimer(SE_Timer* timer) : timer_(timer) {}
~TpuTimer() override {
tensorflow::tpu::ExecutorApiFn()->TpuTimer_FreeFn(timer_);
}
uint64 Microseconds() const override {
return tensorflow::tpu::ExecutorApiFn()->TpuTimer_MicrosecondsFn(timer_);
}
uint64 Nanoseconds() const override {
return tensorflow::tpu::ExecutorApiFn()->TpuTimer_NanosecondsFn(timer_);
}
private:
SE_Timer* timer_;
};
} // namespace tensorflow
#endif // TENSORFLOW_STREAM_EXECUTOR_TPU_TPU_TIMER_H_