Rows were already too long to fit on a standard-width terminal, yet we were truncating names to fit in an arbitrary width. Instead put the table name on the right and let it fill all available space.
Call ClearLine() after displaying each row so that displaying a shorter row when the display updates will not pollute the side of the screen.
Make sure we don't try to draw lines too low down on the screen.
app.screen.BoldPrintAt(0, 2, app.tiwsbt.Headings())
max_rows := app.screen.Height() - 3
app.screen.BoldPrintAt(0, 2, app.tiwsbt.Headings())
max_rows := app.screen.Height() - 3
+ last_row := app.screen.Height() - 1
row_content := app.tiwsbt.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
row_content := app.tiwsbt.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
+ app.screen.ClearLine(len(row_content[k]), y)
}
// print out empty rows
}
// print out empty rows
- for k := len(row_content); k < (app.screen.Height() - 3); k++ {
+ for k := len(row_content); k < max_rows; k++ {
- if y < app.screen.Height()-1 {
app.screen.PrintAt(0, y, app.tiwsbt.EmptyRowContent())
}
}
// print out the totals at the bottom
app.screen.PrintAt(0, y, app.tiwsbt.EmptyRowContent())
}
}
// print out the totals at the bottom
- app.screen.BoldPrintAt(0, app.screen.Height()-1, app.tiwsbt.TotalRowContent())
+ total := app.tiwsbt.TotalRowContent()
+ app.screen.BoldPrintAt(0, last_row, total)
+ app.screen.ClearLine(len(total), last_row)
}
// show actual I/O latency values
}
// show actual I/O latency values
app.screen.BoldPrintAt(0, 2, app.fsbi.Headings())
// print out the data
app.screen.BoldPrintAt(0, 2, app.fsbi.Headings())
// print out the data
- max_rows := app.screen.Height() - 3
+ max_rows := app.screen.Height() - 4
+ last_row := app.screen.Height() - 1
row_content := app.fsbi.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
row_content := app.fsbi.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
+ app.screen.ClearLine(len(row_content[k]), y)
}
// print out empty rows
}
// print out empty rows
- for k := len(row_content); k < (app.screen.Height() - 3); k++ {
+ for k := len(row_content); k < max_rows; k++ {
- if y < app.screen.Height()-1 {
app.screen.PrintAt(0, y, app.fsbi.EmptyRowContent())
}
}
// print out the totals at the bottom
app.screen.PrintAt(0, y, app.fsbi.EmptyRowContent())
}
}
// print out the totals at the bottom
- app.screen.BoldPrintAt(0, app.screen.Height()-1, app.fsbi.TotalRowContent())
+ total := app.fsbi.TotalRowContent()
+ app.screen.BoldPrintAt(0, last_row, total)
+ app.screen.ClearLine(len(total), last_row)
}
func (app *App) displayLocks() {
app.screen.BoldPrintAt(0, 2, app.tlwsbt.Headings())
// print out the data
}
func (app *App) displayLocks() {
app.screen.BoldPrintAt(0, 2, app.tlwsbt.Headings())
// print out the data
- max_rows := app.screen.Height() - 3
+ max_rows := app.screen.Height() - 4
+ last_row := app.screen.Height() - 1
row_content := app.tlwsbt.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
row_content := app.tlwsbt.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
+ app.screen.ClearLine(len(row_content[k]), y)
}
// print out empty rows
for k := len(row_content); k < (app.screen.Height() - 3); k++ {
y := 3 + k
}
// print out empty rows
for k := len(row_content); k < (app.screen.Height() - 3); k++ {
y := 3 + k
- if y < app.screen.Height()-1 {
app.screen.PrintAt(0, y, app.tlwsbt.EmptyRowContent())
}
}
// print out the totals at the bottom
app.screen.PrintAt(0, y, app.tlwsbt.EmptyRowContent())
}
}
// print out the totals at the bottom
- app.screen.BoldPrintAt(0, app.screen.Height()-1, app.tlwsbt.TotalRowContent())
+ total := app.tlwsbt.TotalRowContent()
+ app.screen.BoldPrintAt(0, last_row, total)
+ app.screen.ClearLine(len(total), last_row)
}
func (app *App) displayUsers() {
app.screen.BoldPrintAt(0, 2, app.users.Headings())
// print out the data
}
func (app *App) displayUsers() {
app.screen.BoldPrintAt(0, 2, app.users.Headings())
// print out the data
- max_rows := app.screen.Height() - 3
+ max_rows := app.screen.Height() - 4
+ last_row := app.screen.Height() - 1
row_content := app.users.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
row_content := app.users.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
+ app.screen.ClearLine(len(row_content[k]), y)
}
// print out empty rows
}
// print out empty rows
- for k := len(row_content); k < (app.screen.Height() - 3); k++ {
+ for k := len(row_content); k < max_rows; k++ {
- if y < app.screen.Height()-1 {
app.screen.PrintAt(0, y, app.users.EmptyRowContent())
}
}
// print out the totals at the bottom
app.screen.PrintAt(0, y, app.users.EmptyRowContent())
}
}
// print out the totals at the bottom
- app.screen.BoldPrintAt(0, app.screen.Height()-1, app.users.TotalRowContent())
+ total := app.users.TotalRowContent()
+ app.screen.BoldPrintAt(0, last_row, total)
+ app.screen.ClearLine(len(total), last_row)
}
func (app *App) displayMutex() {
app.screen.BoldPrintAt(0, 2, app.ewsgben.Headings())
// print out the data
}
func (app *App) displayMutex() {
app.screen.BoldPrintAt(0, 2, app.ewsgben.Headings())
// print out the data
- max_rows := app.screen.Height() - 3
+ max_rows := app.screen.Height() - 4
+ last_row := app.screen.Height() - 1
row_content := app.ewsgben.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
row_content := app.ewsgben.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
+ app.screen.ClearLine(len(row_content[k]), y)
}
// print out empty rows
}
// print out empty rows
- for k := len(row_content); k < (app.screen.Height() - 3); k++ {
+ for k := len(row_content); k < max_rows; k++ {
- if y < app.screen.Height()-1 {
app.screen.PrintAt(0, y, app.ewsgben.EmptyRowContent())
}
}
// print out the totals at the bottom
app.screen.PrintAt(0, y, app.ewsgben.EmptyRowContent())
}
}
// print out the totals at the bottom
- app.screen.BoldPrintAt(0, app.screen.Height()-1, app.ewsgben.TotalRowContent())
+ total := app.ewsgben.TotalRowContent()
+ app.screen.BoldPrintAt(0, last_row, total)
+ app.screen.ClearLine(len(total), last_row)
}
func (app *App) displayStages() {
app.screen.BoldPrintAt(0, 2, app.essgben.Headings())
// print out the data
}
func (app *App) displayStages() {
app.screen.BoldPrintAt(0, 2, app.essgben.Headings())
// print out the data
- max_rows := app.screen.Height() - 3
+ max_rows := app.screen.Height() - 4
+ last_row := app.screen.Height() - 1
row_content := app.essgben.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
row_content := app.essgben.RowContent(max_rows)
// print out rows
for k := range row_content {
y := 3 + k
app.screen.PrintAt(0, y, row_content[k])
+ app.screen.ClearLine(len(row_content[k]), y)
}
// print out empty rows
}
// print out empty rows
- for k := len(row_content); k < (app.screen.Height() - 3); k++ {
+ for k := len(row_content); k < max_rows; k++ {
- if y < app.screen.Height()-1 {
app.screen.PrintAt(0, y, app.essgben.EmptyRowContent())
}
}
// print out the totals at the bottom
app.screen.PrintAt(0, y, app.essgben.EmptyRowContent())
}
}
// print out the totals at the bottom
- app.screen.BoldPrintAt(0, app.screen.Height()-1, app.essgben.TotalRowContent())
+ total := app.essgben.TotalRowContent()
+ app.screen.BoldPrintAt(0, last_row, total)
+ app.screen.ClearLine(len(total), last_row)
}
// do we want to show all p_s data?
}
// do we want to show all p_s data?
type pl_by_user_rows []pl_by_user_row
/*
type pl_by_user_rows []pl_by_user_row
/*
-username |Run Time %age|Sleeping %|Conn Actv|Hosts DBs|Sel Ins Upd Del Oth|
-xxxxxxxxxxxxxx|hh:mm:ss 100.0%|hh:mm:ss 100.0%|9999 9999|9999 999|999 999 999 999 999|
+Run Time %age|Sleeping %|Conn Actv|Hosts DBs|Sel Ins Upd Del Oth|username
+hh:mm:ss 100.0%|hh:mm:ss 100.0%|9999 9999|9999 999|999 999 999 999 999|xxxxxxxxxxxxxx
*/
func (r *pl_by_user_row) headings() string {
*/
func (r *pl_by_user_row) headings() string {
- return fmt.Sprintf("%-14s|%-8s %6s|%-8s %6s|%4s %4s|%5s %3s|%3s %3s %3s %3s %3s|",
- "User", "Run Time", "%", "Sleeping", "%", "Conn", "Actv", "Hosts", "DBs", "Sel", "Ins", "Upd", "Del", "Oth")
+ return fmt.Sprintf("%-8s %6s|%-8s %6s|%4s %4s|%5s %3s|%3s %3s %3s %3s %3s|%s",
+ "Run Time", "%", "Sleeping", "%", "Conn", "Actv", "Hosts", "DBs", "Sel", "Ins", "Upd", "Del", "Oth", "User")
}
// generate a printable result
func (r *pl_by_user_row) row_content(totals pl_by_user_row) string {
}
// generate a printable result
func (r *pl_by_user_row) row_content(totals pl_by_user_row) string {
- var u string
- if len(r.username) == 0 {
- u = ""
- } else if len(r.username) > 14 {
- u = r.username[0:14]
- } else {
- u = r.username
- }
- return fmt.Sprintf("%-14s|%8s %6s|%8s %6s|%4s %4s|%5s %3s|%3s %3s %3s %3s %3s|",
- u,
+ 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.FormatSeconds(r.runtime),
lib.FormatPct(lib.MyDivide(r.runtime, totals.runtime)),
lib.FormatSeconds(r.sleeptime),
lib.FormatCounter(int(r.inserts), 3),
lib.FormatCounter(int(r.updates), 3),
lib.FormatCounter(int(r.deletes), 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))
+ lib.FormatCounter(int(r.other), 3),
+ r.username)
}
// generate a row of totals from a table
}
// generate a row of totals from a table
// describe a whole row
func (r pl_by_user_row) String() string {
// describe a whole row
func (r pl_by_user_row) String() string {
- return fmt.Sprintf("%v %v %v %v %v %v %v %v %v %v", r.username, r.runtime, r.connections, r.sleeptime, r.active, r.hosts, r.dbs, r.selects, r.inserts, r.updates, r.deletes, r.other)
+ return fmt.Sprintf("%v %v %v %v %v %v %v %v %v %v", r.runtime, r.connections, r.sleeptime, r.active, r.hosts, r.dbs, r.selects, r.inserts, r.updates, r.deletes, r.other, r.username)
}
// total time is runtime + sleeptime
}
// total time is runtime + sleeptime
-// stage name limited to 40 characters
-func (r *table_row) pretty_name() string {
- s := r.name()
- if len(s) > 40 {
- s = s[:39]
- }
- return s
-}
-
// add the values of one row to another one
func (this *table_row) add(other table_row) {
this.SUM_TIMER_WAIT += other.SUM_TIMER_WAIT
// add the values of one row to another one
func (this *table_row) add(other table_row) {
this.SUM_TIMER_WAIT += other.SUM_TIMER_WAIT
// stage headings
func (r *table_row) headings() string {
// stage headings
func (r *table_row) headings() string {
- return fmt.Sprintf("%-40s|%10s %6s %8s|", "Stage Name", "Latency", "%", "Counter")
+ return fmt.Sprintf("%10s %6s %8s|%s", "Latency", "%", "Counter", "Stage Name")
}
// generate a printable result
func (r *table_row) row_content(totals table_row) string {
}
// generate a printable result
func (r *table_row) row_content(totals table_row) string {
- name := r.pretty_name()
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
- return fmt.Sprintf("%-40s|%10s %6s %8s|",
- name,
+ return fmt.Sprintf("%10s %6s %8s|%s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
- lib.FormatAmount(r.COUNT_STAR))
+ lib.FormatAmount(r.COUNT_STAR),
+ name)
}
// describe a whole row
func (r table_row) String() string {
}
// describe a whole row
func (r table_row) String() string {
- return fmt.Sprintf("%-40s %10s %10s",
- r.pretty_name(),
+ return fmt.Sprintf("%10s %10s %s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatTime(r.SUM_TIMER_WAIT),
- lib.FormatAmount(r.COUNT_STAR))
+ lib.FormatAmount(r.COUNT_STAR),
+ r.name())
}
// describe a whole table
}
// describe a whole table
-func (r *table_row) pretty_name() string {
- s := r.name()
- if len(s) > 30 {
- s = s[:29]
- }
- return s
-}
-
func (r *table_row) headings() string {
func (r *table_row) headings() string {
- return fmt.Sprintf("%-30s %10s %6s %6s", "Mutex Name", "Latency", "MtxCnt", "%")
+ return fmt.Sprintf("%10s %6s %6s %s", "Latency", "MtxCnt", "%", "Mutex Name")
}
// generate a printable result
func (r *table_row) row_content(totals table_row) string {
}
// generate a printable result
func (r *table_row) row_content(totals table_row) string {
- name := r.pretty_name()
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
- return fmt.Sprintf("%-30s|%10s %6s %6s",
- name,
+ return fmt.Sprintf("%10s %6s %6s|%s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatAmount(r.COUNT_STAR),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatAmount(r.COUNT_STAR),
- lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)))
+ lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
+ name)
}
func (this *table_row) add(other table_row) {
}
func (this *table_row) add(other table_row) {
// describe a whole row
func (r table_row) String() string {
// describe a whole row
func (r table_row) String() string {
- return fmt.Sprintf("%-30s|%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s",
- r.pretty_name(),
+ return fmt.Sprintf("%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s|%s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatTime(r.SUM_TIMER_WAIT),
- lib.FormatAmount(r.COUNT_STAR))
+ lib.FormatAmount(r.COUNT_STAR),
+ r.name())
}
// describe a whole table
}
// describe a whole table
-// Return a formatted pretty name for the row.
-func (r *table_row) pretty_name() string {
- s := r.name()
- if len(s) > 30 {
- s = s[:29]
- }
- return s
-}
-
func (r *table_row) headings() string {
func (r *table_row) headings() string {
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s",
- "Table Name",
+ return fmt.Sprintf("%10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s|%s",
+ "M Ops",
+ "Table Name")
}
// generate a printable result
func (row *table_row) row_content(totals table_row) string {
}
// generate a printable result
func (row *table_row) row_content(totals table_row) string {
- var name string = row.pretty_name()
+ var name string = row.name()
// We assume that if COUNT_STAR = 0 then there's no data at all...
// when we have no data we really don't want to show the name either.
// We assume that if COUNT_STAR = 0 then there's no data at all...
// when we have no data we really don't want to show the name either.
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s",
- name,
+ return fmt.Sprintf("%10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s|%s",
lib.FormatTime(row.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(row.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(row.SUM_TIMER_READ, row.SUM_TIMER_WAIT)),
lib.FormatTime(row.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(row.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(row.SUM_TIMER_READ, row.SUM_TIMER_WAIT)),
lib.FormatAmount(row.COUNT_STAR),
lib.FormatPct(lib.MyDivide(row.COUNT_READ, row.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(row.COUNT_WRITE, row.COUNT_STAR)),
lib.FormatAmount(row.COUNT_STAR),
lib.FormatPct(lib.MyDivide(row.COUNT_READ, row.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(row.COUNT_WRITE, row.COUNT_STAR)),
- lib.FormatPct(lib.MyDivide(row.COUNT_MISC, row.COUNT_STAR)))
+ lib.FormatPct(lib.MyDivide(row.COUNT_MISC, row.COUNT_STAR)),
+ name)
}
func (this *table_row) add(other table_row) {
}
func (this *table_row) add(other table_row) {
-func (r *table_row) pretty_name() string {
- s := r.name()
- if len(s) > 30 {
- s = s[:29]
- }
- return s
-}
-
func (r *table_row) latency_headings() string {
func (r *table_row) latency_headings() string {
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s %6s", "Table Name", "Latency", "%", "Fetch", "Insert", "Update", "Delete")
+ return fmt.Sprintf("%10s %6s|%6s %6s %6s %6s|%s", "Latency", "%", "Fetch", "Insert", "Update", "Delete", "Table Name")
}
func (r *table_row) ops_headings() string {
}
func (r *table_row) ops_headings() string {
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s %6s", "Table Name", "Ops", "%", "Fetch", "Insert", "Update", "Delete")
+ return fmt.Sprintf("%10s %6s|%6s %6s %6s %6s|%s", "Ops", "%", "Fetch", "Insert", "Update", "Delete", "Table Name")
}
// generate a printable result
func (r *table_row) latency_row_content(totals table_row) string {
// assume the data is empty so hide it.
}
// generate a printable result
func (r *table_row) latency_row_content(totals table_row) string {
// assume the data is empty so hide it.
- name := r.pretty_name()
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s %6s",
- name,
+ return fmt.Sprintf("%10s %6s|%6s %6s %6s %6s|%s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_FETCH, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_INSERT, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_UPDATE, r.SUM_TIMER_WAIT)),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_FETCH, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_INSERT, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_UPDATE, r.SUM_TIMER_WAIT)),
- lib.FormatPct(lib.MyDivide(r.SUM_TIMER_DELETE, r.SUM_TIMER_WAIT)))
+ lib.FormatPct(lib.MyDivide(r.SUM_TIMER_DELETE, r.SUM_TIMER_WAIT)),
+ name)
}
// generate a printable result for ops
func (r *table_row) ops_row_content(totals table_row) string {
// assume the data is empty so hide it.
}
// generate a printable result for ops
func (r *table_row) ops_row_content(totals table_row) string {
// assume the data is empty so hide it.
- name := r.pretty_name()
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s %6s",
- name,
+ return fmt.Sprintf("%10s %6s|%6s %6s %6s %6s|%s",
lib.FormatAmount(r.COUNT_STAR),
lib.FormatPct(lib.MyDivide(r.COUNT_STAR, totals.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(r.COUNT_FETCH, r.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(r.COUNT_INSERT, r.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(r.COUNT_UPDATE, r.COUNT_STAR)),
lib.FormatAmount(r.COUNT_STAR),
lib.FormatPct(lib.MyDivide(r.COUNT_STAR, totals.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(r.COUNT_FETCH, r.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(r.COUNT_INSERT, r.COUNT_STAR)),
lib.FormatPct(lib.MyDivide(r.COUNT_UPDATE, r.COUNT_STAR)),
- lib.FormatPct(lib.MyDivide(r.COUNT_DELETE, r.COUNT_STAR)))
+ lib.FormatPct(lib.MyDivide(r.COUNT_DELETE, r.COUNT_STAR)),
+ name)
}
func (this *table_row) add(other table_row) {
}
func (this *table_row) add(other table_row) {
// describe a whole row
func (r table_row) String() string {
// describe a whole row
func (r table_row) String() string {
- return fmt.Sprintf("%-30s|%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s",
- r.pretty_name(),
+ return fmt.Sprintf("%s|%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s",
+ r.name(),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatTime(r.SUM_TIMER_FETCH),
lib.FormatTime(r.SUM_TIMER_INSERT),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatTime(r.SUM_TIMER_FETCH),
lib.FormatTime(r.SUM_TIMER_INSERT),
-func (r *table_row) pretty_name() string {
- s := r.name()
- if len(s) > 30 {
- s = s[:29]
- }
- return s
-}
-
-// Table Name Latency %| Read Write|S.Lock High NoIns Normal Extrnl|AlloWr CncIns WrtDly Low Normal Extrnl|
-// xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1234567890 100.0%|xxxxx% xxxxx%|xxxxx% xxxxx% xxxxx% xxxxx% xxxxx%|xxxxx% xxxxx% xxxxx% xxxxx% xxxxx% xxxxx%|
+// Latency %| Read Write|S.Lock High NoIns Normal Extrnl|AlloWr CncIns WrtDly Low Normal Extrnl|
+// 1234567 100.0%|xxxxx% xxxxx%|xxxxx% xxxxx% xxxxx% xxxxx% xxxxx%|xxxxx% xxxxx% xxxxx% xxxxx% xxxxx% xxxxx%|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
func (r *table_row) headings() string {
func (r *table_row) headings() string {
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s|%6s %6s %6s %6s %6s|%6s %6s %6s %6s %6s",
- "Table Name", "Latency", "%",
+ return fmt.Sprintf("%10s %6s|%6s %6s|%6s %6s %6s %6s %6s|%6s %6s %6s %6s %6s|%-30s",
+ "Latency", "%",
"Read", "Write",
"S.Lock", "High", "NoIns", "Normal", "Extrnl",
"Read", "Write",
"S.Lock", "High", "NoIns", "Normal", "Extrnl",
- "AlloWr", "CncIns", "Low", "Normal", "Extrnl")
+ "AlloWr", "CncIns", "Low", "Normal", "Extrnl",
+ "Table Name")
}
// generate a printable result
func (r *table_row) row_content(totals table_row) string {
// assume the data is empty so hide it.
}
// generate a printable result
func (r *table_row) row_content(totals table_row) string {
// assume the data is empty so hide it.
- name := r.pretty_name()
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
- return fmt.Sprintf("%-30s %10s %6s|%6s %6s|%6s %6s %6s %6s %6s|%6s %6s %6s %6s %6s",
- name,
+ return fmt.Sprintf("%10s %6s|%6s %6s|%6s %6s %6s %6s %6s|%6s %6s %6s %6s %6s|%s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WAIT, totals.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_CONCURRENT_INSERT, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_LOW_PRIORITY, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_NORMAL, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_CONCURRENT_INSERT, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_LOW_PRIORITY, r.SUM_TIMER_WAIT)),
lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_NORMAL, r.SUM_TIMER_WAIT)),
- lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_EXTERNAL, r.SUM_TIMER_WAIT)))
+ lib.FormatPct(lib.MyDivide(r.SUM_TIMER_WRITE_EXTERNAL, r.SUM_TIMER_WAIT)),
+ name)
}
func (this *table_row) add(other table_row) {
}
func (this *table_row) add(other table_row) {
// describe a whole row
func (r table_row) String() string {
// describe a whole row
func (r table_row) String() string {
- return fmt.Sprintf("%-30s|%10s %10s %10s|%10s %10s %10s %10s %10s|%10s %10s %10s %10s %10s",
- r.pretty_name(),
+ return fmt.Sprintf("%10s %10s %10s|%10s %10s %10s %10s %10s|%10s %10s %10s %10s %10s|%s",
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatTime(r.SUM_TIMER_READ),
lib.FormatTime(r.SUM_TIMER_WRITE),
lib.FormatTime(r.SUM_TIMER_WAIT),
lib.FormatTime(r.SUM_TIMER_READ),
lib.FormatTime(r.SUM_TIMER_WRITE),
lib.FormatTime(r.SUM_TIMER_WRITE_CONCURRENT_INSERT),
lib.FormatTime(r.SUM_TIMER_WRITE_LOW_PRIORITY),
lib.FormatTime(r.SUM_TIMER_WRITE_NORMAL),
lib.FormatTime(r.SUM_TIMER_WRITE_CONCURRENT_INSERT),
lib.FormatTime(r.SUM_TIMER_WRITE_LOW_PRIORITY),
lib.FormatTime(r.SUM_TIMER_WRITE_NORMAL),
- lib.FormatTime(r.SUM_TIMER_WRITE_EXTERNAL))
+ lib.FormatTime(r.SUM_TIMER_WRITE_EXTERNAL),
+ r.name())
}
// describe a whole table
}
// describe a whole table