Open
Graph Drawing
Framework

 v.2012.05
 

ogdf::System Class Reference

System specific functionality. More...

#include <ogdf/basic/System.h>

List of all members.

Static Public Member Functions

static void init ()
 Static initilization routine (automatically called).
Memory usage

These methods allow to query the amount of physical memory, as well as the current memory usage by both the process and OGDF's internal memory manager.

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 (LARGE_INTEGER &counter)
 Returns the current value of the high-performance counter in counter.
static double elapsedSeconds (const LARGE_INTEGER &startCounter, const LARGE_INTEGER &endCounter)
 Returns the elapsed time (in seconds) between startCounter and endCounter.
static __int64 usedRealTime (__int64 &t)
 Returns the elapsed time (in milliseconds) between t and now.
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 unsigned int s_cpuFeatures
 Supported CPU features.
static int s_cacheSize
 Cache size in KBytes.
static int s_cacheLine
 Bytes in a cache line.
static int s_numberOfProcessors
 Number of processors (cores) available.
static int s_pageSize
 The page size of virtual memory.
static LARGE_INTEGER s_HPCounterFrequency
 Frequency of high-performance counter.

Detailed Description

System specific functionality.

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

  • Access to file system functionality (listing directories etc.).
  • Query memory usage.
  • Access to high-perfomance counter under Windows and Cygwin.
  • Query CPU specific information.

Definition at line 155 of file System.h.


Member Function Documentation

static void* ogdf::System::alignedMemoryAlloc16 ( size_t  size) [inline, static]

Definition at line 167 of file System.h.

static void ogdf::System::alignedMemoryFree ( void *  p) [inline, static]

Definition at line 179 of file System.h.

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

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

static int ogdf::System::cacheLineBytes ( ) [inline, static]

Returns the number of bytes in a cache line.

Definition at line 287 of file System.h.

static int ogdf::System::cacheSizeKBytes ( ) [inline, static]

Returns the L2-cache size (in KBytes).

Definition at line 284 of file System.h.

static int ogdf::System::cpuFeatures ( ) [inline, static]

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

Definition at line 276 of file System.h.

static bool ogdf::System::cpuSupports ( CPUFeature  feature) [inline, static]

Returns true if the CPU supports feature.

Definition at line 279 of file System.h.

static double ogdf::System::elapsedSeconds ( const LARGE_INTEGER &  startCounter,
const LARGE_INTEGER &  endCounter 
) [static]

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

static void ogdf::System::getHPCounter ( LARGE_INTEGER &  counter) [static]

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

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

Static initilization routine (automatically called).

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.

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

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.

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

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

static int ogdf::System::numberOfProcessors ( ) [inline, static]

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

Definition at line 290 of file System.h.

static int ogdf::System::pageSize ( ) [inline, static]

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

Definition at line 188 of file System.h.

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

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

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

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

static __int64 ogdf::System::usedRealTime ( __int64 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

int ogdf::System::s_cacheLine [static, private]

Bytes in a cache line.

Definition at line 297 of file System.h.

int ogdf::System::s_cacheSize [static, private]

Cache size in KBytes.

Definition at line 296 of file System.h.

unsigned int ogdf::System::s_cpuFeatures [static, private]

Supported CPU features.

Definition at line 295 of file System.h.

LARGE_INTEGER ogdf::System::s_HPCounterFrequency [static, private]

Frequency of high-performance counter.

Definition at line 302 of file System.h.

int ogdf::System::s_numberOfProcessors [static, private]

Number of processors (cores) available.

Definition at line 298 of file System.h.

int ogdf::System::s_pageSize [static, private]

The page size of virtual memory.

Definition at line 299 of file System.h.


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