// TsEmit encode and write a row of data to os.Stdout
// with ts in milliseconds epoch time
773103
func TsEmit(ts int64, anyObject ...interface{}) error {
	stat.Stats[0].OutputCounter++
	return util.NewRow(ts, anyObject...).WriteTo(os.Stdout)
}
866713
func (l *Lexer) emit(kind TokenKind) {
	l.produce(kind, l.input[l.start:l.pos])
}
703714
func RunOutput(args ...string) ([]byte, error) {
	stdout := bytes.NewBuffer(nil)
	err := RunStdout(stdout, args...)
	return stdout.Bytes(), err
}
906630
func ioOutputFormatFunction(ld *LineData, b *bytes.Buffer) error {
	_, err := b.WriteString(ld.CallingFunction)
	return err
}
1137850
func encodeTimestamp(buf *bytes.Buffer, name string, val Timestamp) error {
	// type
	if err := buf.WriteByte(_TIMESTAMP); err != nil {
		return err
	}

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	return binary.Write(buf, binary.LittleEndian, uint64(val))
}
421868
func gofmt(blob []byte) ([]byte, error) {
	out := bytes.Buffer{}
	cmd := exec.Command("gofmt", "-s")
	cmd.Stdin = bytes.NewReader(blob)
	cmd.Stdout = &out
	cmd.Stderr = os.Stderr
	if err := cmd.Run(); err != nil {
		return nil, err
	}
	return out.Bytes(), nil
}
1074232
func (s *scanner) emitSimple(t tokenType, v string) *token {
	token := &token{t, v, s.row, s.col}
	s.col += len(v)
	s.pos += len(v)
	return token
}
1234251
func (z *Row) EncodeMsg(en *msgp.Writer) (err error) {
	if p, ok := interface{}(z).(msgp.PreSave); ok {
		p.PreSaveHook()
	}

	// honor the omitempty tags
	var empty_zgensym_56fd93edf47ccbd5_6 [3]bool
	fieldsInUse_zgensym_56fd93edf47ccbd5_7 := z.fieldsNotEmpty(empty_zgensym_56fd93edf47ccbd5_6[:])

	// map header
	err = en.WriteMapHeader(fieldsInUse_zgensym_56fd93edf47ccbd5_7)
	if err != nil {
		return err
	}

	if !empty_zgensym_56fd93edf47ccbd5_6[0] {
		// write "K__slc"
		err = en.Append(0xa6, 0x4b, 0x5f, 0x5f, 0x73, 0x6c, 0x63)
		if err != nil {
			return err
		}
		err = en.WriteArrayHeader(uint32(len(z.K)))
		if err != nil {
			return
		}
		for zgensym_56fd93edf47ccbd5_0 := range z.K {
			err = en.WriteIntf(z.K[zgensym_56fd93edf47ccbd5_0])
			if err != nil {
				return
			}
		}
	}

	if !empty_zgensym_56fd93edf47ccbd5_6[1] {
		// write "V__slc"
		err = en.Append(0xa6, 0x56, 0x5f, 0x5f, 0x73, 0x6c, 0x63)
		if err != nil {
			return err
		}
		err = en.WriteArrayHeader(uint32(len(z.V)))
		if err != nil {
			return
		}
		for zgensym_56fd93edf47ccbd5_1 := range z.V {
			err = en.WriteIntf(z.V[zgensym_56fd93edf47ccbd5_1])
			if err != nil {
				return
			}
		}
	}

	if !empty_zgensym_56fd93edf47ccbd5_6[2] {
		// write "T__i64"
		err = en.Append(0xa6, 0x54, 0x5f, 0x5f, 0x69, 0x36, 0x34)
		if err != nil {
			return err
		}
		err = en.WriteInt64(z.T)
		if err != nil {
			return
		}
	}

	return
}
627532
func newPrettyStdout(w io.Writer) *prettyStdout {
	return &prettyStdout{
		writer: w,
		buffer: bytes.NewBuffer([]byte{}),
	}
}
600993
func writeLayerReexec() {
	size, err := writeLayer(os.Stdin, os.Args[1], os.Args[2], os.Args[3:]...)
	if err != nil {
		fmt.Fprint(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Fprint(os.Stdout, size)
}
376247
func (f FeedMeta) StatusForStdout() string {
	if f.Newly() {
		return "Newly"
	} else if f.OutDated() {
		red := color.New(color.FgRed, color.Bold).SprintFunc()
		return red("Out-Dated")
	} else if f.UpToDate() {
		return color.GreenString("Up-to-Date")
	}
	return "Unknown"
}
722059
func Stdout(val io.Writer) OptionSet {
	return func(o *Options) {
		o.Stdout = val
	}
}
1155597
func ioOutputFormatEpoch(ld *LineData, b *bytes.Buffer) error {
	_, err := b.WriteString(fmt.Sprintf("%d", int(ld.TimeStamp.Unix())))
	return err
}
1189121
func (l *StringLexer) Emit(t ItemType) {
	l.items <- l.Grab(t)
	l.start = l.pos
}
350699
func (r *renderedStack) dumpTo(w io.Writer, excludePkgs ...string) (n int, err error) {
	excludeSet := stringset.NewFromSlice(excludePkgs...)

	return iotools.WriteTracker(w, func(w io.Writer) error {
		fmt.Fprintf(w, "goroutine %d:\n", r.goID)

		lastIdx := 0
		needNL := false
		skipCount := 0
		skipPkg := ""
		flushSkips := func(extra string) {
			if skipCount != 0 {
				if needNL {
					w.Write(nlSlice)
					needNL = false
				}
				fmt.Fprintf(w, "... skipped %d frames in pkg %q...\n%s", skipCount, skipPkg, extra)
				skipCount = 0
				skipPkg = ""
			}
		}
		for i, f := range r.frames {
			if needNL {
				w.Write(nlSlice)
				needNL = false
			}
			if excludeSet.Has(f.pkg) {
				if skipPkg == f.pkg {
					skipCount++
				} else {
					flushSkips("")
					skipCount++
					skipPkg = f.pkg
				}
				continue
			}
			flushSkips("\n")
			if len(f.wrappers) > 0 {
				f.dumpWrappersTo(w, lastIdx, i)
				w.Write(nlSlice)
			}
			if len(f.annotations) > 0 {
				lastIdx = i
				needNL = true
			}
			f.dumpTo(w, i)
		}
		flushSkips("")

		return nil
	})
}
1043321
func (z *Archive) EncodeMsg(en *msgp.Writer) (err error) {
	// map header, size 4
	// write "RowKey"
	err = en.Append(0x84, 0xa6, 0x52, 0x6f, 0x77, 0x4b, 0x65, 0x79)
	if err != nil {
		return
	}
	err = en.WriteString(z.RowKey)
	if err != nil {
		err = msgp.WrapError(err, "RowKey")
		return
	}
	// write "SecondsPerPoint"
	err = en.Append(0xaf, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x50, 0x65, 0x72, 0x50, 0x6f, 0x69, 0x6e, 0x74)
	if err != nil {
		return
	}
	err = en.WriteUint32(z.SecondsPerPoint)
	if err != nil {
		err = msgp.WrapError(err, "SecondsPerPoint")
		return
	}
	// write "Points"
	err = en.Append(0xa6, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73)
	if err != nil {
		return
	}
	err = en.WriteUint32(z.Points)
	if err != nil {
		err = msgp.WrapError(err, "Points")
		return
	}
	// write "Chunks"
	err = en.Append(0xa6, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73)
	if err != nil {
		return
	}
	err = en.WriteArrayHeader(uint32(len(z.Chunks)))
	if err != nil {
		err = msgp.WrapError(err, "Chunks")
		return
	}
	for za0001 := range z.Chunks {
		err = z.Chunks[za0001].EncodeMsg(en)
		if err != nil {
			err = msgp.WrapError(err, "Chunks", za0001)
			return
		}
	}
	return
}
23723
func Stdout() io.Writer {
	stdout := colorable.NewColorableStdout()
	if stdout == os.Stdout {
		return os.Stdout
	}

	return &WinColorTerminal{output: stdout}
}