114#include "vtkCommonSystemModule.h"
121#include <sys/timeb.h>
122#include <sys/types.h>
125#include <sys/times.h>
126#include <sys/types.h>
137#define SELECT_MASK fd_set
143#define SELECT_MASK void
145#define SELECT_MASK int
149VTK_ABI_NAMESPACE_BEGIN
204 template <
typename... T>
211 std::string format = formatArg ? formatArg :
"";
215 vtkWarningWithObjectMacro(
nullptr,
217 << format <<
" is a printf format. The format will be "
218 <<
"converted to std::format. This conversion has been deprecated in 9.6.0");
221 static char event[4096];
222 auto result = vtk::format_to_n(event,
sizeof(event), format, std::forward<T>(args)...);
329 static timeb FirstWallTime;
330 static timeb CurrentWallTime;
332 static FILETIME FirstWallTime;
333 static FILETIME CurrentWallTime;
355 static void DumpEntry(ostream& os,
int index,
double time,
double deltatime,
int tick,
356 int deltatick,
const char* event);
391#define vtkTimerLogMacro(string) \
393 vtkTimerLog::FormatAndMarkEvent("Mark: In {:s}, line {:s}, class {:s}: {:s}", __FILE__, \
394 __LINE__, this->GetClassName(), string); \
a simple class to control print indentation
abstract base class for most VTK objects
Helper class to log time within scope.
vtkTimerLogScope(const char *eventString)
Timer support and logging.
static double GetUniversalTime()
Returns the elapsed number of seconds since 00:00:00 Coordinated Universal Time (UTC),...
static tms CurrentCpuTicks
static vtkTimerLogEntry::LogEntryType GetEventType(int i)
Programmatic access to events.
static void InsertTimedEvent(const char *EventString, double time, int cpuTicks)
Insert an event with a known wall time value (in seconds) and cpuTicks.
static timeval CurrentWallTime
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static const char * GetEventString(int i)
Programmatic access to events.
static vtkTimerLogEntry * GetEvent(int i)
static double GetEventWallTime(int i)
Programmatic access to events.
~vtkTimerLog() override=default
static int GetNumberOfEvents()
Programmatic access to events.
static int TicksPerSecond
static void CleanupLog()
Remove timer log.
static void MarkEndEvent(const char *EventString)
I want to time events, so I am creating this interface to mark events that have a start and an end.
static void SetMaxEntries(int a)
Set/Get the maximum number of entries allowed in the timer log.
static void FormatAndMarkEvent(const char *formatArg, T &&... args)
Record a timing event.
static void ResetLog()
Clear the timing table.
static void DumpLogWithIndentsAndPercentages(ostream *os)
void StopTimer()
Sets EndTime to the current time.
static void SetLogging(int v)
This flag will turn logging of events off or on.
static timeval FirstWallTime
static double GetCPUTime()
Returns the CPU time for this process On Win32 platforms this actually returns wall time.
static int GetEventIndent(int i)
Programmatic access to events.
static vtkTimerLog * New()
static void MarkEvent(const char *EventString)
Record a timing event and capture wall time and cpu ticks.
static void MarkEventInternal(const char *EventString, vtkTimerLogEntry::LogEntryType type, vtkTimerLogEntry *entry=nullptr)
Record a timing event and capture wall time and cpu ticks.
static int GetMaxEntries()
Set/Get the maximum number of entries allowed in the timer log.
double GetElapsedTime()
Returns the difference between StartTime and EndTime as a doubleing point value indicating the elapse...
static void MarkStartEvent(const char *EventString)
I want to time events, so I am creating this interface to mark events that have a start and an end.
static void DumpLogWithIndents(ostream *os, double threshold)
void StartTimer()
Set the StartTime to the current time.
static void DumpEntry(ostream &os, int index, double time, double deltatime, int tick, int deltatick, const char *event)
static void DumpLog(const char *filename)
Write the timing table out to a file.
VTKCOMMONCORE_EXPORT std::string printf_to_std_format(const std::string &printf_format)
Convert a printf style format to a std::format style format.
VTKCOMMONCORE_EXPORT bool is_printf_format(const std::string &format)
Check if the given string is a printf style format.
static vtkTimerLogCleanup vtkTimerLogCleanupInstance