]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/trace: remove remaining NewContext reference
authorHana Kim <hakim@google.com>
Thu, 31 May 2018 20:14:04 +0000 (16:14 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Fri, 1 Jun 2018 19:33:34 +0000 (19:33 +0000)
This is a documentation error.

Change-Id: I083021f151f7e80a0b9083b98452ae1f5920640d
Reviewed-on: https://go-review.googlesource.com/115598
Reviewed-by: Peter Weinberger <pjw@google.com>
src/runtime/trace/trace.go

index f3ea312d277bc755393f005a3bffd8873c9b0826..b6a594355a9f877063b4551ba469ecb7d009dea2 100644 (file)
@@ -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.
 // 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)
-//
-//     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)
-//     })()
+//      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)
+//      }()
+//
 //
 // The trace tool computes the latency of a task by measuring the
 // time between the task creation and the task end and provides