System specific functionality. More...
#include <ogdf/basic/System.h>
Static Public Member Functions | |
static void | init () |
Static initilization routine (automatically called). | |
Memory | |
These methods allow to allocate aligned memory and to query the amount of memory used. | |
static void * | alignedMemoryAlloc16 (size_t size) |
static void | alignedMemoryFree (void *p) |
static int | pageSize () |
Returns the page size of virtual memory (in bytes). | |
static long long | physicalMemory () |
Returns the total size of physical memory (in bytes). | |
static long long | availablePhysicalMemory () |
Returns the size of available (free) physical memory (in bytes). | |
static size_t | memoryUsedByProcess () |
Returns the amount of memory (in bytes) allocated by the process. | |
static size_t | peakMemoryUsedByProcess () |
Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only). | |
static size_t | memoryAllocatedByMemoryManager () |
Returns the amount of memory (in bytes) allocated by OGDF's memory manager. | |
static size_t | memoryInGlobalFreeListOfMemoryManager () |
Returns the amount of memory (in bytes) contained in the global free list of OGDF's memory manager. | |
static size_t | memoryInThreadFreeListOfMemoryManager () |
Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager. | |
static size_t | memoryAllocatedByMalloc () |
Returns the amount of memory (in bytes) allocated on the heap (e.g., with malloc). | |
static size_t | memoryInFreelistOfMalloc () |
Returns the amount of memory (in bytes) contained in free chunks on the heap. | |
Measuring time | |
These methods provide various ways to measure time. The high-performance counter (Windows and Cygwin only) can be used to measure real time periods with a better resolution than the standard system time function. | |
static void | getHPCounter (int64_t &counter) |
Returns the current value of the high-performance counter in counter . | |
static double | elapsedSeconds (const int64_t &startCounter, const int64_t &endCounter) |
Returns the elapsed time (in seconds) between startCounter and endCounter . | |
static int64_t | usedRealTime (int64_t &t) |
Returns the elapsed time (in milliseconds) between t and now. | |
static int64_t | realTime () |
Returns the current time point of the real time wall clock. | |
Process information | |
static int | getProcessID () |
Returns the process ID of the current process. | |
Processor information | |
These methods allow to query information about the current processor such as supported instruction sets (e.g., SSE extensions), cache size, and number of installed processors. | |
static int | cpuFeatures () |
Returns the bit vector describing the CPU features supported on current system. | |
static bool | cpuSupports (CPUFeature feature) |
Returns true if the CPU supports feature . | |
static int | cacheSizeKBytes () |
Returns the L2-cache size (in KBytes). | |
static int | cacheLineBytes () |
Returns the number of bytes in a cache line. | |
static int | numberOfProcessors () |
Returns the number of processors (cores) available on the current system. | |
Static Private Attributes | |
static int | s_cacheLine |
Bytes in a cache line. | |
static int | s_cacheSize |
Cache size in KBytes. | |
static unsigned int | s_cpuFeatures |
Supported CPU features. | |
static int64_t | s_HPCounterFrequency |
Frequency of high-performance counter. | |
static int | s_numberOfProcessors |
Number of processors (cores) available. | |
static int | s_pageSize |
The page size of virtual memory. | |
System specific functionality.
The class System encapsulates system specific functions providing unified access across different operating systems. The provided functionality includes:
Returns the size of available (free) physical memory (in bytes).
|
inlinestatic |
|
static |
Returns the elapsed time (in seconds) between startCounter
and endCounter
.
Returns the current value of the high-performance counter in counter
.
Returns the amount of memory (in bytes) allocated on the heap (e.g., with malloc).
This refers to dynamically allocated memory, e.g., memory allocated with malloc() or new.
Returns the amount of memory (in bytes) allocated by OGDF's memory manager.
The memory manager allocates blocks of a fixed size from the system (via malloc()) and makes it available in its free lists (for allocating small pieces of memory. The returned value is the total amount of memory allocated from the system; the amount of memory currently allocated from the user is memoryAllocatedByMemoryManager() - memoryInFreelistOfMemoryManager().
Keep in mind that the memory manager never releases memory to the system before its destruction.
Returns the amount of memory (in bytes) contained in free chunks on the heap.
This refers to memory that has been deallocated with free() or delete, but has not yet been returned to the operating system.
Returns the amount of memory (in bytes) contained in the global free list of OGDF's memory manager.
Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager.
Returns the amount of memory (in bytes) allocated by the process.
Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only).
Returns the total size of physical memory (in bytes).
Returns the current time point of the real time wall clock.
The start point of time points is system specific. The differences of two time points returned by this function represent elapsed real time in milliseconds.
Returns the elapsed time (in milliseconds) between t
and now.
The functions sets t
to to the current time. Usually, you first call usedRealTime(t
) to query the start time t
, and determine the elapsed time after performing some computation by calling usedRealTime(t) again; this time the return value gives you the elapsed time in milliseconds.
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |