From Fedora Project Wiki

Revision as of 14:13, 23 June 2009 by Plautrba (talk | contribs) (scomes - measure amount of system resources consumed by the program)

To be done. Please see Features/PowerManagement for now.

scomes

Goal: Measure amount of system resources consumed by the program.

Download: http://fedorapeople.org/~plautrba/scomes


Usage

Prepare your system:

# yum install systemtap
# debuginfo-install kernel


Use scomes.py wrapper

 
scomes.py [-u] -- <binary> [binary args]
    -u, --unique     copy binary to unique filename to avoid conflicts with multiple same-called running binaries
    <binary>         binary you want to measure, has to be with absolute or relative path related to cwd
# scomes.py -u -- /bin/sleep 5
new binary /tmp/scomeslp52_r
run: ['/usr/bin/scomes.stp', '--skip-badvars', 'scomeslp52_r']
run /tmp/scomeslp52_r ['5']
scomes.stp: -----------------------------------
scomes.stp: LAST RESULTS:
scomes.stp: -----------------------------------
scomes.stp: Monitored execname: /bin/sleep
scomes.stp: Number of syscalls: 61
scomes.stp: Kernel/Userspace ticks: 2/0
scomes.stp: Read/Written bytes: 2888
scomes.stp: Transmitted/Recived bytes: 0
scomes.stp: Pooling syscalls: 1
scomes.stp: SCORE: 28882
scomes.stp: -----------------------------------
scomes.stp: QUITTING
scomes.stp: -----------------------------------

Run scomes.stp manually

Binary you want to measure must be named uniquely (or ensure there are no other binaries with same name running on the system).

Now run the scomes with the command-line option being name of the binary and then run the binary:

# scomes.stp my_binary_3d4f8   # wait untill it starts
# ./my_binary_3d4f8

scomes will start to output statistics each 5 seconds and once binary ends, it will output final statistic like this:

Monitored execname: my_binary_3d4f8
Number of syscalls: 0
Kernel/Userspace ticks: 0/0
Read/Written bytes: 0
Transmitted/Recived bytes: 0
Pooling syscalls: 0
SCORE: 0
-----------------------------------
Monitored execname: my_binary_3d4f8
Number of syscalls: 3716
Kernel/Userspace ticks: 34/339
Read/Written bytes: 446282
Transmitted/Recived bytes: 16235
Pooling syscalls: 2
SCORE: 4479767
-----------------------------------
LAST RESULTS:
-----------------------------------
Monitored execname: my_binary_3d4f8
Number of syscalls: 4529
Kernel/Userspace ticks: 44/446
Read/Written bytes: 454352
Transmitted/Recived bytes: 22003
Pooling syscalls: 3
SCORE: 4566459
-----------------------------------
QUITTING
-----------------------------------

Note: on F11 please call scomes with stap --skip-badvars scomes.stp.


Explain statistics

* Monitored execname:: name of the binary (passed as a command-line argument)
* Number of syscalls:: number of all syscalls performed by the binary
* Kernel/Userspace ticks:: count of the processor ticks binary uses in the kernel or in userspace respectively (kticks and uticks variables)
* Read/Written bytes:: sum of the read and written bytes from the file binary does (readwrites variable)
* Transmitted/Recived bytes:: sum of the read and written bytes from the network binary does (ifxmit and ifrecv variables)
* Pooling syscalls:: "bad" pooling syscals binary does (poll, select, epoll, itimer, futex, nanosleep, signal)
* SCORE:: TODO - but for now: SCORE = kticks + 2*uticks + 10*readwrites + ifxmit + ifrecv


First examples

http://fedoraproject.org/wiki/Features/PowerManagement/scomes/examples

command sleep 10

normal:

Monitored execname: sleep
Number of syscalls: 33
Kernel/Userspace ticks: 2/0
Read/Written bytes: 736
Transmitted/Recived bytes: 0
Pooling syscalls: 1
SCORE: 7362

busybox - statically linked:

Monitored execname: busybox
Number of syscalls: 7
Kernel/Userspace ticks: 1/0
Read/Written bytes: 0
Transmitted/Recived bytes: 0
Pooling syscalls: 1
SCORE: 1

busybox.anaconda - dynamically linked:

Monitored execname: sleep
Number of syscalls: 39
Kernel/Userspace ticks: 0/2
Read/Written bytes: 1248
Transmitted/Recived bytes: 0
Pooling syscalls: 0
SCORE: 12484