Пример #1
0
// describe a whole row
func (row Row) String() string {
	return fmt.Sprintf("%s|%10s %6s %6s",
		row.name,
		lib.FormatTime(row.sumTimerWait),
		lib.FormatAmount(row.countStar),
		lib.FormatPct(lib.MyDivide(row.sumTimerWait, row.sumTimerWait)))
}
Пример #2
0
// generate a printable result
func (r *Row) rowContent(totals Row) string {

	// assume the data is empty so hide it.
	name := r.name()
	if r.totalMemoryOps == 0 && name != "Totals" {
		name = ""
	}

	return fmt.Sprintf("%10s  %6s  %10s|%10s %6s|%8s  %6s  %8s|%s",
		lib.FormatAmount(r.currentBytesUsed),
		lib.FormatPct(lib.MyDivide(r.currentBytesUsed, totals.currentBytesUsed)),
		lib.FormatAmount(r.highBytesUsed),
		lib.FormatAmount(r.totalMemoryOps),
		lib.FormatPct(lib.MyDivide(r.totalMemoryOps, totals.totalMemoryOps)),
		lib.FormatAmount(r.currentCountAlloc),
		lib.FormatPct(lib.MyDivide(r.currentCountAlloc, totals.currentCountAlloc)),
		lib.FormatAmount(r.highCountAlloc),
		name)
}
Пример #3
0
// generate a printable result
func (row *Row) rowContent(totals Row) string {
	name := row.name
	if row.countStar == 0 && name != "Totals" {
		name = ""
	}

	return fmt.Sprintf("%10s %8s %8s|%s",
		lib.FormatTime(row.sumTimerWait),
		lib.FormatAmount(row.countStar),
		lib.FormatPct(lib.MyDivide(row.sumTimerWait, totals.sumTimerWait)),
		name)
}
Пример #4
0
// generate a printable result
func (row Row) rowContent(totals Row) string {
	var name = row.name

	// We assume that if countStar = 0 then there's no data at all...
	// when we have no data we really don't want to show the name either.
	if (row.sumTimerWait == 0 && row.countStar == 0 && row.sumNumberOfBytesRead == 0 && row.sumNumberOfBytesWrite == 0) && name != "Totals" {
		name = ""
	}

	return fmt.Sprintf("%10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s|%s",
		lib.FormatTime(row.sumTimerWait),
		lib.FormatPct(lib.MyDivide(row.sumTimerWait, totals.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerRead, row.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerWrite, row.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerMisc, row.sumTimerWait)),
		lib.FormatAmount(row.sumNumberOfBytesRead),
		lib.FormatAmount(row.sumNumberOfBytesWrite),
		lib.FormatAmount(row.countStar),
		lib.FormatPct(lib.MyDivide(row.countRead, row.countStar)),
		lib.FormatPct(lib.MyDivide(row.countWrite, row.countStar)),
		lib.FormatPct(lib.MyDivide(row.countMisc, row.countStar)),
		name)
}
Пример #5
0
// generate a printable result for ops
func (row Row) opsRowContent(totals Row) string {
	// assume the data is empty so hide it.
	name := row.name
	if row.countStar == 0 && name != "Totals" {
		name = ""
	}

	return fmt.Sprintf("%10s %6s|%6s %6s %6s %6s|%s",
		lib.FormatAmount(row.countStar),
		lib.FormatPct(lib.MyDivide(row.countStar, totals.countStar)),
		lib.FormatPct(lib.MyDivide(row.countFetch, row.countStar)),
		lib.FormatPct(lib.MyDivide(row.countInsert, row.countStar)),
		lib.FormatPct(lib.MyDivide(row.countUpdate, row.countStar)),
		lib.FormatPct(lib.MyDivide(row.countDelete, row.countStar)),
		name)
}
Пример #6
0
// describe a whole row
func (row Row) String() string {
	return fmt.Sprintf("%s|%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s",
		row.name,
		lib.FormatTime(row.sumTimerWait),
		lib.FormatTime(row.sumTimerFetch),
		lib.FormatTime(row.sumTimerInsert),
		lib.FormatTime(row.sumTimerUpdate),
		lib.FormatTime(row.sumTimerDelete),

		lib.FormatTime(row.sumTimerRead),
		lib.FormatTime(row.sumTimerWrite),

		lib.FormatAmount(row.countStar),
		lib.FormatAmount(row.countFetch),
		lib.FormatAmount(row.countInsert),
		lib.FormatAmount(row.countUpdate),
		lib.FormatAmount(row.countDelete),

		lib.FormatAmount(row.countRead),
		lib.FormatAmount(row.countWrite))
}
Пример #7
0
// String describes a whole row
func (row Row) String() string {
	return fmt.Sprintf("%10s %10s %s",
		lib.FormatTime(row.sumTimerWait),
		lib.FormatAmount(row.countStar),
		row.name())
}