backward-compatible Timer interface

This commit is contained in:
Matthias Hochsteger 2021-06-14 14:55:08 +02:00
parent 1b5aa71ad6
commit 4b40a7eb31

View File

@ -188,6 +188,8 @@ namespace ngcore
Timer( const std::string & name, TTracing, TTiming ) : timernr(Init(name)) { } Timer( const std::string & name, TTracing, TTiming ) : timernr(Init(name)) { }
[[deprecated ("Use Timer(name, NoTracing/NoTiming) instead")]] Timer( const std::string & name, int ) : timernr(Init(name)) {}
void SetName (const std::string & name) void SetName (const std::string & name)
{ {
NgProfiler::SetName (timernr, name); NgProfiler::SetName (timernr, name);
@ -276,6 +278,25 @@ namespace ngcore
void operator=(RegionTimer &&) = delete; void operator=(RegionTimer &&) = delete;
}; };
class [[deprecated("Use RegionTimer instead (now thread safe)")]] ThreadRegionTimer
{
size_t nr;
size_t tid;
public:
/// start timer
ThreadRegionTimer (size_t _nr, size_t _tid) : nr(_nr), tid(_tid)
{ NgProfiler::StartThreadTimer(nr, tid); }
/// stop timer
~ThreadRegionTimer ()
{ NgProfiler::StopThreadTimer(nr, tid); }
ThreadRegionTimer() = delete;
ThreadRegionTimer(ThreadRegionTimer &&) = delete;
ThreadRegionTimer(const ThreadRegionTimer &) = delete;
void operator=(const ThreadRegionTimer &) = delete;
void operator=(ThreadRegionTimer &&) = delete;
};
class RegionTracer class RegionTracer
{ {
int nr; int nr;