Skip to content

Commit b8638f1

Browse files
committed
Update CPU+memory stats color warnings.
1 parent 9169c2a commit b8638f1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

SerialPrograms/Source/CommonFramework/VideoPipeline/Stats/MemoryUtilizationStats.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,22 @@ void MemoryUtilizationStats::update(){
2626

2727
double usage;
2828

29+
constexpr uint64_t GB = (uint64_t)1 << 30;
30+
2931
OverlayStatSnapshot system;
3032
if (get_stat(
3133
system.text, usage,
3234
"Sys: ",
3335
memory.total_system_memory,
3436
memory.total_used_system_memory
3537
)){
36-
if (usage >= 0.90){
38+
uint64_t free_memory = memory.process_physical_memory - memory.process_virtual_memory;
39+
40+
if (usage >= 0.90 || free_memory < 2*GB){
3741
system.color = COLOR_RED;
38-
}else if (usage >= 0.75){
42+
}else if (usage >= 0.75 || free_memory < 4*GB){
3943
system.color = COLOR_ORANGE;
40-
}else if (usage >= 0.50){
44+
}else if (usage >= 0.50 || free_memory < 8*GB){
4145
system.color = COLOR_YELLOW;
4246
}
4347
}
@@ -49,12 +53,14 @@ void MemoryUtilizationStats::update(){
4953
memory.process_virtual_memory,
5054
memory.process_physical_memory
5155
)){
52-
if (usage < 0.10){
53-
process.color = COLOR_RED;
54-
}else if (usage < 0.25){
55-
process.color = COLOR_ORANGE;
56-
}else if (usage < 0.50){
57-
process.color = COLOR_YELLOW;
56+
if (memory.process_virtual_memory > 1*GB){
57+
if (usage < 0.10){
58+
process.color = COLOR_RED;
59+
}else if (usage < 0.25){
60+
process.color = COLOR_ORANGE;
61+
}else if (usage < 0.50){
62+
process.color = COLOR_YELLOW;
63+
}
5864
}
5965
}
6066

0 commit comments

Comments
 (0)