func (r *pl_by_user_row) headings() string {
return fmt.Sprintf("%-14s|%10s %6s|%4s %4s|%5s %3s|%6s %6s %6s %6s %6s|",
- "username", "Run Time", "%", "Conn", "Actv", "Hosts", "DBs", "Select", "Insert", "Update", "Delete", "Other")
+ "User", "Run Time", "%", "Conn", "Actv", "Hosts", "DBs", "Select", "Insert", "Update", "Delete", "Other")
}
// generate a printable result
// generate a row of totals from a table
func (t pl_by_user_rows) totals() pl_by_user_row {
var totals pl_by_user_row
- totals.username = "TOTALS"
+ totals.username = "Totals"
for i := range t {
totals.runtime += t[i].runtime
func (t File_summary_by_instance) Description() string {
count := t.count_rows()
- return fmt.Sprintf("File I/O by filename (file_summary_by_instance) %4d row(s) ", count)
+ return fmt.Sprintf("I/O Latency by File (file_summary_by_instance) %4d row(s) ", count)
}
// create a new structure and include various variable values:
if len(s) > 30 {
s = s[:29]
}
- return fmt.Sprintf("%-30s", s)
+ return s
}
func (r *file_summary_by_instance_row) headings() string {
// generate a printable result
func (row *file_summary_by_instance_row) row_content(totals file_summary_by_instance_row) string {
- var name string
+ var name string = row.pretty_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.
- if row.COUNT_STAR == 0 {
+ if row.COUNT_STAR == 0 && name != "Totals" {
name = ""
- } else {
- name = row.pretty_name()
}
return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s",
// return the totals of a slice of rows
func (t file_summary_by_instance_rows) totals() file_summary_by_instance_row {
var totals file_summary_by_instance_row
- totals.FILE_NAME = "TOTALS"
+ totals.FILE_NAME = "Totals"
for i := range t {
totals.add(t[i])
if len(s) > 30 {
s = s[:29]
}
- return fmt.Sprintf("%-30s", s)
+ return s
}
func (r *table_io_waits_summary_by_table_row) latency_headings() string {
func (r *table_io_waits_summary_by_table_row) latency_row_content(totals table_io_waits_summary_by_table_row) string {
// assume the data is empty so hide it.
name := r.pretty_name()
- if r.COUNT_STAR == 0 {
+ if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
func (r *table_io_waits_summary_by_table_row) ops_row_content(totals table_io_waits_summary_by_table_row) string {
// assume the data is empty so hide it.
name := r.pretty_name()
- if r.COUNT_STAR == 0 {
+ if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
func (t table_io_waits_summary_by_table_rows) totals() table_io_waits_summary_by_table_row {
var totals table_io_waits_summary_by_table_row
- totals.OBJECT_SCHEMA = "TOTALS"
+ totals.OBJECT_SCHEMA = "Totals"
for i := range t {
totals.add(t[i])
if len(s) > 30 {
s = s[:29]
}
- return fmt.Sprintf("%-30s", s)
+ return s
}
// Table Name Latency %| Read Write|S.Lock High NoIns Normal Extrnl|AlloWr CncIns WrtDly Low Normal Extrnl|
// assume the data is empty so hide it.
name := r.pretty_name()
- if r.COUNT_STAR == 0 {
+ if r.COUNT_STAR == 0 && name != "Totals" {
name = ""
}
// return the totals of a slice of rows
func (t table_lock_waits_summary_by_table_rows) totals() table_lock_waits_summary_by_table_row {
var totals table_lock_waits_summary_by_table_row
- totals.OBJECT_SCHEMA = "TOTALS"
+ totals.OBJECT_SCHEMA = "Totals"
for i := range t {
totals.add(t[i])
s.Flush()
}
+// print the characters in bold (for headings) but don't print them outside the screen
+func (s *TermboxScreen) BoldPrintAt(x int, y int, text string) {
+ offset := 0
+ for c := range text {
+ if (x + offset) < s.width {
+ termbox.SetCell(x+offset, y, rune(text[c]), s.fg | termbox.AttrBold, s.bg)
+ offset++
+ }
+ }
+ s.Flush()
+}
+
func (s *TermboxScreen) DisplayHelp() {
s.PrintAt(0, 0, lib.MyName()+" version "+version.Version()+" (C) 2014 Simon J Mudd <sjmudd@pobox.com>")
}
func (state *State) displayOpsOrLatency() {
- state.screen.PrintAt(0, 2, state.tiwsbt.Headings())
+ state.screen.BoldPrintAt(0, 2, state.tiwsbt.Headings())
max_rows := state.screen.Height() - 3
row_content := state.tiwsbt.RowContent(max_rows)
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.tiwsbt.TotalRowContent())
+ state.screen.BoldPrintAt(0, state.screen.Height()-1, state.tiwsbt.TotalRowContent())
}
// show actual I/O latency values
func (state State) displayIO() {
- state.screen.PrintAt(0, 2, state.fsbi.Headings())
+ state.screen.BoldPrintAt(0, 2, state.fsbi.Headings())
// print out the data
max_rows := state.screen.Height() - 3
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.fsbi.TotalRowContent())
+ state.screen.BoldPrintAt(0, state.screen.Height()-1, state.fsbi.TotalRowContent())
}
func (state *State) displayLocks() {
- state.screen.PrintAt(0, 2, state.tlwsbt.Headings())
+ state.screen.BoldPrintAt(0, 2, state.tlwsbt.Headings())
// print out the data
max_rows := state.screen.Height() - 3
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.tlwsbt.TotalRowContent())
+ state.screen.BoldPrintAt(0, state.screen.Height()-1, state.tlwsbt.TotalRowContent())
}
func (state *State) displayUsers() {
- state.screen.PrintAt(0, 2, state.users.Headings())
+ state.screen.BoldPrintAt(0, 2, state.users.Headings())
// print out the data
max_rows := state.screen.Height() - 3
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.users.TotalRowContent())
+ state.screen.BoldPrintAt(0, state.screen.Height()-1, state.users.TotalRowContent())
}
// do we want to show all p_s data?