// Print dumps a text representation of a profile. Intended mainly
// for debugging purposes.
421792
func (p *Profile) String() string {

	ss := make([]string, 0, len(p.Sample)+len(p.Mapping)+len(p.Location))
	if pt := p.PeriodType; pt != nil {
		ss = append(ss, fmt.Sprintf("PeriodType: %s %s", pt.Type, pt.Unit))
	}
	ss = append(ss, fmt.Sprintf("Period: %d", p.Period))
	if p.TimeNanos != 0 {
		ss = append(ss, fmt.Sprintf("Time: %v", time.Unix(0, p.TimeNanos)))
	}
	if p.DurationNanos != 0 {
		ss = append(ss, fmt.Sprintf("Duration: %v", time.Duration(p.DurationNanos)))
	}

	ss = append(ss, "Samples:")
	var sh1 string
	for _, s := range p.SampleType {
		sh1 = sh1 + fmt.Sprintf("%s/%s ", s.Type, s.Unit)
	}
	ss = append(ss, strings.TrimSpace(sh1))
	for _, s := range p.Sample {
		var sv string
		for _, v := range s.Value {
			sv = fmt.Sprintf("%s %10d", sv, v)
		}
		sv = sv + ": "
		for _, l := range s.Location {
			sv = sv + fmt.Sprintf("%d ", l.ID)
		}
		ss = append(ss, sv)
		const labelHeader = "                "
		if len(s.Label) > 0 {
			ls := labelHeader
			for k, v := range s.Label {
				ls = ls + fmt.Sprintf("%s:%v ", k, v)
			}
			ss = append(ss, ls)
		}
		if len(s.NumLabel) > 0 {
			ls := labelHeader
			for k, v := range s.NumLabel {
				ls = ls + fmt.Sprintf("%s:%v ", k, v)
			}
			ss = append(ss, ls)
		}
	}

	ss = append(ss, "Locations")
	for _, l := range p.Location {
		locStr := fmt.Sprintf("%6d: %#x ", l.ID, l.Address)
		if m := l.Mapping; m != nil {
			locStr = locStr + fmt.Sprintf("M=%d ", m.ID)
		}
		if len(l.Line) == 0 {
			ss = append(ss, locStr)
		}
		for li := range l.Line {
			lnStr := "??"
			if fn := l.Line[li].Function; fn != nil {
				lnStr = fmt.Sprintf("%s %s:%d s=%d",
					fn.Name,
					fn.Filename,
					l.Line[li].Line,
					fn.StartLine)
				if fn.Name != fn.SystemName {
					lnStr = lnStr + "(" + fn.SystemName + ")"
				}
			}
			ss = append(ss, locStr+lnStr)
			// Do not print location details past the first line
			locStr = "             "
		}
	}

	ss = append(ss, "Mappings")
	for _, m := range p.Mapping {
		bits := ""
		if m.HasFunctions {
			bits = bits + "[FN]"
		}
		if m.HasFilenames {
			bits = bits + "[FL]"
		}
		if m.HasLineNumbers {
			bits = bits + "[LN]"
		}
		if m.HasInlineFrames {
			bits = bits + "[IN]"
		}
		ss = append(ss, fmt.Sprintf("%d: %#x/%#x/%#x %s %s %s",
			m.ID,
			m.Start, m.Limit, m.Offset,
			m.File,
			m.BuildID,
			bits))
	}

	return strings.Join(ss, "\n") + "\n"
}
393441
func (state *ServicesState) Print(list *memberlist.Memberlist) {
	log.Println(state.Format(list))
}
576962
func (p *MJPEGPrinter) Print(r io.Reader, fps int) error {
	showCursor(p.w, false)
	defer showCursor(p.w, true)
	go p.handleInterrupt()

	reader := mjpegStreamer{
		r:   r,
		fps: fps,
	}

	for frame := range reader.ReadAll() {
		if frame.err != nil {
			return frame.err
		}

		frame.img = redraw(frame.img, p.c.Filter, p.c.Drawer)

		// Draw the image and reset the cursor
		if err := flush(p.w, frame.img, p.c.Flusher); err != nil {
			return err
		}
		rows := frame.img.Bounds().Dy() / 4
		if frame.img.Bounds().Dy()%4 != 0 {
			rows++
		}

		resetCursor(p.w, rows)
	}

	return nil
}
1145152
func Print(vs ...interface{}) {
	args, options := extractOptions(vs...)
	New(os.Stdout, options...).Print(args...)
}
916257
func print(thread *Thread, fn *Builtin, args Tuple, kwargs []Tuple) (Value, error) {
	var buf bytes.Buffer
	path := make([]Value, 0, 4)
	sep := ""
	for _, v := range args {
		buf.WriteString(sep)
		if s, ok := AsString(v); ok {
			buf.WriteString(s)
		} else {
			writeValue(&buf, v, path)
		}
		sep = " "
	}
	for _, pair := range kwargs {
		buf.WriteString(sep)
		buf.WriteString(string(pair[0].(String)))
		buf.WriteString("=")
		if s, ok := AsString(pair[1]); ok {
			buf.WriteString(s)
		} else {
			writeValue(&buf, pair[1], path)
		}
		sep = " "
	}

	if thread.Print != nil {
		thread.Print(thread, buf.String())
	} else {
		fmt.Fprintln(os.Stderr, &buf)
	}
	return None, nil
}
390340
func (l *Logger) Print(v ...interface{}) {
	if e := l.Debug(); e.Enabled() {
		e.Msg(fmt.Sprint(v...))
	}
}
934184
func (t *PairTree) Print(w io.Writer, f PairIterateFunc, itemSiz int) {
	t.ObjectTree.Print(w, func(v interface{}) bool { return f(v.(Pair)) }, itemSiz)
}
375829
func (rt *RoutingTable) Print() {
	fmt.Printf("Routing Table, bs = %d, Max latency = %d\n", rt.bucketsize, rt.maxLatency)
	rt.tabLock.RLock()

	for i, b := range rt.Buckets {
		fmt.Printf("\tbucket: %d\n", i)

		b.lk.RLock()
		for e := b.list.Front(); e != nil; e = e.Next() {
			p := e.Value.(peer.ID)
			fmt.Printf("\t\t- %s %s\n", p.Pretty(), rt.metrics.LatencyEWMA(p).String())
		}
		b.lk.RUnlock()
	}
	rt.tabLock.RUnlock()
}
622363
func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
	return fmt.Fprint(w, formatAll(a)...)
}
318288
func (n *node) print(w io.Writer, level int) {
	fmt.Fprintf(w, "%sNODE:%v\n", strings.Repeat("  ", level), n.items)
	for _, c := range n.children {
		c.print(w, level+1)
	}
}
397736
func (p FmtPrinter) Print(logger *Logger, a ...interface{}) {
	b := make([]interface{}, 1)
	b[0] = logger.Color(logger.Name)
	a = append(b, a...)
	fmt.Fprint(os.Stderr, a...)
}
141908
func (mp *MultiProgressBar) Print() {
	moveCursorUp(uint(len(mp.ProgressBars)))

	for _, p := range mp.ProgressBars {
		moveCursorDown(1)
		p.Print()
	}
}
496650
func (p *VersionedColumnPrinter) Print(out interface{}) ([]string, []byte, error) {
	var output []byte
	if obj, ok := out.(runtime.Object); ok {
		converted, err := p.convertor.ConvertToVersion(obj, p.version)
		if err != nil {
			if !runtime.IsNotRegisteredError(err) {
				return nil, nil, err
			}
			converted = obj
		}
		data, err := json.Marshal(converted)
		if err != nil {
			return nil, nil, err
		}
		output = data
		out = map[string]interface{}{}
		if err := json.Unmarshal(data, &out); err != nil {
			return nil, nil, err
		}
	}
	args, _, err := p.printer.Print(out)
	return args, output, err
}
471791
func (m *StyleWriter) Print(s []*Style) string {
	if len(s) <= 0 {
		return ""
	}

	css := []string{}

	for _, cs := range s {
		css = append(css, fmt.Sprintf(styleformt, cs.Name, cs.Value))
	}

	return strings.Join(css, " ")
}
843969
func (w *Writer) Print() error {
	w.mtx.Lock()
	defer w.mtx.Unlock()
	// do nothing if buffer is empty
	if len(w.Buf.Bytes()) == 0 {
		return nil
	}

	var currentLine bytes.Buffer
	for _, b := range w.Buf.Bytes() {
		if b == '\n' {
			w.lineCount++
			currentLine.Reset()
		} else {
			currentLine.Write([]byte{b})
			if currentLine.Len() > termWidth {
				w.lineCount++
				currentLine.Reset()
			}
		}
	}
	_, err := w.Out.Write(w.Buf.Bytes())
	w.Buf.Reset()
	return err
}
722903
func (cfg *Config) Fprint(w io.Writer, vals ...interface{}) (n int64, err error) {
	buf := new(bytes.Buffer)
	cfg.fprint(buf, vals...)
	return buf.WriteTo(w)
}
443700
func (db *MemDB) Print() {
	db.mtx.Lock()
	defer db.mtx.Unlock()

	for key, value := range db.db {
		fmt.Printf("[%X]:\t[%X]\n", []byte(key), value)
	}
}