Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_timeit.hh')
-rw-r--r--source/blender/blenlib/BLI_timeit.hh22
1 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/blenlib/BLI_timeit.hh b/source/blender/blenlib/BLI_timeit.hh
index 711a7f16ab4..f0968587597 100644
--- a/source/blender/blenlib/BLI_timeit.hh
+++ b/source/blender/blenlib/BLI_timeit.hh
@@ -23,8 +23,7 @@
#include "BLI_sys_types.h"
-namespace blender {
-namespace Timeit {
+namespace blender::timeit {
using Clock = std::chrono::steady_clock;
using TimePoint = Clock::time_point;
@@ -34,29 +33,28 @@ void print_duration(Nanoseconds duration);
class ScopedTimer {
private:
- std::string m_name;
- TimePoint m_start;
+ std::string name_;
+ TimePoint start_;
public:
- ScopedTimer(std::string name) : m_name(std::move(name))
+ ScopedTimer(std::string name) : name_(std::move(name))
{
- m_start = Clock::now();
+ start_ = Clock::now();
}
~ScopedTimer()
{
- TimePoint end = Clock::now();
- Nanoseconds duration = end - m_start;
+ const TimePoint end = Clock::now();
+ const Nanoseconds duration = end - start_;
- std::cout << "Timer '" << m_name << "' took ";
+ std::cout << "Timer '" << name_ << "' took ";
print_duration(duration);
std::cout << '\n';
}
};
-} // namespace Timeit
-} // namespace blender
+} // namespace blender::timeit
-#define SCOPED_TIMER(name) blender::Timeit::ScopedTimer scoped_timer(name)
+#define SCOPED_TIMER(name) blender::timeit::ScopedTimer scoped_timer(name)
#endif /* __BLI_TIMEIT_HH__ */