aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/trace
diff options
context:
space:
mode:
authorHana Kim <hakim@google.com>2018-05-31 16:14:04 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2018-06-01 19:33:34 +0000
commitc7519f0daee3289e9877266af21fe69905fd0d9c (patch)
tree1c1d1e9db8224b9e41d7e5477c35529648f757a9 /src/runtime/trace
parentb280edb89eae1974e3f218726814b03b3558e005 (diff)
downloadgo-c7519f0daee3289e9877266af21fe69905fd0d9c.tar.xz
runtime/trace: remove remaining NewContext reference
This is a documentation error. Change-Id: I083021f151f7e80a0b9083b98452ae1f5920640d Reviewed-on: https://go-review.googlesource.com/115598 Reviewed-by: Peter Weinberger <pjw@google.com>
Diffstat (limited to 'src/runtime/trace')
-rw-r--r--src/runtime/trace/trace.go41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/runtime/trace/trace.go b/src/runtime/trace/trace.go
index f3ea312d27..b6a594355a 100644
--- a/src/runtime/trace/trace.go
+++ b/src/runtime/trace/trace.go
@@ -70,7 +70,7 @@
// operations such as an RPC request, an HTTP request, or an
// interesting local operation which may require multiple goroutines
// working together. Since tasks can involve multiple goroutines,
-// they are tracked via a context.Context object. NewContext creates
+// they are tracked via a context.Context object. NewTask creates
// a new task and embeds it in the returned context.Context object.
// Log messages and regions are attached to the task, if any, in the
// Context passed to Log and WithRegion.
@@ -80,26 +80,27 @@
// the trace tool can identify the goroutines involved in a specific
// cappuccino order.
//
-// ctx, taskEnd:= trace.NewContext(ctx, "makeCappuccino")
-// trace.Log(ctx, "orderID", orderID)
-//
-// milk := make(chan bool)
-// espresso := make(chan bool)
+// ctx, task := trace.NewTask(ctx, "makeCappuccino")
+// trace.Log(ctx, "orderID", orderID)
+
+// milk := make(chan bool)
+// espresso := make(chan bool)
+
+// go func() {
+// trace.WithRegion(ctx, "steamMilk", steamMilk)
+// milk <- true
+// }()
+// go func() {
+// trace.WithRegion(ctx, "extractCoffee", extractCoffee)
+// espresso <- true
+// }()
+// go func() {
+// defer task.End() // When assemble is done, the order is complete.
+// <-espresso
+// <-milk
+// trace.WithRegion(ctx, "mixMilkCoffee", mixMilkCoffee)
+// }()
//
-// go func() {
-// trace.WithRegion(ctx, "steamMilk", steamMilk)
-// milk<-true
-// })()
-// go func() {
-// trace.WithRegion(ctx, "extractCoffee", extractCoffee)
-// espresso<-true
-// })()
-// go func() {
-// defer taskEnd() // When assemble is done, the order is complete.
-// <-espresso
-// <-milk
-// trace.WithRegion(ctx, "mixMilkCoffee", mixMilkCoffee)
-// })()
//
// The trace tool computes the latency of a task by measuring the
// time between the task creation and the task end and provides