mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	Fix calculation for docker container memory usage (#2167)
This commit is contained in:
		
							parent
							
								
									4a04347518
								
							
						
					
					
						commit
						7ea1d0dd47
					
				@ -11,5 +11,6 @@ export function calculateCPUPercent(stats) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function calculateUsedMemory(stats) {
 | 
			
		||||
  return stats.memory_stats.usage - (stats.memory_stats.stats.cache ?? 0)
 | 
			
		||||
  // see https://github.com/docker/cli/blob/dcc161076861177b5eef6cb321722520db3184e7/cli/command/container/stats_helpers.go#L239
 | 
			
		||||
  return stats.memory_stats.usage - (stats.memory_stats.total_inactive_file ?? stats.memory_stats.stats.inactive_file ?? 0)
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user