O'Reilly logo

PostgreSQL High Performance Cookbook by Dinesh Kumar, Chitij Chauhan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tracking historical CPU usage

In this recipe, we are going to show how to use the sar command in combination with various switches to analyze historical CPU load during some time in the past.

Getting ready

The commands used in this recipe have been performed on a CentOS Linux machine. The command output may vary in other Linux and Unix-based operating systems.

How to do it...

The sar command when used with the -u switch is used to display CPU statistics. When used this way, the sar command will report on the current day's activities.

If we are looking to analyze the CPU statistic over some time period in the past we would need to use the -f switch in conjunction with the -u switch of the sar command. The -f option is followed by the files that sar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required