mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-24 01:29:57 +08:00
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:
@@ -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) \
|
||||
|
||||
Reference in New Issue
Block a user