prevent negative cpu percentage
This commit is contained in:
		
							parent
							
								
									55e669634c
								
							
						
					
					
						commit
						a168c9c0f6
					
				@ -57,6 +57,10 @@ public class MultiProcCpu extends ProcCpu {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        cpu.percent = ((cpu.total - otime) / diff);
 | 
			
		||||
        if (cpu.percent < 0.0) {
 | 
			
		||||
            //counter wrapped
 | 
			
		||||
            cpu.percent = (0.0 - cpu.percent);
 | 
			
		||||
        }
 | 
			
		||||
        if (cpu.percent >= 1.0) {
 | 
			
		||||
            cpu.percent = 0.99;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user