-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathruntime_trace.htm
109 lines (60 loc) · 3.88 KB
/
runtime_trace.htm
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head profile="http://a9.com/-/spec/opensearch/1.1/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../assets/site.css" rel="stylesheet">
<title>runtime/trace</title>
<meta name="twitter:title" content="Package trace">
<meta property="og:title" content="Package trace">
<meta name="description" content="Go execution tracer.">
<meta name="twitter:description" content="Go execution tracer.">
<meta property="og:description" content="Go execution tracer.">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@golang">
</head>
<body>
<div class="container">
<h2 id="pkg-overview">package trace</h2>
<p><code>import "runtime/trace"</code>
<p>
Go execution tracer.
The tracer captures a wide range of execution events like goroutine
creation/blocking/unblocking, syscall enter/exit/block, GC-related events,
changes of heap size, processor start/stop, etc and writes them to an io.Writer
in a compact form. A precise nanosecond-precision timestamp and a stack
trace is captured for most events. A trace can be analyzed later with
'go tool trace' command.</p>
<h3 id="pkg-index" class="section-header">Index <a class="permalink" href="#pkg-index">¶</a></h3>
<ul class="list-unstyled">
<li><a href="#Start">func Start(w io.Writer) error</a></li><li><a href="#Stop">func Stop()</a></li>
</ul>
<span id="pkg-examples"></span>
<h4 id="pkg-files">
<a href="https://github.com/golang/go/blob/master/src/runtime/trace/">Package Files</a>
<a class="permalink" href="#pkg-files">¶</a>
</h4>
<p><a href="https://github.com/golang/go/blob/master/src/runtime/trace/trace.go">trace.go</a> </p>
<h3 id="Start" data-kind="f">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/runtime/trace/trace.go#L22">Start</a> <a class="permalink" href="#Start">¶</a> <a class="uses" title="List Function Callers" href="https://sourcegraph.com/-/godoc/refs?def=Start&pkg=runtime%2Ftrace&repo=">Uses</a></h3>
<div class="funcdecl decl"><a title="View Source" href="https://github.com/golang/go/blob/master/src/runtime/trace/trace.go#L22">❖</a><pre>func Start(w <a href="/io">io</a>.<a href="/io#Writer">Writer</a>) <a href="/builtin#error">error</a></pre></div><p>
Start enables tracing for the current program.
While tracing, the trace will be buffered and written to w.
Start returns an error if tracing is already enabled.
</p>
<h3 id="Stop" data-kind="f">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/runtime/trace/trace.go#L40">Stop</a> <a class="permalink" href="#Stop">¶</a> <a class="uses" title="List Function Callers" href="https://sourcegraph.com/-/godoc/refs?def=Stop&pkg=runtime%2Ftrace&repo=">Uses</a></h3>
<div class="funcdecl decl"><a title="View Source" href="https://github.com/golang/go/blob/master/src/runtime/trace/trace.go#L40">❖</a><pre>func Stop()</pre></div><p>
Stop stops the current tracing, if any.
Stop only returns after all the writes for the trace have completed.
</p>
<div id="x-footer" class="clearfix">
<div class="container">
<a href="http://studygolang.com/" target="_blank">Go语言中文网</a>
<span class="text-muted">|</span> <a href="http://golang.org/" target="_blank">Go Language</a>
<span class="pull-right"><a href="#">Back to top</a></span>
</div>
</div>
<script src="../assets/jquery-2.0.3.min.js"></script>
<script src="../assets/bootstrap.min.js"></script>
<script src="../assets/site.js"></script>
</body>
</html>