How to diagnose Ubuntu CPU spikes / IO wait?
There are two additional tools that you may want to check out:
-
IOTop
- LatencyTop
If you don't get what you want from those two tools, then you may need to use developer-tools like OProfile or Sysprof.
All the tools listed are available from ubuntu repositories
Regarding your observation with usb, from what I've heard, some usb-controllers behave a bit flaky with certain hardware which can cause Interrupt-storms, this could cause what you are describing. Try searching for usb interrupt storm and you will get quite a few hits.
I used htop for years and I finally found how to get Cpu Utilization by numbers and percentages, I am surprised I have missed this.
htop iowait image
Press F2
Arrow to "Available meters"
Highlight CPU average
F5 or F6 to add to column
Arrow to the item "CPU [Bar]"
Press F4 till you get "CPU [Text]"
You can also get IORates
F2->Columns->Available
Add IO_RATE, IO_READ_RATE, IO_WRITE_RATE
The best way to see this is to use a command-line application like top
or htop .
top
htop
You would need to be watching it for a while though until you see what causes the spike (if it is indeed a spike in CPU usage and not in i/o wait, which may not be caught in all cases).