Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::System Class Reference

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 voidalignedMemoryAlloc16 (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.
 

Detailed Description

System specific functionality.

The class System encapsulates system specific functions providing unified access across different operating systems. The provided functionality includes:

  • Query memory usage.
  • Access to high-perfomance counter under Windows and Cygwin.
  • Query CPU specific information.

Definition at line 121 of file System.h.

Member Function Documentation

◆ alignedMemoryAlloc16()

static void * ogdf::System::alignedMemoryAlloc16 ( size_t  size)
inlinestatic

Definition at line 129 of file System.h.

◆ alignedMemoryFree()

static void ogdf::System::alignedMemoryFree ( void p)
inlinestatic

Definition at line 144 of file System.h.

◆ availablePhysicalMemory()

static long long ogdf::System::availablePhysicalMemory ( )
static

Returns the size of available (free) physical memory (in bytes).

◆ cacheLineBytes()

static int ogdf::System::cacheLineBytes ( )
inlinestatic

Returns the number of bytes in a cache line.

Definition at line 270 of file System.h.

◆ cacheSizeKBytes()

static int ogdf::System::cacheSizeKBytes ( )
inlinestatic

Returns the L2-cache size (in KBytes).

Definition at line 267 of file System.h.

◆ cpuFeatures()

static int ogdf::System::cpuFeatures ( )
inlinestatic

Returns the bit vector describing the CPU features supported on current system.

Definition at line 259 of file System.h.

◆ cpuSupports()

static bool ogdf::System::cpuSupports ( CPUFeature  feature)
inlinestatic

Returns true if the CPU supports feature.

Definition at line 262 of file System.h.

◆ elapsedSeconds()

static double ogdf::System::elapsedSeconds ( const int64_t startCounter,
const int64_t endCounter 
)
static

Returns the elapsed time (in seconds) between startCounter and endCounter.

◆ getHPCounter()

static void ogdf::System::getHPCounter ( int64_t counter)
static

Returns the current value of the high-performance counter in counter.

◆ getProcessID()

static int ogdf::System::getProcessID ( )
static

Returns the process ID of the current process.

◆ init()

static void ogdf::System::init ( )
static

Static initilization routine (automatically called).

◆ memoryAllocatedByMalloc()

static size_t ogdf::System::memoryAllocatedByMalloc ( )
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.

◆ memoryAllocatedByMemoryManager()

static size_t ogdf::System::memoryAllocatedByMemoryManager ( )
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.

◆ memoryInFreelistOfMalloc()

static size_t ogdf::System::memoryInFreelistOfMalloc ( )
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.

◆ memoryInGlobalFreeListOfMemoryManager()

static size_t ogdf::System::memoryInGlobalFreeListOfMemoryManager ( )
static

Returns the amount of memory (in bytes) contained in the global free list of OGDF's memory manager.

◆ memoryInThreadFreeListOfMemoryManager()

static size_t ogdf::System::memoryInThreadFreeListOfMemoryManager ( )
static

Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager.

◆ memoryUsedByProcess()

static size_t ogdf::System::memoryUsedByProcess ( )
static

Returns the amount of memory (in bytes) allocated by the process.

◆ numberOfProcessors()

static int ogdf::System::numberOfProcessors ( )
inlinestatic

Returns the number of processors (cores) available on the current system.

Definition at line 273 of file System.h.

◆ pageSize()

static int ogdf::System::pageSize ( )
inlinestatic

Returns the page size of virtual memory (in bytes).

Definition at line 157 of file System.h.

◆ peakMemoryUsedByProcess()

static size_t ogdf::System::peakMemoryUsedByProcess ( )
static

Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only).

◆ physicalMemory()

static long long ogdf::System::physicalMemory ( )
static

Returns the total size of physical memory (in bytes).

◆ realTime()

static int64_t ogdf::System::realTime ( )
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.

◆ usedRealTime()

static int64_t ogdf::System::usedRealTime ( int64_t t)
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.

Member Data Documentation

◆ s_cacheLine

int ogdf::System::s_cacheLine
staticprivate

Bytes in a cache line.

Definition at line 280 of file System.h.

◆ s_cacheSize

int ogdf::System::s_cacheSize
staticprivate

Cache size in KBytes.

Definition at line 279 of file System.h.

◆ s_cpuFeatures

unsigned int ogdf::System::s_cpuFeatures
staticprivate

Supported CPU features.

Definition at line 278 of file System.h.

◆ s_HPCounterFrequency

int64_t ogdf::System::s_HPCounterFrequency
staticprivate

Frequency of high-performance counter.

Definition at line 285 of file System.h.

◆ s_numberOfProcessors

int ogdf::System::s_numberOfProcessors
staticprivate

Number of processors (cores) available.

Definition at line 281 of file System.h.

◆ s_pageSize

int ogdf::System::s_pageSize
staticprivate

The page size of virtual memory.

Definition at line 282 of file System.h.


The documentation for this class was generated from the following file: