System specific functionality. More...
#include <ogdf/basic/System.h>
Static Public Member Functions | |
static void | init () |
Static initilization routine (automatically called). More... | |
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). More... | |
static long long | physicalMemory () |
Returns the total size of physical memory (in bytes). More... | |
static long long | availablePhysicalMemory () |
Returns the size of available (free) physical memory (in bytes). More... | |
static size_t | memoryUsedByProcess () |
Returns the amount of memory (in bytes) allocated by the process. More... | |
static size_t | peakMemoryUsedByProcess () |
Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only). More... | |
static size_t | memoryAllocatedByMemoryManager () |
Returns the amount of memory (in bytes) allocated by OGDF's memory manager. More... | |
static size_t | memoryInGlobalFreeListOfMemoryManager () |
Returns the amount of memory (in bytes) contained in the global free list of OGDF's memory manager. More... | |
static size_t | memoryInThreadFreeListOfMemoryManager () |
Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager. More... | |
static size_t | memoryAllocatedByMalloc () |
Returns the amount of memory (in bytes) allocated on the heap (e.g., with malloc). More... | |
static size_t | memoryInFreelistOfMalloc () |
Returns the amount of memory (in bytes) contained in free chunks on the heap. More... | |
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 . More... | |
static double | elapsedSeconds (const int64_t &startCounter, const int64_t &endCounter) |
Returns the elapsed time (in seconds) between startCounter and endCounter . More... | |
static int64_t | usedRealTime (int64_t &t) |
Returns the elapsed time (in milliseconds) between t and now. More... | |
static int64_t | realTime () |
Returns the current time point of the real time wall clock. More... | |
Process information | |
static int | getProcessID () |
Returns the process ID of the current process. More... | |
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. More... | |
static bool | cpuSupports (CPUFeature feature) |
Returns true if the CPU supports feature . More... | |
static int | cacheSizeKBytes () |
Returns the L2-cache size (in KBytes). More... | |
static int | cacheLineBytes () |
Returns the number of bytes in a cache line. More... | |
static int | numberOfProcessors () |
Returns the number of processors (cores) available on the current system. More... | |
Static Private Attributes | |
static int | s_cacheLine |
Bytes in a cache line. More... | |
static int | s_cacheSize |
Cache size in KBytes. More... | |
static unsigned int | s_cpuFeatures |
Supported CPU features. More... | |
static int64_t | s_HPCounterFrequency |
Frequency of high-performance counter. More... | |
static int | s_numberOfProcessors |
Number of processors (cores) available. More... | |
static int | s_pageSize |
The page size of virtual memory. More... | |
System specific functionality.
The class System encapsulates system specific functions providing unified access across different operating systems. The provided functionality includes:
|
inlinestatic |
|
inlinestatic |
|
static |
Returns the size of available (free) physical memory (in bytes).
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
Returns the elapsed time (in seconds) between startCounter
and endCounter
.
|
static |
Returns the current value of the high-performance counter in counter
.
|
static |
Returns the process ID of the current process.
|
static |
Static initilization routine (automatically called).
|
static |
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.
|
static |
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.
|
static |
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.
|
static |
Returns the amount of memory (in bytes) contained in the global free list of OGDF's memory manager.
|
static |
Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager.
|
static |
Returns the amount of memory (in bytes) allocated by the process.
|
inlinestatic |
|
inlinestatic |
|
static |
Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only).
|
static |
Returns the total size of physical memory (in bytes).
|
static |
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.
|
static |
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 |
|
staticprivate |