mirror of
				https://github.com/datarhei/core.git
				synced 2025-10-31 11:26:52 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			370 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			370 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| //go:build !linux
 | |
| // +build !linux
 | |
| 
 | |
| package psutil
 | |
| 
 | |
| func (p *process) cpuTimes() (*cpuTimesStat, error) {
 | |
| 	times, err := p.proc.Times()
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 
 | |
| 	s := &cpuTimesStat{
 | |
| 		total:  cpuTotal(times),
 | |
| 		system: times.System,
 | |
| 		user:   times.User,
 | |
| 	}
 | |
| 
 | |
| 	s.other = s.total - s.system - s.user
 | |
| 	if s.other < 0.0001 {
 | |
| 		s.other = 0
 | |
| 	}
 | |
| 
 | |
| 	return s, nil
 | |
| }
 | 
