X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=p_s%2Ftable_lock_waits_summary_by_table%2Fprivate.go;h=3e2eed67395bffbcfcf8901e85c23769e2bf3074;hb=HEAD;hp=60b5b7ba5b038e23c557de4ada90ff9cf79ca1f9;hpb=c8c04e8564616826091e9ac5e24bc411b557081f;p=pstop.git diff --git a/p_s/table_lock_waits_summary_by_table/private.go b/p_s/table_lock_waits_summary_by_table/private.go index 60b5b7b..3e2eed6 100644 --- a/p_s/table_lock_waits_summary_by_table/private.go +++ b/p_s/table_lock_waits_summary_by_table/private.go @@ -135,35 +135,27 @@ func (r *table_row) name() string { return n } -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 { - 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", - "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. - name := r.pretty_name() + name := r.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)), @@ -180,7 +172,8 @@ func (r *table_row) row_content(totals table_row) string { 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) { @@ -231,7 +224,7 @@ func (t table_rows) totals() table_row { // - filter out empty values // - merge rows with the same name into a single row // - change FILE_NAME into a more descriptive value. -func select_tlwsbt_rows(dbh *sql.DB) table_rows { +func select_rows(dbh *sql.DB) table_rows { var t table_rows sql := "SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, SUM_TIMER_WAIT, SUM_TIMER_READ, SUM_TIMER_WRITE, SUM_TIMER_READ_WITH_SHARED_LOCKS, SUM_TIMER_READ_HIGH_PRIORITY, SUM_TIMER_READ_NO_INSERT, SUM_TIMER_READ_NORMAL, SUM_TIMER_READ_EXTERNAL, SUM_TIMER_WRITE_ALLOW_WRITE, SUM_TIMER_WRITE_CONCURRENT_INSERT, SUM_TIMER_WRITE_LOW_PRIORITY, SUM_TIMER_WRITE_NORMAL, SUM_TIMER_WRITE_EXTERNAL FROM table_lock_waits_summary_by_table WHERE COUNT_STAR > 0" @@ -318,8 +311,7 @@ func (t table_rows) needs_refresh(t2 table_rows) bool { // 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), @@ -334,7 +326,8 @@ func (r table_row) String() string { 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