AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ProfilingTools.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxTerrain/export.h>
20#include <agx/Referenced.h>
21#include <agx/Name.h>
23#include <agx/HashTable.h>
24#include <agx/HashVector.h>
25#include <iostream>
26#include <iomanip>
27
28namespace agxTerrain
29{
43
46 {
47 public:
48 explicit ScopeTimer(const agx::Name& name)
49 : m_timer(false)
50 , m_name(name)
51 {
52 m_timer.start();
53 }
54
55 protected:
56 virtual ~ScopeTimer()
57 {
58 m_timer.stop();
59 Profiler::registerTiming(m_name, m_timer.getTime());
60 }
61
64 };
65}
66
67#define SCOPE_PROFILER(a) agxTerrain::ScopeTimerRef ref = new agxTerrain::ScopeTimer(a);
68#define PRINT_TIMINGS() Profiler::printTimers();
69
70
71#if defined(USE_EXTENDED_TERRAIN_PROFILING) && USE_EXTENDED_TERRAIN_PROFILING
72 #define GET_TIMESTAMP(varname) agx::UInt64 varname = agx::Timer::getCurrentTick();
73 #define THREAD_LOG_ITEM( textname, var1, var2 ) agx::Thread::getCurrentThread()->reportSystemJob( var1, var2, textname );
74#else
75 #define GET_TIMESTAMP(varname)
76 #define THREAD_LOG_ITEM( textname, var1, var2 )
77#endif
78
79
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXTERRAIN_EXPORT
ScopeTimer(const agx::Name &name)
agx::HighAccuracyTimer m_timer
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition HashVector.h:41
The HighAccurayTimer class can replace the regular Timer class in high level applications where the n...
Representation of a name string.
Definition Name.h:33
Base class providing referencing counted objects.
Definition Referenced.h:120
AGXTERRAIN_EXPORT agx::Real & currentTime()
AGXTERRAIN_EXPORT TimingStorage & getStorage()
AGXTERRAIN_EXPORT void resetFile(const agx::String &filename)
AGXTERRAIN_EXPORT void registerTiming(const agx::Name &name, agx::Real value)
AGXTERRAIN_EXPORT void printTimers(const agx::String &title)
agx::HashVector< agx::Name, agx::Real > TimingStorage
std::pair< agx::Name, agx::Real > Bucket
AGXTERRAIN_EXPORT void clear()
AGXTERRAIN_EXPORT void printToFile(agx::Real time, const agx::String &filename)
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition Geometry.h:59
double Real
Definition Real.h:42