Schedtop utility

From RTwiki
(Difference between revisions)
Jump to: navigation, search
m (Usage)
 
(10 intermediate revisions by one user not shown)
Line 9: Line 9:
 
matching.
 
matching.
  
=Usage=
+
=How to obtain=
  
''schedtop <options>
+
==Building from source==
''
+
  -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
+
===Prerequisites===
  
 +
*) development version of [http://boost.org boost] installed (often called "boost-dev" package).
 +
*) g++ compiler
  
=Kernel Configuration=
+
===Obtain the source code===
You need to enable the scheduler statistics in your .config.  This utility will only work with v14 of the stats (current as of this writing)
+
  
=RPM Repositories=
+
====GIT Tree====
  
A variety of platforms can be found available here:
+
    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)]
 +
 
 +
====Tarball====
 +
 
 +
    [ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz 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 http://download.opensuse.org/repositories/home:/ghaskins]
 
[http://download.opensuse.org/repositories/home:/ghaskins http://download.opensuse.org/repositories/home:/ghaskins]
  
Direct links to a subset of the available builds:
+
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"
 
{| cellspacing="0" border="1"
Line 53: Line 114:
 
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/x86_64 x86_64]
 
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/x86_64 x86_64]
 
|[http://download.opensuse.org/repositories/home:/ghaskins/Fedora_9/i586 i586]
 
|[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=
+
=How to use=
  
'''GIT Tree:'''
+
==Prerequistes==
  
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/schedtop.git
+
*) A relatively modern kernel that supports v14 of the SCHEDSTATS
 +
*) Enable CONFIG_SCHEDSTATS=y in your kernel .config.
  
'''Tarball:'''
+
==Usage==
  
     [ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz ftp://ftp.novell.com/dev/ghaskins/schedtop.tar.gz]
+
''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'''
  
or
+
=Reporting Problems/Fixes=
  
[http://git.kernel.org/?p=linux/kernel/git/ghaskins/schedtop.git;a=summary Browse the Source]
+
Send all problems and/or patches to [mailto:ghaskins@novell.com Greg Haskins <ghaskins@novell.com>]

Latest revision as of 11:35, 22 October 2008

Contents

[edit] 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.

[edit] How to obtain

[edit] Building from source

[edit] Prerequisites

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

[edit] Obtain the source code

[edit] GIT Tree

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

[edit] Tarball

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

[edit] Building

[edit] 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

[edit] 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

[edit] 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

[edit] How to use

[edit] Prerequistes

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

[edit] 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

[edit] 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'

[edit] Reporting Problems/Fixes

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

Personal tools