Ejemplo n.º 1
0
Archivo: base.go Proyecto: denji/ps-top
// HeadingLine returns the heading line as a string
func (d *BaseDisplay) HeadingLine() string {
	var heading string

	headingStart := d.MyName() + " " + d.ctx.Version() + " - " + nowHHMMSS() + " " + d.ctx.Hostname() + " / " + d.ctx.MySQLVersion() + ", up " + fmt.Sprintf("%-16s", lib.Uptime(d.Uptime()))

	if d.ctx.WantRelativeStats() {
		heading = headingStart + " [REL] " + fmt.Sprintf("%.0f seconds", relativeTime(d.Last()))
	} else {
		heading = headingStart + " [ABS]             "
	}
	return heading
}
Ejemplo n.º 2
0
// HeadingLine returns the heading line as a string
func (d *BaseDisplay) HeadingLine(haveRelativeStats, wantRelativeStats bool, initial, last time.Time) string {
	heading := d.MyName() + " " + d.ctx.Version() + " - " + nowHHMMSS() + " " + d.ctx.Hostname() + " / " + d.ctx.MySQLVersion() + ", up " + fmt.Sprintf("%-16s", lib.Uptime(d.Uptime()))

	if haveRelativeStats {
		if wantRelativeStats {
			heading += " [REL] " + fmt.Sprintf("%.0f seconds", time.Since(initial).Seconds())
		} else {
			heading += " [ABS]             "
		}
	}
	return heading
}