Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

system-info.cpp
Go to the documentation of this file.
1 #include <ogdf/basic/basic.h>
2 #include <ogdf/basic/System.h>
3 
4 using namespace ogdf;
5 
6 const char *yn(bool b)
7 {
8  return b ? "yes" : "no";
9 }
10 
11 int 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 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::System::physicalMemory
static long long physicalMemory()
Returns the total size of physical memory (in bytes).
System.h
Decalration of System class which provides unified access to system information.
main
int main()
Definition: system-info.cpp:11
ogdf::System::peakMemoryUsedByProcess
static size_t peakMemoryUsedByProcess()
Returns the maximal amount of memory (in bytes) used by the process (Windows/Cygwin only).
ogdf::CPUFeature::SSSE3
@ SSSE3
Supplemental Streaming SIMD Extensions 3 (SSSE3)
ogdf::CPUFeature::EST
@ EST
Enhanced Intel SpeedStep Technology.
ogdf::CPUFeature::SSE4_2
@ SSE4_2
Streaming SIMD Extensions 4.2 (SSE4.2)
ogdf::CPUFeature::SMX
@ SMX
Safer Mode Extensions.
ogdf::System::memoryUsedByProcess
static size_t memoryUsedByProcess()
Returns the amount of memory (in bytes) allocated by the process.
ogdf::CPUFeature::VMX
@ VMX
Virtual Machine Extensions.
ogdf::System::memoryInGlobalFreeListOfMemoryManager
static size_t memoryInGlobalFreeListOfMemoryManager()
Returns the amount of memory (in bytes) contained in the global free list of OGDF's memory manager.
ogdf::CPUFeature::SSE4_1
@ SSE4_1
Streaming SIMD Extensions 4.1 (SSE4.1)
ogdf::CPUFeature::SSE3
@ SSE3
Streaming SIMD Extensions 3 (SSE3)
yn
const char * yn(bool b)
Definition: system-info.cpp:6
ogdf::System::cacheSizeKBytes
static int cacheSizeKBytes()
Returns the L2-cache size (in KBytes).
Definition: System.h:267
ogdf::CPUFeature::SSE2
@ SSE2
Streaming SIMD Extensions 2 (SSE2)
ogdf::System::memoryAllocatedByMemoryManager
static size_t memoryAllocatedByMemoryManager()
Returns the amount of memory (in bytes) allocated by OGDF's memory manager.
ogdf::System::cacheLineBytes
static int cacheLineBytes()
Returns the number of bytes in a cache line.
Definition: System.h:270
basic.h
Basic declarations, included by all source files.
ogdf::System::memoryInThreadFreeListOfMemoryManager
static size_t memoryInThreadFreeListOfMemoryManager()
Returns the amount of memory (in bytes) contained in the thread's free list of OGDF's memory manager.
ogdf::System::memoryInFreelistOfMalloc
static size_t memoryInFreelistOfMalloc()
Returns the amount of memory (in bytes) contained in free chunks on the heap.
ogdf::CPUFeature::MMX
@ MMX
Intel MMX Technology.
ogdf::System::memoryAllocatedByMalloc
static size_t memoryAllocatedByMalloc()
Returns the amount of memory (in bytes) allocated on the heap (e.g., with malloc).
ogdf::System::cpuSupports
static bool cpuSupports(CPUFeature feature)
Returns true if the CPU supports feature.
Definition: System.h:262
ogdf::CPUFeature::SSE
@ SSE
Streaming SIMD Extensions (SSE)
ogdf::System::availablePhysicalMemory
static long long availablePhysicalMemory()
Returns the size of available (free) physical memory (in bytes).
ogdf::System::numberOfProcessors
static int numberOfProcessors()
Returns the number of processors (cores) available on the current system.
Definition: System.h:273