MeshLib C++ Docs
Loading...
Searching...
No Matches
MRTimeRecord.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRLog.h"
5#include "MRPch/MRBindingMacros.h"
6#include <chrono>
7#include <map>
8#include <string>
9
10namespace MR
11{
12
15
17{
18 int count = 0;
19 std::chrono::nanoseconds time = {};
20 double seconds() const { return time.count() * 1e-9; }
21};
22
24{
25 TimeRecord* parent = nullptr;
26 std::map<std::string, TimeRecord> children;
27
29 MRMESH_API std::chrono::nanoseconds childTime() const;
30 std::chrono::nanoseconds myTime() const { return time - childTime(); }
31
32 double mySeconds() const { return myTime().count() * 1e-9; }
33};
34
36{
37 const char * threadName = nullptr;
38 std::chrono::time_point<std::chrono::high_resolution_clock> started = std::chrono::high_resolution_clock::now();
39 bool printTreeInDtor = true;
40 double minTimeSec = 0.1;
42 std::shared_ptr<spdlog::logger> loggerHandle = Logger::instance().getSpdLogger();
43 MRMESH_API ThreadRootTimeRecord( const char * tdName );
46};
47
50
53
55
56}
#define MRMESH_API
Definition MRMeshFwd.h:80
static Logger & instance()
const std::shared_ptr< spdlog::logger > & getSpdLogger() const
store this pointer if need to prolong logger life time (necessary to log something from destructors)
MR_BIND_IGNORE void unregisterThreadRootTimeRecord(ThreadRootTimeRecord &root)
un-installs given record in the current thread
MR_BIND_IGNORE void registerThreadRootTimeRecord(ThreadRootTimeRecord &root)
installs given record in the current thread (no record must be installed before)
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRTimeRecord.h:17
int count
Definition MRTimeRecord.h:18
double seconds() const
Definition MRTimeRecord.h:20
std::chrono::nanoseconds time
Definition MRTimeRecord.h:19
Definition MRTimeRecord.h:36
ThreadRootTimeRecord(const char *tdName)
bool printTreeInDtor
Definition MRTimeRecord.h:39
std::chrono::time_point< std::chrono::high_resolution_clock > started
Definition MRTimeRecord.h:38
const char * threadName
Definition MRTimeRecord.h:37
std::shared_ptr< spdlog::logger > loggerHandle
prolong logger life
Definition MRTimeRecord.h:42
double minTimeSec
Definition MRTimeRecord.h:40
Definition MRTimeRecord.h:24
double mySeconds() const
Definition MRTimeRecord.h:32
std::chrono::nanoseconds childTime() const
returns summed time of immediate children
TimeRecord * parent
Definition MRTimeRecord.h:25
std::chrono::nanoseconds myTime() const
Definition MRTimeRecord.h:30
std::map< std::string, TimeRecord > children
Definition MRTimeRecord.h:26