Add time statis functions for fastdeploy model (#96)

* Add time statis functions for fastdeploy model

* Create README.md

* Update README.md

* Update fastdeploy_model.cc

* Update fastdeploy_model.cc
This commit is contained in:
Jason
2022-08-11 14:06:43 +08:00
committed by GitHub
parent 7ccb0c9ff5
commit a7cf09354e
8 changed files with 112 additions and 20 deletions
+17
View File
@@ -43,13 +43,30 @@ class FASTDEPLOY_DECL FastDeployModel {
return runtime_initialized_ && initialized;
}
virtual void EnableRecordTimeOfRuntime() {
time_of_runtime_.clear();
std::vector<double>().swap(time_of_runtime_);
enable_record_time_of_runtime_ = true;
}
virtual void DisableRecordTimeOfRuntime() {
enable_record_time_of_runtime_ = false;
}
virtual void PrintStatisInfoOfRuntime();
virtual void EnableDebug();
virtual bool DebugEnabled();
private:
std::unique_ptr<Runtime> runtime_;
bool runtime_initialized_ = false;
// whether to record inference time
bool enable_record_time_of_runtime_ = false;
bool debug_ = false;
// record inference time for backend
std::vector<double> time_of_runtime_;
};
#define TIMERECORD_START(id) \