Skip to content

Commit

Permalink
[perf] change timestamp get mothed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Aug 21, 2023
1 parent 33f970a commit 128f4a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphElement/GGroup/GSome/GSome.inl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CStatus GSome<TriggerNum>::run() {
return left_num_ <= 0 || cur_status_.isErr();
});

status = cur_status_; // 出错的话,赋值到外部去,让上游知道。
status = cur_status_;
CGRAPH_FUNCTION_END
}

Expand Down
6 changes: 3 additions & 3 deletions tutorial/MyGAspect/MyTimerAspect.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ class MyTimerAspect : public CGraph::GAspect {
* 实现计时切面逻辑,记录 run() 方法的执行耗时信息
*/
CStatus beginRun() override {
start_ts_ = std::chrono::high_resolution_clock::now();
start_ts_ = std::chrono::steady_clock::now();
return CStatus();
}

CVoid finishRun(const CStatus& curStatus) override {
std::chrono::duration<double, std::milli> span = std::chrono::high_resolution_clock::now() - start_ts_;
std::chrono::duration<double, std::milli> span = std::chrono::steady_clock::now() - start_ts_;
CGraph::CGRAPH_ECHO("----> [MyTimerAspect] [%s] time cost is : [%0.2lf] ms",
this->getName().c_str(), span.count());
}

private:
std::chrono::high_resolution_clock::time_point start_ts_;
std::chrono::steady_clock::time_point start_ts_;
};

#endif //CGRAPH_MYTIMERASPECT_H

0 comments on commit 128f4a0

Please sign in to comment.