code: func Stop() {
  	// Wait for on-going traces.
  	globals.wg.Wait()
  	globals.lockWriter.Lock()
  	defer globals.lockWriter.Unlock()
  	globals.lockContexts.Lock()
  	defer globals.lockContexts.Unlock()
  	if globals.out != nil {
  		// TODO(maruel): Dump all the stack frames.
  		_, _ = globals.out.Write(footerEvents)
  	}
  	globals.lockID.Lock()
  	defer globals.lockID.Unlock()
  	globals.out = nil
  	globals.contexts = nil
  	globals.nextPID = 0
  	globals.nextID = 0
  
  	// Lower back clock frequency once we're done.
  	lowerClockFrequency()
  }
docs: // Stop stops the trace.
  //
  // It is important to call it so the trace file is properly formatted. Tracing
  // events after this call are ignored.