Skip to content

Commit

Permalink
Fix when subtracting from a smaller value (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
monicasarbu authored and tsg committed Jun 30, 2016
1 parent 7be94c3 commit 6ab611c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Template, add newest changes here

=== Beats version HEAD
https://github.com/elastic/beats/compare/v1.2.3...1.3[Check the HEAD diff]
https://github.com/elastic/beats/compare/v1.3.0...1.3[Check the HEAD diff]

==== Breaking changes

Expand Down Expand Up @@ -87,6 +87,7 @@ https://github.com/elastic/beats/compare/v1.2.2...v1.2.3[View commits]
*Topbeat*
- Fix high CPU usage when using filtering under Windows. {pull}1598[1598]
- Fix high values of proc.cpu.user_p. {pull}1928[1928]
*Filebeat*
Expand Down
2 changes: 1 addition & 1 deletion topbeat/beat/topbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func (t *Topbeat) addProcCpuPercentage(proc *Process) {
oproc, ok := t.procsMap[proc.Pid]
if ok {

delta_proc := (proc.Cpu.User - oproc.Cpu.User) + (proc.Cpu.System - oproc.Cpu.System)
delta_proc := int64(proc.Cpu.User-oproc.Cpu.User) + int64(proc.Cpu.System-oproc.Cpu.System)
delta_time := proc.ctime.Sub(oproc.ctime).Nanoseconds() / 1e6 // in milliseconds
perc := float64(delta_proc) / float64(delta_time)

Expand Down

0 comments on commit 6ab611c

Please sign in to comment.