Ejemplo n.º 1
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)
}
Ejemplo n.º 2
0
// latencyRowContents reutrns the printable result
func (row Row) latencyRowContent(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.FormatTime(row.sumTimerWait),
		lib.FormatPct(lib.MyDivide(row.sumTimerWait, totals.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerFetch, row.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerInsert, row.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerUpdate, row.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(row.sumTimerDelete, row.sumTimerWait)),
		name)
}
Ejemplo n.º 3
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)))
}
Ejemplo n.º 4
0
// generate a printable result
func (r *PlByUserRow) rowContent(totals PlByUserRow) string {
	return fmt.Sprintf("%8s %6s|%8s %6s|%4s %4s|%5s %3s|%3s %3s %3s %3s %3s|%s",
		lib.FormatSeconds(r.runtime),
		lib.FormatPct(lib.MyDivide(r.runtime, totals.runtime)),
		lib.FormatSeconds(r.sleeptime),
		lib.FormatPct(lib.MyDivide(r.sleeptime, totals.sleeptime)),
		lib.FormatCounter(int(r.connections), 4),
		lib.FormatCounter(int(r.active), 4),
		lib.FormatCounter(int(r.hosts), 5),
		lib.FormatCounter(int(r.dbs), 3),
		lib.FormatCounter(int(r.selects), 3),
		lib.FormatCounter(int(r.inserts), 3),
		lib.FormatCounter(int(r.updates), 3),
		lib.FormatCounter(int(r.deletes), 3),
		lib.FormatCounter(int(r.other), 3),
		r.username)
}
Ejemplo n.º 5
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)
}
Ejemplo n.º 6
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)
}
Ejemplo n.º 7
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)
}
Ejemplo n.º 8
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.sumTimerWait == 0 && name != "Totals" {
		name = ""
	}

	return fmt.Sprintf("%10s %6s|%6s %6s|%6s %6s %6s %6s %6s|%6s %6s %6s %6s %6s|%s",
		lib.FormatTime(r.sumTimerWait),
		lib.FormatPct(lib.MyDivide(r.sumTimerWait, totals.sumTimerWait)),

		lib.FormatPct(lib.MyDivide(r.sumTimerRead, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerWrite, r.sumTimerWait)),

		lib.FormatPct(lib.MyDivide(r.sumTimerReadWithSharedLocks, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerReadHighPriority, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerReadNoInsert, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerReadNormal, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerReadExternal, r.sumTimerWait)),

		lib.FormatPct(lib.MyDivide(r.sumTimerWriteAllowWrite, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerWriteConcurrentInsert, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerWriteLowPriority, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerWriteNormal, r.sumTimerWait)),
		lib.FormatPct(lib.MyDivide(r.sumTimerWriteExternal, r.sumTimerWait)),
		name)
}