summaryrefslogtreecommitdiffstats
path: root/SystemTap_Beginners_Guide/topsyssect.html
blob: 4d433db0d51bec99b24b30fc5d73a0fab01370c8 (plain) (blame)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title xmlns:d="http://docbook.org/ns/docbook">5.3.5. Tracking Most Frequently Used System Calls</title><link rel="stylesheet" type="text/css" href="Common_Content/css/default.css" /><link rel="stylesheet" media="print" href="Common_Content/css/print.css" type="text/css" /><meta xmlns:d="http://docbook.org/ns/docbook" name="generator" content="publican v4.1.3" /><meta xmlns:d="http://docbook.org/ns/docbook" name="package" content="SystemTap-SystemTap_Beginners_Guide-2.7-en-US-2.0-1" /><link rel="home" href="index.html" title="SystemTap Beginners Guide" /><link rel="up" href="mainsect-profiling.html" title="5.3. Profiling" /><link rel="prev" href="timeoutssect.html" title="5.3.4. Monitoring Polling Applications" /><link rel="next" href="syscallsbyprocpidsect.html" title="5.3.6. Tracking System Call Volume Per Process" /></head><body><p id="title"><a class="left" href="https://fedorahosted.org/publican"><img alt="Product Site" src="Common_Content/images//image_left.png" /></a><a class="right" href="https://fedorahosted.org/publican"><img alt="Documentation Site" src="Common_Content/images//image_right.png" /></a></p><ul class="docnav top"><li class="previous"><a accesskey="p" href="timeoutssect.html"><strong>Prev</strong></a></li><li class="home">SystemTap Beginners Guide</li><li class="next"><a accesskey="n" href="syscallsbyprocpidsect.html"><strong>Next</strong></a></li></ul><div xml:lang="en-US" class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="topsyssect"></a>5.3.5. Tracking Most Frequently Used System Calls</h3></div></div></div><a id="idm47650186638528" class="indexterm"></a><a id="idm47650192688528" class="indexterm"></a><a id="idm47650188823216" class="indexterm"></a><a id="idm47650190862512" class="indexterm"></a><div class="para"> <a class="xref" href="timeoutssect.html#timeouts">timeout.stp</a> from <a class="xref" href="timeoutssect.html">Section 5.3.4, “Monitoring Polling Applications”</a> helps you identify which applications are polling by examining a small subset of system calls ( <code class="command">poll</code>, <code class="command">select</code>, <code class="command">epoll</code>, <code class="command">itimer</code>, <code class="command">futex</code>, <code class="command">nanosleep</code>, and <code class="command">signal</code>). However, in some systems, an excessive number of system calls outside that small subset might be responsible for time spent in the kernel. If you suspect that an application is using system calls excessively, you need to identify the most frequently used system calls on the system. To do this, use <a class="xref" href="topsyssect.html#topsys">topsys.stp</a>. </div><div class="para"><div xmlns:d="http://docbook.org/ns/docbook" class="title">topsys.stp</div> <pre class="programlisting">#! /usr/bin/env stap # # This script continuously lists the top 20 systemcalls in the interval # 5 seconds # global syscalls_count probe syscall.* { syscalls_count[name] &lt;&lt;&lt; 1 } function print_systop () { printf ("%25s %10s\n", "SYSCALL", "COUNT") foreach (syscall in syscalls_count- limit 20) { printf("%25s %10d\n", syscall, @count(syscalls_count[syscall])) } delete syscalls_count } probe timer.s(5) { print_systop () printf("--------------------------------------------------------------\n") } </pre> </div><div class="para"> <a class="xref" href="topsyssect.html#topsys">topsys.stp</a> lists the top 20 system calls used by the system per 5-second interval. It also lists how many times each system call was used during that period. Refer to <a class="xref" href="topsyssect.html#topsysoutput">Example 5.17, “topsys.stp Sample Output”</a> for a sample output. </div><a id="idm47650193535152" class="indexterm"></a><a id="idm47650189294160" class="indexterm"></a><a id="idm47650190856640" class="indexterm"></a><div class="example"><a id="topsysoutput"></a><p class="title"><strong>Example 5.17<a class="xref" href="topsyssect.html#topsys">topsys.stp</a> Sample Output</strong></p><div class="example-contents"><pre class="screen">-------------------------------------------------------------- SYSCALL COUNT gettimeofday 1857 read 1821 ioctl 1568 poll 1033 close 638 open 503 select 455 write 391 writev 335 futex 303 recvmsg 251 socket 137 clock_gettime 124 rt_sigprocmask 121 sendto 120 setitimer 106 stat 90 time 81 sigreturn 72 fstat 66 --------------------------------------------------------------</pre></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="timeoutssect.html"><strong>Prev</strong>5.3.4. Monitoring Polling Applications</a></li><li class="up"><a accesskey="u" href="#"><strong>Up</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Home</strong></a></li><li class="next"><a accesskey="n" href="syscallsbyprocpidsect.html"><strong>Next</strong>5.3.6. Tracking System Call Volume Per Process</a></li></ul></body></html>