Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
StressPerformanceTest Class Reference
Inheritance diagram for StressPerformanceTest:
Inheritance graph
Collaboration diagram for StressPerformanceTest:
Collaboration graph

Protected Member Functions

void SetUp () override
 
void TearDown () override
 
size_t GetCurrentMemoryUsage ()
 

Protected Attributes

std::filesystem::path test_dir_
 
size_t initial_memory_
 

Detailed Description

Definition at line 79 of file test_stress_performance.cpp.

Member Function Documentation

◆ GetCurrentMemoryUsage()

size_t StressPerformanceTest::GetCurrentMemoryUsage ( )
inlineprotected

Definition at line 105 of file test_stress_performance.cpp.

105 {
106 // Platform-specific memory usage retrieval
107 // This is a simplified version - real implementation would use
108 // platform-specific APIs (e.g., /proc/self/status on Linux)
109 return 0; // Placeholder
110 }

Referenced by SetUp(), and TearDown().

Here is the caller graph for this function:

◆ SetUp()

void StressPerformanceTest::SetUp ( )
inlineoverrideprotected

Definition at line 81 of file test_stress_performance.cpp.

81 {
83 test_dir_ = std::filesystem::temp_directory_path() / "stress_test";
84 std::filesystem::create_directories(test_dir_);
85 }
std::filesystem::path test_dir_

References GetCurrentMemoryUsage(), initial_memory_, and test_dir_.

Here is the call graph for this function:

◆ TearDown()

void StressPerformanceTest::TearDown ( )
inlineoverrideprotected

Definition at line 87 of file test_stress_performance.cpp.

87 {
88 // Check for memory leaks
89 auto final_memory = GetCurrentMemoryUsage();
90 auto memory_diff = final_memory - initial_memory_;
91
92 // Allow some memory growth but flag significant leaks
93 if (memory_diff > 10 * 1024 * 1024) { // 10MB threshold
94 std::cerr << "Warning: Potential memory leak detected. "
95 << "Memory increased by " << memory_diff / (1024 * 1024)
96 << " MB" << std::endl;
97 }
98
99 // Cleanup
100 if (std::filesystem::exists(test_dir_)) {
101 std::filesystem::remove_all(test_dir_);
102 }
103 }

References GetCurrentMemoryUsage(), initial_memory_, and test_dir_.

Here is the call graph for this function:

Member Data Documentation

◆ initial_memory_

size_t StressPerformanceTest::initial_memory_
protected

Definition at line 113 of file test_stress_performance.cpp.

Referenced by SetUp(), and TearDown().

◆ test_dir_

std::filesystem::path StressPerformanceTest::test_dir_
protected

Definition at line 112 of file test_stress_performance.cpp.

Referenced by SetUp(), and TearDown().


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