Schedtop utility

From RTwiki
(Difference between revisions)
Jump to: navigation, search
m
m (Usage)
(2 intermediate revisions by one user not shown)
Line 9: Line 9:
 
matching.
 
matching.
  
=Usage=
+
=How to obtain=
  
==Running==
+
==Building from source==
  
''schedtop <options>
+
===Prerequisites===
''
+
  -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
+
*) development version of [http://boost.org boost] installed (often called "boost-dev" package).
 +
*) g++ compiler
  
==Example==
+
===Obtain the source code===
  
To filter out any stats with "sched_info" or "imbalance" in the name, use the exclude filter with an OR operator
+
====GIT Tree====
  
''schedtop -x 'sched_info|imbalance'''
+
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/schedtop.git [http://git.kernel.org/?p=linux/kernel/git/ghaskins/schedtop.git;a=summary (Browse gitweb)]
  
=Kernel Configuration=
+
====Tarball====
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 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:
+
 
+
{| cellspacing="0" border="1"
+
|OpenSUSE 11
+
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_11.0/x86_64 x86_64]
+
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_11.0/i586 i586]
+
|-
+
|OpenSUSE 10.3
+
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_10.3/x86_64 x86_64]
+
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_10.3/i586 i586]
+
|-
+
|SUSE Linux Enterprise 10
+
|[http://download.opensuse.org/repositories/home:/ghaskins/SLE_10/x86_64 x86_64]
+
|[http://download.opensuse.org/repositories/home:/ghaskins/SLE_10/i586 i586]
+
|-
+
|RHEL 5
+
|[http://download.opensuse.org/repositories/home:/ghaskins/RHEL_5/x86_64 x86_64]
+
|[http://download.opensuse.org/repositories/home:/ghaskins/RHEL_5/i586 i586]
+
|-
+
|Fedora 9
+
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/x86_64 x86_64]
+
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/i586 i586]
+
|-
+
|Mandriva-2008
+
|[http://download.opensuse.org/repositories/home:/ghaskins/Mandriva_2008/x86_64 x86_64]
+
|[http://download.opensuse.org/repositories/home:/ghaskins/Mandriva_2008/i586 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 ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz]
 
     [ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz]
  
==Browse the source==
+
===Building===
  
[http://git.kernel.org/?p=linux/kernel/git/ghaskins/schedtop.git;a=summary gitweb on git.kernel.org]
+
====Local Build====
 
+
=Building=
+
 
+
Note: You need to have the development version of [http://boost.org boost] installed as a pre-requisite (often called "boost-dev" package).
+
 
+
==Manual Binary==
+
  
 
   ghaskins@dev:~> cd sandbox/git/schedtop/
 
   ghaskins@dev:~> cd sandbox/git/schedtop/
Line 97: Line 41:
 
   -rwxr-xr-x 1 ghaskins users 1183285 2008-10-22 06:51 obj/x86_64/schedtop
 
   -rwxr-xr-x 1 ghaskins users 1183285 2008-10-22 06:51 obj/x86_64/schedtop
  
== RPM ==
+
====RPM====
  
=== Generate a .src.rpm===
+
Generate a .src.rpm
  
 
   ghaskins@dev:~> cd sandbox/git/schedtop/
 
   ghaskins@dev:~> cd sandbox/git/schedtop/
Line 112: Line 56:
 
   Wrote: '''/usr/src/packages/SRPMS/schedtop-0.5-1.src.rpm'''
 
   Wrote: '''/usr/src/packages/SRPMS/schedtop-0.5-1.src.rpm'''
  
=== Generate a binary .rpm===
+
Generate a binary .rpm using the .src.rpm output from the previous example
 
+
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
 
   ghaskins@dev:~/sandbox/git/schedtop> rpmbuild --rebuild /usr/src/packages/SRPMS/schedtop-0.5-1.src.rpm
Line 141: Line 83:
 
   + rm -rf schedtop-0.5
 
   + rm -rf schedtop-0.5
 
   + exit 0
 
   + exit 0
 +
 +
==Prebuilt RPMs==
 +
 +
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 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:
 +
 +
{| cellspacing="0" border="1"
 +
|OpenSUSE 11
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_11.0/x86_64 x86_64]
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_11.0/i586 i586]
 +
|-
 +
|OpenSUSE 10.3
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_10.3/x86_64 x86_64]
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/openSUSE_10.3/i586 i586]
 +
|-
 +
|SUSE Linux Enterprise 10
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/SLE_10/x86_64 x86_64]
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/SLE_10/i586 i586]
 +
|-
 +
|RHEL 5
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/RHEL_5/x86_64 x86_64]
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/RHEL_5/i586 i586]
 +
|-
 +
|Fedora 9
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/x86_64 x86_64]
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/i586 i586]
 +
|-
 +
|Mandriva-2008
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/Mandriva_2008/x86_64 x86_64]
 +
|[http://download.opensuse.org/repositories/home:/ghaskins/Mandriva_2008/i586 i586]
 +
|}
 +
 +
=How to use=
 +
 +
==Prerequistes==
 +
 +
*) A relatively modern kernel that supports v14 of the SCHEDSTATS
 +
*) Enable CONFIG_SCHEDSTATS=y in your kernel .config.
 +
 +
==Usage==
 +
 +
''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'''
  
 
=Reporting Problems/Fixes=
 
=Reporting Problems/Fixes=
  
Send all problems and/or patches to [mailto:ghaskins@novell.com Greg Haskins]
+
Send all problems and/or patches to [mailto:ghaskins@novell.com Greg Haskins <ghaskins@novell.com>]

Revision as of 11:35, 22 October 2008

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.

How to obtain

Building from source

Prerequisites

  • ) development version of boost installed (often called "boost-dev" package).
  • ) g++ compiler

Obtain the source code

GIT Tree

   git clone git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/schedtop.git (Browse gitweb)

Tarball

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

Building

Local Build

 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 using the .src.rpm output from the previous example

 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

Prebuilt RPMs

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

How to use

Prerequistes

  • ) A relatively modern kernel that supports v14 of the SCHEDSTATS
  • ) Enable CONFIG_SCHEDSTATS=y in your kernel .config.

Usage

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'

Reporting Problems/Fixes

Send all problems and/or patches to Greg Haskins <ghaskins@novell.com>

Personal tools