From Fedora Project Wiki
(scomes - measure amount of system resources consumed by the program)
(→‎scomes: fixed package name)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
To be done. Please see [[Features/PowerManagement]] for now.
Please see [[Features/PowerManagement]] for more.


= scomes =
= scomes =


'''Goal:''' Measure amount of system resources consumed by the program.
Scomes is a SystemTap script to watch resources consumed by the program. Now it is part of the [https://fedorahosted.org/tuned/ tuned] project (''tuned-utils'' package).


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


* Measure amount of system resources consumed by the program.
* Use these data to compare different programming techniques in view of system resources.
* Create programming tips based on these results.
'''How it works:'''
using systemtap -
http://sources.redhat.com/systemtap/wiki/
script watches given binary for syscalls, kernel and userspace ticks, read and written bytes, transmitted bytes and polling syscalls, and enumerates score from these values.
scomes is part of tuned-utils package.


== Usage ==
== Usage ==
Line 13: Line 25:


<pre>
<pre>
# yum install systemtap
# yum install systemtap tuned-utils
# debuginfo-install kernel
# debuginfo-install kernel
</pre>
</pre>




<!--
=== Use scomes.py wrapper ===
=== Use scomes.py wrapper ===


Line 45: Line 58:
scomes.stp: -----------------------------------
scomes.stp: -----------------------------------
</pre>
</pre>
</del>
-->


=== Run scomes.stp manually ===
=== Run scomes.stp ===


Binary you want to measure must be named uniquely (or ensure there are no other binaries with same name running on the system).
Binary you want to measure should 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:
Now run the scomes with the command-line option being name of the binary and then run the binary:


<pre>
<pre>
# scomes.stp my_binary_3d4f8   # wait untill it starts
# scomes.stp -c "<binary> [<binary arg> ...]" <timer>   # wait untill it starts
# ./my_binary_3d4f8
</pre>
</pre>
;binary [binary args ...]
:measured program
;timer
:how often you want to see current results, value is in seconds and 0 means "show only last results"


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


<pre>
<pre>
Monitored execname: my_binary_3d4f8
# ./scomes.stp -c "/bin/sleep 4" 2
Number of syscalls: 0
Collecting data...
Kernel/Userspace ticks: 0/0
-----------------------------------
Read/Written bytes: 0
Monitored execname: sleep
Transmitted/Recived bytes: 0
Number of syscalls: 59
Kernel/Userspace ticks: 3/1 (4)
Read/Written bytes: 3620/0 (3620)
Transmitted/Recived bytes: 0/0 (0)
Pooling syscalls: 0
Pooling syscalls: 0
SCORE: 0
SCORE: 36205
-----------------------------------
-----------------------------------
Monitored execname: my_binary_3d4f8
Monitored execname: sleep
Number of syscalls: 3716
Number of syscalls: 59
Kernel/Userspace ticks: 34/339
Kernel/Userspace ticks: 3/1 (4)
Read/Written bytes: 446282
Read/Written bytes: 3620/0 (3620)
Transmitted/Recived bytes: 16235
Transmitted/Recived bytes: 0/0 (0)
Pooling syscalls: 2
Pooling syscalls: 0
SCORE: 4479767
SCORE: 36205
-----------------------------------
-----------------------------------
LAST RESULTS:
LAST RESULTS:
-----------------------------------
-----------------------------------
Monitored execname: my_binary_3d4f8
Monitored execname: sleep
Number of syscalls: 4529
Number of syscalls: 63
Kernel/Userspace ticks: 44/446
Kernel/Userspace ticks: 4/1 (5)
Read/Written bytes: 454352
Read/Written bytes: 3620/0 (3620)
Transmitted/Recived bytes: 22003
Transmitted/Recived bytes: 0/0 (0)
Pooling syscalls: 3
Pooling syscalls: 1
SCORE: 4566459
SCORE: 36206
-----------------------------------
-----------------------------------
QUITTING
QUITTING
Line 91: Line 112:


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


== Explain statistics ==
== Explain statistics ==


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


== First examples ==
== First examples ==

Latest revision as of 08:18, 27 August 2009

Please see Features/PowerManagement for more.

scomes

Scomes is a SystemTap script to watch resources consumed by the program. Now it is part of the tuned project (tuned-utils package).

Goal:

  • Measure amount of system resources consumed by the program.
  • Use these data to compare different programming techniques in view of system resources.
  • Create programming tips based on these results.


How it works: using systemtap - http://sources.redhat.com/systemtap/wiki/ script watches given binary for syscalls, kernel and userspace ticks, read and written bytes, transmitted bytes and polling syscalls, and enumerates score from these values.


scomes is part of tuned-utils package.

Usage

Prepare your system:

# yum install systemtap tuned-utils
# debuginfo-install kernel


Run scomes.stp

Binary you want to measure should 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 -c "<binary> [<binary arg> ...]" <timer>   # wait untill it starts
binary [binary args ...]
measured program
timer
how often you want to see current results, value is in seconds and 0 means "show only last results"

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

# ./scomes.stp -c "/bin/sleep 4" 2
Collecting data...
-----------------------------------
Monitored execname: sleep
Number of syscalls: 59
Kernel/Userspace ticks: 3/1 (4)
Read/Written bytes: 3620/0 (3620)
Transmitted/Recived bytes: 0/0 (0)
Pooling syscalls: 0
SCORE: 36205
-----------------------------------
Monitored execname: sleep
Number of syscalls: 59
Kernel/Userspace ticks: 3/1 (4)
Read/Written bytes: 3620/0 (3620)
Transmitted/Recived bytes: 0/0 (0)
Pooling syscalls: 0
SCORE: 36205
-----------------------------------
LAST RESULTS:
-----------------------------------
Monitored execname: sleep
Number of syscalls: 63
Kernel/Userspace ticks: 4/1 (5)
Read/Written bytes: 3620/0 (3620)
Transmitted/Recived bytes: 0/0 (0)
Pooling syscalls: 1
SCORE: 36206
-----------------------------------
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 (reads, writes variables)
Transmitted/Recived bytes
sum of the read and written bytes from the network binary does (ifxmit and ifrecv variables)
Polling syscalls
"bad" polling syscals binary does (poll, select, epoll, itimer, futex, nanosleep, signal)
SCORE
TODO - but for now: SCORE = kticks + 2*uticks + 10*(reads+writes) + 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