You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1116 lines
38 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#375EAB">
  7. <title>procfs - The Go Programming Language</title>
  8. <link type="text/css" rel="stylesheet" href="../../../../lib/godoc/style.css">
  9. <link rel="stylesheet" href="../../../../lib/godoc/jquery.treeview.css">
  10. <script type="text/javascript">window.initFuncs = [];</script>
  11. </head>
  12. <body>
  13. <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
  14. ...
  15. </div><!-- #lowframe -->
  16. <div id="topbar" class="wide"><div class="container">
  17. <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
  18. <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
  19. <a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
  20. <form method="GET" action="http://localhost:6060/search">
  21. <div id="menu">
  22. <a href="http://localhost:6060/doc/">Documents</a>
  23. <a href="http://localhost:6060/pkg/">Packages</a>
  24. <a href="http://localhost:6060/project/">The Project</a>
  25. <a href="http://localhost:6060/help/">Help</a>
  26. <a href="http://localhost:6060/blog/">Blog</a>
  27. <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
  28. </div>
  29. </form>
  30. </div></div>
  31. <div id="page" class="wide">
  32. <div class="container">
  33. <h1>Package procfs</h1>
  34. <div id="nav"></div>
  35. <!--
  36. Copyright 2009 The Go Authors. All rights reserved.
  37. Use of this source code is governed by a BSD-style
  38. license that can be found in the LICENSE file.
  39. -->
  40. <!--
  41. Note: Static (i.e., not template-generated) href and id
  42. attributes start with "pkg-" to make it impossible for
  43. them to conflict with generated attributes (some of which
  44. correspond to Go identifiers).
  45. -->
  46. <script type='text/javascript'>
  47. document.ANALYSIS_DATA = null;
  48. document.CALLGRAPH = null;
  49. </script>
  50. <div id="short-nav">
  51. <dl>
  52. <dd><code>import "github.com/prometheus/procfs"</code></dd>
  53. </dl>
  54. <dl>
  55. <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
  56. <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
  57. </dl>
  58. </div>
  59. <!-- The package's Name is printed as title by the top-level template -->
  60. <div id="pkg-overview" class="toggleVisible">
  61. <div class="collapsed">
  62. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  63. </div>
  64. <div class="expanded">
  65. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  66. <p>
  67. Package procfs provides functions to retrieve system, kernel and process
  68. metrics from the pseudo-filesystem proc.
  69. </p>
  70. <p>
  71. Example:
  72. </p>
  73. <pre>package main
  74. import (
  75. &#34;fmt&#34;
  76. &#34;log&#34;
  77. &#34;github.com/prometheus/procfs&#34;
  78. )
  79. func main() {
  80. p, err := procfs.Self()
  81. if err != nil {
  82. log.Fatalf(&#34;could not get process: %s&#34;, err)
  83. }
  84. stat, err := p.NewStat()
  85. if err != nil {
  86. log.Fatalf(&#34;could not get process stat: %s&#34;, err)
  87. }
  88. fmt.Printf(&#34;command: %s\n&#34;, stat.Comm)
  89. fmt.Printf(&#34;cpu time: %fs\n&#34;, stat.CPUTime())
  90. fmt.Printf(&#34;vsize: %dB\n&#34;, stat.VirtualMemory())
  91. fmt.Printf(&#34;rss: %dB\n&#34;, stat.ResidentMemory())
  92. }
  93. </pre>
  94. </div>
  95. </div>
  96. <div id="pkg-index" class="toggleVisible">
  97. <div class="collapsed">
  98. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  99. </div>
  100. <div class="expanded">
  101. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  102. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  103. <div id="manual-nav">
  104. <dl>
  105. <dd><a href="index.html#pkg-constants">Constants</a></dd>
  106. <dd><a href="index.html#NewIPVSBackendStatus">func NewIPVSBackendStatus() ([]IPVSBackendStatus, error)</a></dd>
  107. <dd><a href="index.html#FS">type FS</a></dd>
  108. <dd>&nbsp; &nbsp; <a href="index.html#NewFS">func NewFS(mountPoint string) (FS, error)</a></dd>
  109. <dd>&nbsp; &nbsp; <a href="index.html#FS.AllProcs">func (fs FS) AllProcs() (Procs, error)</a></dd>
  110. <dd>&nbsp; &nbsp; <a href="index.html#FS.NewIPVSBackendStatus">func (fs FS) NewIPVSBackendStatus() ([]IPVSBackendStatus, error)</a></dd>
  111. <dd>&nbsp; &nbsp; <a href="index.html#FS.NewIPVSStats">func (fs FS) NewIPVSStats() (IPVSStats, error)</a></dd>
  112. <dd>&nbsp; &nbsp; <a href="index.html#FS.NewProc">func (fs FS) NewProc(pid int) (Proc, error)</a></dd>
  113. <dd>&nbsp; &nbsp; <a href="index.html#FS.NewStat">func (fs FS) NewStat() (Stat, error)</a></dd>
  114. <dd>&nbsp; &nbsp; <a href="index.html#FS.ParseMDStat">func (fs FS) ParseMDStat() (mdstates []MDStat, err error)</a></dd>
  115. <dd>&nbsp; &nbsp; <a href="index.html#FS.Path">func (fs FS) Path(p ...string) string</a></dd>
  116. <dd>&nbsp; &nbsp; <a href="index.html#FS.Self">func (fs FS) Self() (Proc, error)</a></dd>
  117. <dd><a href="index.html#IPVSBackendStatus">type IPVSBackendStatus</a></dd>
  118. <dd><a href="index.html#IPVSStats">type IPVSStats</a></dd>
  119. <dd>&nbsp; &nbsp; <a href="index.html#NewIPVSStats">func NewIPVSStats() (IPVSStats, error)</a></dd>
  120. <dd><a href="index.html#MDStat">type MDStat</a></dd>
  121. <dd><a href="index.html#Proc">type Proc</a></dd>
  122. <dd>&nbsp; &nbsp; <a href="index.html#NewProc">func NewProc(pid int) (Proc, error)</a></dd>
  123. <dd>&nbsp; &nbsp; <a href="index.html#Self">func Self() (Proc, error)</a></dd>
  124. <dd>&nbsp; &nbsp; <a href="index.html#Proc.CmdLine">func (p Proc) CmdLine() ([]string, error)</a></dd>
  125. <dd>&nbsp; &nbsp; <a href="index.html#Proc.Comm">func (p Proc) Comm() (string, error)</a></dd>
  126. <dd>&nbsp; &nbsp; <a href="index.html#Proc.Executable">func (p Proc) Executable() (string, error)</a></dd>
  127. <dd>&nbsp; &nbsp; <a href="index.html#Proc.FileDescriptorTargets">func (p Proc) FileDescriptorTargets() ([]string, error)</a></dd>
  128. <dd>&nbsp; &nbsp; <a href="index.html#Proc.FileDescriptors">func (p Proc) FileDescriptors() ([]uintptr, error)</a></dd>
  129. <dd>&nbsp; &nbsp; <a href="index.html#Proc.FileDescriptorsLen">func (p Proc) FileDescriptorsLen() (int, error)</a></dd>
  130. <dd>&nbsp; &nbsp; <a href="index.html#Proc.NewIO">func (p Proc) NewIO() (ProcIO, error)</a></dd>
  131. <dd>&nbsp; &nbsp; <a href="index.html#Proc.NewLimits">func (p Proc) NewLimits() (ProcLimits, error)</a></dd>
  132. <dd>&nbsp; &nbsp; <a href="index.html#Proc.NewStat">func (p Proc) NewStat() (ProcStat, error)</a></dd>
  133. <dd><a href="index.html#ProcIO">type ProcIO</a></dd>
  134. <dd><a href="index.html#ProcLimits">type ProcLimits</a></dd>
  135. <dd><a href="index.html#ProcStat">type ProcStat</a></dd>
  136. <dd>&nbsp; &nbsp; <a href="index.html#ProcStat.CPUTime">func (s ProcStat) CPUTime() float64</a></dd>
  137. <dd>&nbsp; &nbsp; <a href="index.html#ProcStat.ResidentMemory">func (s ProcStat) ResidentMemory() int</a></dd>
  138. <dd>&nbsp; &nbsp; <a href="index.html#ProcStat.StartTime">func (s ProcStat) StartTime() (float64, error)</a></dd>
  139. <dd>&nbsp; &nbsp; <a href="index.html#ProcStat.VirtualMemory">func (s ProcStat) VirtualMemory() int</a></dd>
  140. <dd><a href="index.html#Procs">type Procs</a></dd>
  141. <dd>&nbsp; &nbsp; <a href="index.html#AllProcs">func AllProcs() (Procs, error)</a></dd>
  142. <dd>&nbsp; &nbsp; <a href="index.html#Procs.Len">func (p Procs) Len() int</a></dd>
  143. <dd>&nbsp; &nbsp; <a href="index.html#Procs.Less">func (p Procs) Less(i, j int) bool</a></dd>
  144. <dd>&nbsp; &nbsp; <a href="index.html#Procs.Swap">func (p Procs) Swap(i, j int)</a></dd>
  145. <dd><a href="index.html#Stat">type Stat</a></dd>
  146. <dd>&nbsp; &nbsp; <a href="index.html#NewStat">func NewStat() (Stat, error)</a></dd>
  147. </dl>
  148. </div><!-- #manual-nav -->
  149. <h4>Package files</h4>
  150. <p>
  151. <span style="font-size:90%">
  152. <a href="http://localhost:6060/src/github.com/prometheus/procfs/doc.go">doc.go</a>
  153. <a href="http://localhost:6060/src/github.com/prometheus/procfs/fs.go">fs.go</a>
  154. <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go">ipvs.go</a>
  155. <a href="http://localhost:6060/src/github.com/prometheus/procfs/mdstat.go">mdstat.go</a>
  156. <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go">proc.go</a>
  157. <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_io.go">proc_io.go</a>
  158. <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_limits.go">proc_limits.go</a>
  159. <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go">proc_stat.go</a>
  160. <a href="http://localhost:6060/src/github.com/prometheus/procfs/stat.go">stat.go</a>
  161. </span>
  162. </p>
  163. </div><!-- .expanded -->
  164. </div><!-- #pkg-index -->
  165. <div id="pkg-callgraph" class="toggle" style="display: none">
  166. <div class="collapsed">
  167. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  168. </div> <!-- .expanded -->
  169. <div class="expanded">
  170. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  171. <p>
  172. In the call graph viewer below, each node
  173. is a function belonging to this package
  174. and its children are the functions it
  175. calls&mdash;perhaps dynamically.
  176. </p>
  177. <p>
  178. The root nodes are the entry points of the
  179. package: functions that may be called from
  180. outside the package.
  181. There may be non-exported or anonymous
  182. functions among them if they are called
  183. dynamically from another package.
  184. </p>
  185. <p>
  186. Click a node to visit that function's source code.
  187. From there you can visit its callers by
  188. clicking its declaring <code>func</code>
  189. token.
  190. </p>
  191. <p>
  192. Functions may be omitted if they were
  193. determined to be unreachable in the
  194. particular programs or tests that were
  195. analyzed.
  196. </p>
  197. <!-- Zero means show all package entry points. -->
  198. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  199. </div>
  200. </div> <!-- #pkg-callgraph -->
  201. <h2 id="pkg-constants">Constants</h2>
  202. <pre>const <span id="DefaultMountPoint">DefaultMountPoint</span> = &#34;/proc&#34;</pre>
  203. <p>
  204. DefaultMountPoint is the common mount point of the proc filesystem.
  205. </p>
  206. <h2 id="NewIPVSBackendStatus">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go?s=2957:3013#L110">NewIPVSBackendStatus</a></h2>
  207. <pre>func NewIPVSBackendStatus() ([]<a href="index.html#IPVSBackendStatus">IPVSBackendStatus</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  208. <p>
  209. NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs.
  210. </p>
  211. <h2 id="FS">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/fs.go?s=152:166#L1">FS</a></h2>
  212. <pre>type FS <a href="../../../builtin/index.html#string">string</a></pre>
  213. <p>
  214. FS represents the pseudo-filesystem proc, which provides an interface to
  215. kernel data structures.
  216. </p>
  217. <h3 id="NewFS">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/fs.go?s=387:428#L8">NewFS</a></h3>
  218. <pre>func NewFS(mountPoint <a href="../../../builtin/index.html#string">string</a>) (<a href="index.html#FS">FS</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  219. <p>
  220. NewFS returns a new FS mounted under the given mountPoint. It will error
  221. if the mount point can&#39;t be read.
  222. </p>
  223. <h3 id="FS.AllProcs">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=1638:1676#L65">AllProcs</a></h3>
  224. <pre>func (fs <a href="index.html#FS">FS</a>) AllProcs() (<a href="index.html#Procs">Procs</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  225. <p>
  226. AllProcs returns a list of all currently available processes.
  227. </p>
  228. <h3 id="FS.NewIPVSBackendStatus">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go?s=3273:3337#L120">NewIPVSBackendStatus</a></h3>
  229. <pre>func (fs <a href="index.html#FS">FS</a>) NewIPVSBackendStatus() ([]<a href="index.html#IPVSBackendStatus">IPVSBackendStatus</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  230. <p>
  231. NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem.
  232. </p>
  233. <h3 id="FS.NewIPVSStats">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go?s=1444:1490#L51">NewIPVSStats</a></h3>
  234. <pre>func (fs <a href="index.html#FS">FS</a>) NewIPVSStats() (<a href="index.html#IPVSStats">IPVSStats</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  235. <p>
  236. NewIPVSStats reads the IPVS statistics from the specified `proc` filesystem.
  237. </p>
  238. <h3 id="FS.NewProc">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=1400:1443#L57">NewProc</a></h3>
  239. <pre>func (fs <a href="index.html#FS">FS</a>) NewProc(pid <a href="../../../builtin/index.html#int">int</a>) (<a href="index.html#Proc">Proc</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  240. <p>
  241. NewProc returns a process for the given pid.
  242. </p>
  243. <h3 id="FS.NewStat">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/stat.go?s=471:507#L18">NewStat</a></h3>
  244. <pre>func (fs <a href="index.html#FS">FS</a>) NewStat() (<a href="index.html#Stat">Stat</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  245. <p>
  246. NewStat returns an information about current kernel/system statistics.
  247. </p>
  248. <h3 id="FS.ParseMDStat">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/mdstat.go?s=713:770#L23">ParseMDStat</a></h3>
  249. <pre>func (fs <a href="index.html#FS">FS</a>) ParseMDStat() (mdstates []<a href="index.html#MDStat">MDStat</a>, err <a href="../../../builtin/index.html#error">error</a>)</pre>
  250. <p>
  251. ParseMDStat parses an mdstat-file and returns a struct with the relevant infos.
  252. </p>
  253. <h3 id="FS.Path">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/fs.go?s=756:793#L21">Path</a></h3>
  254. <pre>func (fs <a href="index.html#FS">FS</a>) Path(p ...<a href="../../../builtin/index.html#string">string</a>) <a href="../../../builtin/index.html#string">string</a></pre>
  255. <p>
  256. Path returns the path of the given subsystem relative to the procfs root.
  257. </p>
  258. <h3 id="FS.Self">func (FS) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=1101:1134#L44">Self</a></h3>
  259. <pre>func (fs <a href="index.html#FS">FS</a>) Self() (<a href="index.html#Proc">Proc</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  260. <p>
  261. Self returns a process for the current process.
  262. </p>
  263. <h2 id="IPVSBackendStatus">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go?s=597:1165#L21">IPVSBackendStatus</a></h2>
  264. <pre>type IPVSBackendStatus struct {
  265. <span class="comment">// The local (virtual) IP address.</span>
  266. LocalAddress <a href="../../../net/index.html">net</a>.<a href="../../../net/index.html#IP">IP</a>
  267. <span class="comment">// The local (virtual) port.</span>
  268. LocalPort <a href="../../../builtin/index.html#uint16">uint16</a>
  269. <span class="comment">// The transport protocol (TCP, UDP).</span>
  270. Proto <a href="../../../builtin/index.html#string">string</a>
  271. <span class="comment">// The remote (real) IP address.</span>
  272. RemoteAddress <a href="../../../net/index.html">net</a>.<a href="../../../net/index.html#IP">IP</a>
  273. <span class="comment">// The remote (real) port.</span>
  274. RemotePort <a href="../../../builtin/index.html#uint16">uint16</a>
  275. <span class="comment">// The current number of active connections for this virtual/real address pair.</span>
  276. ActiveConn <a href="../../../builtin/index.html#uint64">uint64</a>
  277. <span class="comment">// The current number of inactive connections for this virtual/real address pair.</span>
  278. InactConn <a href="../../../builtin/index.html#uint64">uint64</a>
  279. <span class="comment">// The current weight of this virtual/real address pair.</span>
  280. Weight <a href="../../../builtin/index.html#uint64">uint64</a>
  281. }</pre>
  282. <p>
  283. IPVSBackendStatus holds current metrics of one virtual / real address pair.
  284. </p>
  285. <h2 id="IPVSStats">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go?s=213:516#L7">IPVSStats</a></h2>
  286. <pre>type IPVSStats struct {
  287. <span class="comment">// Total count of connections.</span>
  288. Connections <a href="../../../builtin/index.html#uint64">uint64</a>
  289. <span class="comment">// Total incoming packages processed.</span>
  290. IncomingPackets <a href="../../../builtin/index.html#uint64">uint64</a>
  291. <span class="comment">// Total outgoing packages processed.</span>
  292. OutgoingPackets <a href="../../../builtin/index.html#uint64">uint64</a>
  293. <span class="comment">// Total incoming traffic.</span>
  294. IncomingBytes <a href="../../../builtin/index.html#uint64">uint64</a>
  295. <span class="comment">// Total outgoing traffic.</span>
  296. OutgoingBytes <a href="../../../builtin/index.html#uint64">uint64</a>
  297. }</pre>
  298. <p>
  299. IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.
  300. </p>
  301. <h3 id="NewIPVSStats">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/ipvs.go?s=1210:1248#L41">NewIPVSStats</a></h3>
  302. <pre>func NewIPVSStats() (<a href="index.html#IPVSStats">IPVSStats</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  303. <p>
  304. NewIPVSStats reads the IPVS statistics.
  305. </p>
  306. <h2 id="MDStat">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/mdstat.go?s=267:628#L7">MDStat</a></h2>
  307. <pre>type MDStat struct {
  308. <span class="comment">// Name of the device.</span>
  309. Name <a href="../../../builtin/index.html#string">string</a>
  310. <span class="comment">// activity-state of the device.</span>
  311. ActivityState <a href="../../../builtin/index.html#string">string</a>
  312. <span class="comment">// Number of active disks.</span>
  313. DisksActive <a href="../../../builtin/index.html#int64">int64</a>
  314. <span class="comment">// Total number of disks the device consists of.</span>
  315. DisksTotal <a href="../../../builtin/index.html#int64">int64</a>
  316. <span class="comment">// Number of blocks the device holds.</span>
  317. BlocksTotal <a href="../../../builtin/index.html#int64">int64</a>
  318. <span class="comment">// Number of blocks on the device that are in sync.</span>
  319. BlocksSynced <a href="../../../builtin/index.html#int64">int64</a>
  320. }</pre>
  321. <p>
  322. MDStat holds info parsed from /proc/mdstat.
  323. </p>
  324. <h2 id="Proc">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=130:187#L2">Proc</a></h2>
  325. <pre>type Proc struct {
  326. <span class="comment">// The process ID.</span>
  327. PID <a href="../../../builtin/index.html#int">int</a>
  328. <span class="comment">// contains filtered or unexported fields</span>
  329. }</pre>
  330. <p>
  331. Proc provides information about a running process.
  332. </p>
  333. <h3 id="NewProc">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=693:728#L26">NewProc</a></h3>
  334. <pre>func NewProc(pid <a href="../../../builtin/index.html#int">int</a>) (<a href="index.html#Proc">Proc</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  335. <p>
  336. NewProc returns a process for the given pid under /proc.
  337. </p>
  338. <h3 id="Self">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=506:531#L17">Self</a></h3>
  339. <pre>func Self() (<a href="index.html#Proc">Proc</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  340. <p>
  341. Self returns a process for the current process read via /proc/self.
  342. </p>
  343. <h3 id="Proc.CmdLine">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=2127:2168#L90">CmdLine</a></h3>
  344. <pre>func (p <a href="index.html#Proc">Proc</a>) CmdLine() ([]<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  345. <p>
  346. CmdLine returns the command line of a process.
  347. </p>
  348. <h3 id="Proc.Comm">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=2507:2543#L110">Comm</a></h3>
  349. <pre>func (p <a href="index.html#Proc">Proc</a>) Comm() (<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  350. <p>
  351. Comm returns the command name of a process.
  352. </p>
  353. <h3 id="Proc.Executable">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=2834:2876#L126">Executable</a></h3>
  354. <pre>func (p <a href="index.html#Proc">Proc</a>) Executable() (<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  355. <p>
  356. Executable returns the absolute path of the executable command of a process.
  357. </p>
  358. <h3 id="Proc.FileDescriptorTargets">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=3613:3668#L156">FileDescriptorTargets</a></h3>
  359. <pre>func (p <a href="index.html#Proc">Proc</a>) FileDescriptorTargets() ([]<a href="../../../builtin/index.html#string">string</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  360. <p>
  361. FileDescriptorTargets returns the targets of all file descriptors of a process.
  362. If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string.
  363. </p>
  364. <h3 id="Proc.FileDescriptors">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=3062:3112#L136">FileDescriptors</a></h3>
  365. <pre>func (p <a href="index.html#Proc">Proc</a>) FileDescriptors() ([]<a href="../../../builtin/index.html#uintptr">uintptr</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  366. <p>
  367. FileDescriptors returns the currently open file descriptors of a process.
  368. </p>
  369. <h3 id="Proc.FileDescriptorsLen">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=4030:4077#L176">FileDescriptorsLen</a></h3>
  370. <pre>func (p <a href="index.html#Proc">Proc</a>) FileDescriptorsLen() (<a href="../../../builtin/index.html#int">int</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  371. <p>
  372. FileDescriptorsLen returns the number of currently open file descriptors of
  373. a process.
  374. </p>
  375. <h3 id="Proc.NewIO">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_io.go?s=572:609#L20">NewIO</a></h3>
  376. <pre>func (p <a href="index.html#Proc">Proc</a>) NewIO() (<a href="index.html#ProcIO">ProcIO</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  377. <p>
  378. NewIO creates a new ProcIO instance from a given Proc instance.
  379. </p>
  380. <h3 id="Proc.NewLimits">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_limits.go?s=2055:2100#L58">NewLimits</a></h3>
  381. <pre>func (p <a href="index.html#Proc">Proc</a>) NewLimits() (<a href="index.html#ProcLimits">ProcLimits</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  382. <p>
  383. NewLimits returns the current soft limits of the process.
  384. </p>
  385. <h3 id="Proc.NewStat">func (Proc) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go?s=3108:3149#L83">NewStat</a></h3>
  386. <pre>func (p <a href="index.html#Proc">Proc</a>) NewStat() (<a href="index.html#ProcStat">ProcStat</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  387. <p>
  388. NewStat returns the current status information of the process.
  389. </p>
  390. <h2 id="ProcIO">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_io.go?s=102:503#L1">ProcIO</a></h2>
  391. <pre>type ProcIO struct {
  392. <span class="comment">// Chars read.</span>
  393. RChar <a href="../../../builtin/index.html#uint64">uint64</a>
  394. <span class="comment">// Chars written.</span>
  395. WChar <a href="../../../builtin/index.html#uint64">uint64</a>
  396. <span class="comment">// Read syscalls.</span>
  397. SyscR <a href="../../../builtin/index.html#uint64">uint64</a>
  398. <span class="comment">// Write syscalls.</span>
  399. SyscW <a href="../../../builtin/index.html#uint64">uint64</a>
  400. <span class="comment">// Bytes read.</span>
  401. ReadBytes <a href="../../../builtin/index.html#uint64">uint64</a>
  402. <span class="comment">// Bytes written.</span>
  403. WriteBytes <a href="../../../builtin/index.html#uint64">uint64</a>
  404. <span class="comment">// Bytes written, but taking into account truncation. See</span>
  405. <span class="comment">// Documentation/filesystems/proc.txt in the kernel sources for</span>
  406. <span class="comment">// detailed explanation.</span>
  407. CancelledWriteBytes <a href="../../../builtin/index.html#int64">int64</a>
  408. }</pre>
  409. <p>
  410. ProcIO models the content of /proc/&lt;pid&gt;/io.
  411. </p>
  412. <h2 id="ProcLimits">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_limits.go?s=255:1875#L4">ProcLimits</a></h2>
  413. <pre>type ProcLimits struct {
  414. <span class="comment">// CPU time limit in seconds.</span>
  415. CPUTime <a href="../../../builtin/index.html#int">int</a>
  416. <span class="comment">// Maximum size of files that the process may create.</span>
  417. FileSize <a href="../../../builtin/index.html#int">int</a>
  418. <span class="comment">// Maximum size of the process&#39;s data segment (initialized data,</span>
  419. <span class="comment">// uninitialized data, and heap).</span>
  420. DataSize <a href="../../../builtin/index.html#int">int</a>
  421. <span class="comment">// Maximum size of the process stack in bytes.</span>
  422. StackSize <a href="../../../builtin/index.html#int">int</a>
  423. <span class="comment">// Maximum size of a core file.</span>
  424. CoreFileSize <a href="../../../builtin/index.html#int">int</a>
  425. <span class="comment">// Limit of the process&#39;s resident set in pages.</span>
  426. ResidentSet <a href="../../../builtin/index.html#int">int</a>
  427. <span class="comment">// Maximum number of processes that can be created for the real user ID of</span>
  428. <span class="comment">// the calling process.</span>
  429. Processes <a href="../../../builtin/index.html#int">int</a>
  430. <span class="comment">// Value one greater than the maximum file descriptor number that can be</span>
  431. <span class="comment">// opened by this process.</span>
  432. OpenFiles <a href="../../../builtin/index.html#int">int</a>
  433. <span class="comment">// Maximum number of bytes of memory that may be locked into RAM.</span>
  434. LockedMemory <a href="../../../builtin/index.html#int">int</a>
  435. <span class="comment">// Maximum size of the process&#39;s virtual memory address space in bytes.</span>
  436. AddressSpace <a href="../../../builtin/index.html#int">int</a>
  437. <span class="comment">// Limit on the combined number of flock(2) locks and fcntl(2) leases that</span>
  438. <span class="comment">// this process may establish.</span>
  439. FileLocks <a href="../../../builtin/index.html#int">int</a>
  440. <span class="comment">// Limit of signals that may be queued for the real user ID of the calling</span>
  441. <span class="comment">// process.</span>
  442. PendingSignals <a href="../../../builtin/index.html#int">int</a>
  443. <span class="comment">// Limit on the number of bytes that can be allocated for POSIX message</span>
  444. <span class="comment">// queues for the real user ID of the calling process.</span>
  445. MsqqueueSize <a href="../../../builtin/index.html#int">int</a>
  446. <span class="comment">// Limit of the nice priority set using setpriority(2) or nice(2).</span>
  447. NicePriority <a href="../../../builtin/index.html#int">int</a>
  448. <span class="comment">// Limit of the real-time priority set using sched_setscheduler(2) or</span>
  449. <span class="comment">// sched_setparam(2).</span>
  450. RealtimePriority <a href="../../../builtin/index.html#int">int</a>
  451. <span class="comment">// Limit (in microseconds) on the amount of CPU time that a process</span>
  452. <span class="comment">// scheduled under a real-time scheduling policy may consume without making</span>
  453. <span class="comment">// a blocking system call.</span>
  454. RealtimeTimeout <a href="../../../builtin/index.html#int">int</a>
  455. }</pre>
  456. <p>
  457. ProcLimits represents the soft limits for each of the process&#39;s resource
  458. limits. For more information see getrlimit(2):
  459. <a href="http://man7.org/linux/man-pages/man2/getrlimit.2.html">http://man7.org/linux/man-pages/man2/getrlimit.2.html</a>.
  460. </p>
  461. <h2 id="ProcStat">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go?s=1111:3040#L19">ProcStat</a></h2>
  462. <pre>type ProcStat struct {
  463. <span class="comment">// The process ID.</span>
  464. PID <a href="../../../builtin/index.html#int">int</a>
  465. <span class="comment">// The filename of the executable.</span>
  466. Comm <a href="../../../builtin/index.html#string">string</a>
  467. <span class="comment">// The process state.</span>
  468. State <a href="../../../builtin/index.html#string">string</a>
  469. <span class="comment">// The PID of the parent of this process.</span>
  470. PPID <a href="../../../builtin/index.html#int">int</a>
  471. <span class="comment">// The process group ID of the process.</span>
  472. PGRP <a href="../../../builtin/index.html#int">int</a>
  473. <span class="comment">// The session ID of the process.</span>
  474. Session <a href="../../../builtin/index.html#int">int</a>
  475. <span class="comment">// The controlling terminal of the process.</span>
  476. TTY <a href="../../../builtin/index.html#int">int</a>
  477. <span class="comment">// The ID of the foreground process group of the controlling terminal of</span>
  478. <span class="comment">// the process.</span>
  479. TPGID <a href="../../../builtin/index.html#int">int</a>
  480. <span class="comment">// The kernel flags word of the process.</span>
  481. Flags <a href="../../../builtin/index.html#uint">uint</a>
  482. <span class="comment">// The number of minor faults the process has made which have not required</span>
  483. <span class="comment">// loading a memory page from disk.</span>
  484. MinFlt <a href="../../../builtin/index.html#uint">uint</a>
  485. <span class="comment">// The number of minor faults that the process&#39;s waited-for children have</span>
  486. <span class="comment">// made.</span>
  487. CMinFlt <a href="../../../builtin/index.html#uint">uint</a>
  488. <span class="comment">// The number of major faults the process has made which have required</span>
  489. <span class="comment">// loading a memory page from disk.</span>
  490. MajFlt <a href="../../../builtin/index.html#uint">uint</a>
  491. <span class="comment">// The number of major faults that the process&#39;s waited-for children have</span>
  492. <span class="comment">// made.</span>
  493. CMajFlt <a href="../../../builtin/index.html#uint">uint</a>
  494. <span class="comment">// Amount of time that this process has been scheduled in user mode,</span>
  495. <span class="comment">// measured in clock ticks.</span>
  496. UTime <a href="../../../builtin/index.html#uint">uint</a>
  497. <span class="comment">// Amount of time that this process has been scheduled in kernel mode,</span>
  498. <span class="comment">// measured in clock ticks.</span>
  499. STime <a href="../../../builtin/index.html#uint">uint</a>
  500. <span class="comment">// Amount of time that this process&#39;s waited-for children have been</span>
  501. <span class="comment">// scheduled in user mode, measured in clock ticks.</span>
  502. CUTime <a href="../../../builtin/index.html#uint">uint</a>
  503. <span class="comment">// Amount of time that this process&#39;s waited-for children have been</span>
  504. <span class="comment">// scheduled in kernel mode, measured in clock ticks.</span>
  505. CSTime <a href="../../../builtin/index.html#uint">uint</a>
  506. <span class="comment">// For processes running a real-time scheduling policy, this is the negated</span>
  507. <span class="comment">// scheduling priority, minus one.</span>
  508. Priority <a href="../../../builtin/index.html#int">int</a>
  509. <span class="comment">// The nice value, a value in the range 19 (low priority) to -20 (high</span>
  510. <span class="comment">// priority).</span>
  511. Nice <a href="../../../builtin/index.html#int">int</a>
  512. <span class="comment">// Number of threads in this process.</span>
  513. NumThreads <a href="../../../builtin/index.html#int">int</a>
  514. <span class="comment">// The time the process started after system boot, the value is expressed</span>
  515. <span class="comment">// in clock ticks.</span>
  516. Starttime <a href="../../../builtin/index.html#uint64">uint64</a>
  517. <span class="comment">// Virtual memory size in bytes.</span>
  518. VSize <a href="../../../builtin/index.html#int">int</a>
  519. <span class="comment">// Resident set size in pages.</span>
  520. RSS <a href="../../../builtin/index.html#int">int</a>
  521. <span class="comment">// contains filtered or unexported fields</span>
  522. }</pre>
  523. <p>
  524. ProcStat provides status information about the process,
  525. read from /proc/[pid]/stat.
  526. </p>
  527. <h3 id="ProcStat.CPUTime">func (ProcStat) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go?s=4595:4630#L163">CPUTime</a></h3>
  528. <pre>func (s <a href="index.html#ProcStat">ProcStat</a>) CPUTime() <a href="../../../builtin/index.html#float64">float64</a></pre>
  529. <p>
  530. CPUTime returns the total CPU user and system time in seconds.
  531. </p>
  532. <h3 id="ProcStat.ResidentMemory">func (ProcStat) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go?s=4198:4236#L149">ResidentMemory</a></h3>
  533. <pre>func (s <a href="index.html#ProcStat">ProcStat</a>) ResidentMemory() <a href="../../../builtin/index.html#int">int</a></pre>
  534. <p>
  535. ResidentMemory returns the resident memory size in bytes.
  536. </p>
  537. <h3 id="ProcStat.StartTime">func (ProcStat) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go?s=4342:4388#L154">StartTime</a></h3>
  538. <pre>func (s <a href="index.html#ProcStat">ProcStat</a>) StartTime() (<a href="../../../builtin/index.html#float64">float64</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  539. <p>
  540. StartTime returns the unix timestamp of the process in seconds.
  541. </p>
  542. <h3 id="ProcStat.VirtualMemory">func (ProcStat) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc_stat.go?s=4078:4115#L144">VirtualMemory</a></h3>
  543. <pre>func (s <a href="index.html#ProcStat">ProcStat</a>) VirtualMemory() <a href="../../../builtin/index.html#int">int</a></pre>
  544. <p>
  545. VirtualMemory returns the virtual memory size in bytes.
  546. </p>
  547. <h2 id="Procs">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=233:250#L10">Procs</a></h2>
  548. <pre>type Procs []<a href="index.html#Proc">Proc</a></pre>
  549. <p>
  550. Procs represents a list of Proc structs.
  551. </p>
  552. <h3 id="AllProcs">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=913:943#L35">AllProcs</a></h3>
  553. <pre>func AllProcs() (<a href="index.html#Procs">Procs</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  554. <p>
  555. AllProcs returns a list of all currently available processes under /proc.
  556. </p>
  557. <h3 id="Procs.Len">func (Procs) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=252:276#L12">Len</a></h3>
  558. <pre>func (p <a href="index.html#Procs">Procs</a>) Len() <a href="../../../builtin/index.html#int">int</a></pre>
  559. <h3 id="Procs.Less">func (Procs) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=368:402#L14">Less</a></h3>
  560. <pre>func (p <a href="index.html#Procs">Procs</a>) Less(i, j <a href="../../../builtin/index.html#int">int</a>) <a href="../../../builtin/index.html#bool">bool</a></pre>
  561. <h3 id="Procs.Swap">func (Procs) <a href="http://localhost:6060/src/github.com/prometheus/procfs/proc.go?s=305:334#L13">Swap</a></h3>
  562. <pre>func (p <a href="index.html#Procs">Procs</a>) Swap(i, j <a href="../../../builtin/index.html#int">int</a>)</pre>
  563. <h2 id="Stat">type <a href="http://localhost:6060/src/github.com/prometheus/procfs/stat.go?s=117:195#L2">Stat</a></h2>
  564. <pre>type Stat struct {
  565. <span class="comment">// Boot time in seconds since the Epoch.</span>
  566. BootTime <a href="../../../builtin/index.html#int64">int64</a>
  567. }</pre>
  568. <p>
  569. Stat represents kernel/system statistics.
  570. </p>
  571. <h3 id="NewStat">func <a href="http://localhost:6060/src/github.com/prometheus/procfs/stat.go?s=263:291#L8">NewStat</a></h3>
  572. <pre>func NewStat() (<a href="index.html#Stat">Stat</a>, <a href="../../../builtin/index.html#error">error</a>)</pre>
  573. <p>
  574. NewStat returns kernel/system statistics read from /proc/stat.
  575. </p>
  576. <div id="footer">
  577. Build version go1.6.<br>
  578. Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  579. the content of this page is licensed under the
  580. Creative Commons Attribution 3.0 License,
  581. and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
  582. <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
  583. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  584. </div>
  585. </div><!-- .container -->
  586. </div><!-- #page -->
  587. <!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
  588. <script type="text/javascript" src="../../../../lib/godoc/jquery.js"></script>
  589. <script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.js"></script>
  590. <script type="text/javascript" src="../../../../lib/godoc/jquery.treeview.edit.js"></script>
  591. <script type="text/javascript" src="../../../../lib/godoc/godocs.js"></script>
  592. </body>
  593. </html>