예제 #1
0
파일: base.go 프로젝트: 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
}
예제 #2
0
파일: base.go 프로젝트: ChengShuY/ps-top
// 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
}