Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
system-info.cpp
Go to the documentation of this file.
1#include <ogdf/basic/basic.h>
2#include <ogdf/basic/System.h>
3
4using namespace ogdf;
5
6const char *yn(bool b)
7{
8 return b ? "yes" : "no";
9}
10
11int main()
12{
13 std::cout
14 << "---------------------------------------" << std::endl
15 << " System-specific information " << std::endl
16 << "---------------------------------------" << std::endl
17 << std::endl
18
19 << "Cache / processors:" << std::endl
20 << "-------------------" << std::endl
21 << "Processors: " << System::numberOfProcessors() << std::endl
22 << "L2-Cache: " << System::cacheSizeKBytes() << " KBytes" << std::endl
23 << "Cache-Line: " << System::cacheLineBytes() << " Bytes" << std::endl
24 << std::endl
25
26 << "Supported technologies:" << std::endl
27 << "-----------------------" << std::endl
28 << "MMX: " << yn(System::cpuSupports(CPUFeature::MMX)) << std::endl
29 << "SSE: " << yn(System::cpuSupports(CPUFeature::SSE)) << std::endl
30 << "SSE2: " << yn(System::cpuSupports(CPUFeature::SSE2)) << std::endl
31 << "SSE3: " << yn(System::cpuSupports(CPUFeature::SSE3)) << std::endl
32 << "SSSE3: " << yn(System::cpuSupports(CPUFeature::SSSE3)) << std::endl
33 << "SSE4.1: " << yn(System::cpuSupports(CPUFeature::SSE4_1)) << std::endl
34 << "SSE4.2: " << yn(System::cpuSupports(CPUFeature::SSE4_2)) << std::endl
35 << "VMX: " << yn(System::cpuSupports(CPUFeature::VMX)) << std::endl
36 << "SMX: " << yn(System::cpuSupports(CPUFeature::SMX)) << std::endl
37 << "EST: " << yn(System::cpuSupports(CPUFeature::EST)) << std::endl
38 << std::endl
39
40 << "Memory management:" << std::endl
41 << "------------------" << std::endl
42 << "Total physical memory: " << System::physicalMemory() / 1024 / 1024 << " MBytes" << std::endl
43 << " available: " << System::availablePhysicalMemory() / 1024 / 1024 << " MBytes" << std::endl
44 << " used by process: " << System::memoryUsedByProcess() / 1024 << " KBytes" << std::endl
45#if defined(OGDF_SYSTEM_WINDOWS) || defined(__CYGWIN__)
46 << " peak amount: " << System::peakMemoryUsedByProcess() / 1024 << " KBytes" << std::endl
47#endif
48 << std::endl
49 << "allocated by malloc: " << System::memoryAllocatedByMalloc() / 1024 << " KBytes" << std::endl
50 << " in freelist: " << System::memoryInFreelistOfMalloc() / 1024 << " KBytes" << std::endl
51 << std::endl
52 << "allocated by OGDF: " << System::memoryAllocatedByMemoryManager() / 1024 << " KBytes" << std::endl
53 << " in global freelist: " << System::memoryInGlobalFreeListOfMemoryManager() / 1024 << " KBytes" << std::endl
54 << " in thread freelist: " << System::memoryInThreadFreeListOfMemoryManager() / 1024 << " KBytes" << std::endl;
55
56 return 0;
57}
Decalration of System class which provides unified access to system information.
Basic declarations, included by all source files.
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 memoryAllocatedByMalloc()
Returns the amount of memory (in bytes) allocated on the heap (e.g., with malloc).
static size_t peakMemoryUsedByProcess()
Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only).
static size_t memoryUsedByProcess()
Returns the amount of memory (in bytes) allocated by the process.
static int numberOfProcessors()
Returns the number of processors (cores) available on the current system.
Definition System.h:273
static size_t memoryInThreadFreeListOfMemoryManager()
Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager.
static int cacheLineBytes()
Returns the number of bytes in a cache line.
Definition System.h:270
static size_t memoryAllocatedByMemoryManager()
Returns the amount of memory (in bytes) allocated by OGDF's memory manager.
static size_t memoryInFreelistOfMalloc()
Returns the amount of memory (in bytes) contained in free chunks on the heap.
static long long availablePhysicalMemory()
Returns the size of available (free) physical memory (in bytes).
static bool cpuSupports(CPUFeature feature)
Returns true if the CPU supports feature.
Definition System.h:262
static long long physicalMemory()
Returns the total size of physical memory (in bytes).
static int cacheSizeKBytes()
Returns the L2-cache size (in KBytes).
Definition System.h:267
The namespace for all OGDF objects.
const char * yn(bool b)
int main()