// 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))) }
// 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) }
// 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) }
// 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) }
// 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)) }
// 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) }
// 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()) }
// describe a whole row func (r Row) String() string { return fmt.Sprintf("%10s %10s %10s|%10s %10s %10s %10s %10s|%10s %10s %10s %10s %10s|%s", lib.FormatTime(r.sumTimerWait), lib.FormatTime(r.sumTimerRead), lib.FormatTime(r.sumTimerWrite), lib.FormatTime(r.sumTimerReadWithSharedLocks), lib.FormatTime(r.sumTimerReadHighPriority), lib.FormatTime(r.sumTimerReadNoInsert), lib.FormatTime(r.sumTimerReadNormal), lib.FormatTime(r.sumTimerReadExternal), lib.FormatTime(r.sumTimerWriteAllowWrite), lib.FormatTime(r.sumTimerWriteConcurrentInsert), lib.FormatTime(r.sumTimerWriteLowPriority), lib.FormatTime(r.sumTimerWriteNormal), lib.FormatTime(r.sumTimerWriteExternal), r.name) }