pt-stalk top CPU usage is useless

Bug #976179 reported by Daniel Nichter
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Committed
Medium
Carlos Salguero

Bug Description

pt-stalk runs "top -bn1" which means that a single iteration of top is ran. The result is that top can't calculate a useful CPU usage because it needs a basis of comparison. From https://bugzilla.redhat.com/show_bug.cgi?id=174619 we read:

The top command calculates %CPU by looking at the change in CPU time values between samples. When you first run it, it has no previous sample to compare to, so these initial values are the percentages since boot. It means you need at least two loops.

Michael discovered this because he specifically wanted historical CPU usage, knowing that it was running high, but the collected top output from pt-stalk was only showing 6% CPU usage--way below reality.

Perhaps we need to run "top -bn$OPT_RUN_TIME".

description: updated
Revision history for this message
Fernando Ipar (fipar) wrote :

top -bn$OPT_RUN_TIME worked like a charm to me, could we get that change in a future release?

Changed in percona-toolkit:
status: Confirmed → Triaged
assignee: nobody → Carlos Salguero (carlos-salguero)
importance: Undecided → Medium
milestone: none → 2.2.21
tags: added: pt89
Changed in percona-toolkit:
status: Triaged → Fix Committed
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-513

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.