Schedtop utility

From RTwiki
Revision as of 11:15, 22 October 2008 by Gregory.haskins (Talk | contribs)

Jump to: navigation, search

Contents

Concept

scheduler statistics visualization tool

This utility will process various scheduler related statistics (e.g. /proc/schedstat) such that the "busiest" stats (greatest delta) will bubble up to the top similar to the ubiquitous "top" utility. It can alternately be sorted by the stat's value, or by name. Stats can be inclusively or exclusively filtered based on reg-ex pattern matching.

Usage

Running

schedtop <options>

 -h [ --help    ]         produces help message
 -p [ --period  ] arg     refresh period (default=1s)
 -i [ --include ] arg     reg-ex inclusive filter (default=".*")
 -x [ --exclude ] arg     reg-ex exclusive filter (default="^$")
 -s [ --sort    ] arg     sort-by: n=name, v=value, d=delta (default='d')

Press Cntrl-C to exit the utility

Example

To filter out any stats with "sched_info" or "imbalance" in the name, use the exclude filter with an OR operator

schedtop -x 'sched_info|imbalance'

Kernel Configuration

You need to enable the scheduler statistics (CONFIG_SCHEDSTATS=y) in your .config. This utility will only work with v14 of the stats (current as of this writing)

RPM Repositories

A variety of pre-built x86 platforms can be found available as RPMs in YUM repositories created by the OpenSUSE Build Service:

http://download.opensuse.org/repositories/home:/ghaskins

You can download the .rpm directly, or alternatively add the repository to your system to receive updates when new versions of schedtop are released automatically.

Direct links to a subset of the available repos:

OpenSUSE 11 x86_64 i586
OpenSUSE 10.3 x86_64 i586
SUSE Linux Enterprise 10 x86_64 i586
RHEL 5 x86_64 i586
Fedora 9 x86_64 i586
Mandriva-2008 x86_64 i586

Source Code

GIT Tree

   git clone git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/schedtop.git

Tarball

   ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz

Browse the source

gitweb on git.kernel.org

Building

Note: You need to have the development version of boost installed as a pre-requisite (often called "boost-dev" package).

Manual Binary

 ghaskins@dev:~> cd sandbox/git/schedtop/
 ghaskins@dev:~/sandbox/git/schedtop> make
 Compiling (C++) schedtop.cc to obj/x86_64/schedtop.o
 g++ -g -O0  -c -o obj/x86_64/schedtop.o schedtop.cc
 Linking obj/x86_64/schedtop
 g++ -g -O0  -o obj/x86_64/schedtop obj/x86_64/schedtop.o  -lboost_regex -lboost_program_options -lboost_filesystem -lncurses
 ghaskins@dev:~/sandbox/git/schedtop> ls -la obj/x86_64/schedtop
 -rwxr-xr-x 1 ghaskins users 1183285 2008-10-22 06:51 obj/x86_64/schedtop

RPM

Generate a .src.rpm

 ghaskins@dev:~> cd sandbox/git/schedtop/
 ghaskins@dev:~/sandbox/git/schedtop> make srcrpm
 tar -c --exclude=.git --exclude=*.spec --exclude=*~ --exclude=obj * | (cd obj/x86_64/schedtop-0.5; tar xf -)
 (cd obj/x86_64; tar cvz schedtop-0.5) > obj/x86_64/schedtop-0.5.tar.gz
 schedtop-0.5/
 schedtop-0.5/schedtop.spec
 schedtop-0.5/schedtop.cc
 schedtop-0.5/Makefile
 rpmbuild -ts obj/x86_64/schedtop-0.5.tar.gz
 Wrote: /usr/src/packages/SRPMS/schedtop-0.5-1.src.rpm

Generate a binary .rpm

We use the .src.rpm output from the previous example as input to the rpmbuild --rebuild command.

 ghaskins@dev:~/sandbox/git/schedtop> rpmbuild --rebuild /usr/src/packages/SRPMS/schedtop-0.5-1.src.rpm
 Installing /usr/src/packages/SRPMS/schedtop-0.5-1.src.rpm
 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.39808
 + umask 022
 + cd /usr/src/packages/BUILD
 + cd /usr/src/packages/BUILD
 + rm -rf schedtop-0.5
 + /usr/bin/gzip -dc /usr/src/packages/SOURCES/schedtop-0.5.tar.gz
 ..
 [SNIP..]
 ..
 Wrote: /usr/src/packages/RPMS/x86_64/schedtop-0.5-1.x86_64.rpm
 Wrote: /usr/src/packages/RPMS/x86_64/schedtop-debuginfo-0.5-1.x86_64.rpm
 Wrote: /usr/src/packages/RPMS/x86_64/schedtop-debugsource-0.5-1.x86_64.rpm
 Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.26872
 + umask 022
 + cd /usr/src/packages/BUILD
 + cd schedtop-0.5
 + make clean
 + exit 0
 Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.26872
 + umask 022
 + cd /usr/src/packages/BUILD
 + rm -rf schedtop-0.5
 + exit 0

Reporting Problems/Fixes

Send all problems and/or patches to Greg Haskins

Personal tools