git://git.iain.cx/iain
/
pstop.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6cd1819
)
Adjust to highlight headings and totals
author
Simon J Mudd
<sjmudd@pobox.com>
Sun, 14 Dec 2014 17:20:32 +0000
(18:20 +0100)
committer
Simon J Mudd
<sjmudd@pobox.com>
Sun, 14 Dec 2014 17:20:32 +0000
(18:20 +0100)
i_s/pl_by_user.go
patch
|
blob
|
history
p_s/file_summary_by_instance/file_summary_by_instance.go
patch
|
blob
|
history
p_s/file_summary_by_instance/file_summary_by_instance_row.go
patch
|
blob
|
history
p_s/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go
patch
|
blob
|
history
p_s/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go
patch
|
blob
|
history
screen/screen.go
patch
|
blob
|
history
state/state.go
patch
|
blob
|
history
diff --git
a/i_s/pl_by_user.go
b/i_s/pl_by_user.go
index
ae5b4aa
..
576045b
100644
(file)
--- a/
i_s/pl_by_user.go
+++ b/
i_s/pl_by_user.go
@@
-43,7
+43,7
@@
xxxxxxxxxxxxxx|hh:mm:ss 100.0%|9999 9999|9999 999|100.0% 100.0% 100.0% 100.0% 1
func (r *pl_by_user_row) headings() string {
return fmt.Sprintf("%-14s|%10s %6s|%4s %4s|%5s %3s|%6s %6s %6s %6s %6s|",
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 printable result
@@
-74,7
+74,7
@@
func (r *pl_by_user_row) row_content(totals pl_by_user_row) string {
// 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
// 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 = "T
OTALS
"
+ totals.username = "T
otals
"
for i := range t {
totals.runtime += t[i].runtime
for i := range t {
totals.runtime += t[i].runtime
diff --git
a/p_s/file_summary_by_instance/file_summary_by_instance.go
b/p_s/file_summary_by_instance/file_summary_by_instance.go
index
c1e402e
..
7a8f2d8
100644
(file)
--- a/
p_s/file_summary_by_instance/file_summary_by_instance.go
+++ b/
p_s/file_summary_by_instance/file_summary_by_instance.go
@@
-141,7
+141,7
@@
func (t File_summary_by_instance) EmptyRowContent() string {
func (t File_summary_by_instance) Description() string {
count := t.count_rows()
func (t File_summary_by_instance) Description() string {
count := t.count_rows()
- return fmt.Sprintf("
File I/O by filenam
e (file_summary_by_instance) %4d row(s) ", count)
+ return fmt.Sprintf("
I/O Latency by Fil
e (file_summary_by_instance) %4d row(s) ", count)
}
// create a new structure and include various variable values:
}
// create a new structure and include various variable values:
diff --git
a/p_s/file_summary_by_instance/file_summary_by_instance_row.go
b/p_s/file_summary_by_instance/file_summary_by_instance_row.go
index
711b742
..
2050c61
100644
(file)
--- a/
p_s/file_summary_by_instance/file_summary_by_instance_row.go
+++ b/
p_s/file_summary_by_instance/file_summary_by_instance_row.go
@@
-103,7
+103,7
@@
func (r *file_summary_by_instance_row) pretty_name() string {
if len(s) > 30 {
s = s[:29]
}
if len(s) > 30 {
s = s[:29]
}
- return
fmt.Sprintf("%-30s", s)
+ return
s
}
func (r *file_summary_by_instance_row) headings() string {
}
func (r *file_summary_by_instance_row) headings() string {
@@
-124,14
+124,12
@@
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 {
// 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.
// 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 = ""
name = ""
- } else {
- name = row.pretty_name()
}
return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s",
}
return fmt.Sprintf("%-30s %10s %6s|%6s %6s %6s|%8s %8s|%8s %6s %6s %6s",
@@
-182,7
+180,7
@@
func (this *file_summary_by_instance_row) subtract(other file_summary_by_instanc
// 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
// 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 = "T
OTALS
"
+ totals.FILE_NAME = "T
otals
"
for i := range t {
totals.add(t[i])
for i := range t {
totals.add(t[i])
diff --git
a/p_s/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go
b/p_s/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go
index
2551e0d
..
5d52b60
100644
(file)
--- a/
p_s/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go
+++ b/
p_s/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go
@@
-62,7
+62,7
@@
func (r *table_io_waits_summary_by_table_row) pretty_name() string {
if len(s) > 30 {
s = s[:29]
}
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_headings() string {
@@
-76,7
+76,7
@@
func (r *table_io_waits_summary_by_table_row) ops_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()
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 = ""
}
name = ""
}
@@
-94,7
+94,7
@@
func (r *table_io_waits_summary_by_table_row) latency_row_content(totals table_i
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()
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 = ""
}
name = ""
}
@@
-155,7
+155,7
@@
func (this *table_io_waits_summary_by_table_row) subtract(other table_io_waits_s
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
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 = "T
OTALS
"
+ totals.OBJECT_SCHEMA = "T
otals
"
for i := range t {
totals.add(t[i])
for i := range t {
totals.add(t[i])
diff --git
a/p_s/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go
b/p_s/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go
index
01dda25
..
006e094
100644
(file)
--- a/
p_s/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go
+++ b/
p_s/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go
@@
-140,7
+140,7
@@
func (r *table_lock_waits_summary_by_table_row) pretty_name() string {
if len(s) > 30 {
s = s[:29]
}
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|
}
// Table Name Latency %| Read Write|S.Lock High NoIns Normal Extrnl|AlloWr CncIns WrtDly Low Normal Extrnl|
@@
-158,7
+158,7
@@
func (r *table_lock_waits_summary_by_table_row) row_content(totals table_lock_wa
// assume the data is empty so hide it.
name := r.pretty_name()
// 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 = ""
}
name = ""
}
@@
-218,7
+218,7
@@
func (this *table_lock_waits_summary_by_table_row) subtract(other table_lock_wai
// 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
// 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 = "T
OTALS
"
+ totals.OBJECT_SCHEMA = "T
otals
"
for i := range t {
totals.add(t[i])
for i := range t {
totals.add(t[i])
diff --git
a/screen/screen.go
b/screen/screen.go
index
9266ad8
..
f428da8
100644
(file)
--- a/
screen/screen.go
+++ b/
screen/screen.go
@@
-78,6
+78,18
@@
func (s *TermboxScreen) PrintAt(x int, y int, text string) {
s.Flush()
}
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 (s *TermboxScreen) DisplayHelp() {
s.PrintAt(0, 0, lib.MyName()+" version "+version.Version()+" (C) 2014 Simon J Mudd <sjmudd@pobox.com>")
diff --git
a/state/state.go
b/state/state.go
index
682fb1c
..
124b884
100644
(file)
--- a/
state/state.go
+++ b/
state/state.go
@@
-261,7
+261,7
@@
func (state State) displayDescription() {
}
func (state *State) displayOpsOrLatency() {
}
func (state *State) displayOpsOrLatency() {
- state.screen.PrintAt(0, 2, state.tiwsbt.Headings())
+ state.screen.
Bold
PrintAt(0, 2, state.tiwsbt.Headings())
max_rows := state.screen.Height() - 3
row_content := state.tiwsbt.RowContent(max_rows)
max_rows := state.screen.Height() - 3
row_content := state.tiwsbt.RowContent(max_rows)
@@
-280,12
+280,12
@@
func (state *State) displayOpsOrLatency() {
}
// print out the totals at the bottom
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.tiwsbt.TotalRowContent())
+ state.screen.
Bold
PrintAt(0, state.screen.Height()-1, state.tiwsbt.TotalRowContent())
}
// show actual I/O latency values
func (state State) displayIO() {
}
// show actual I/O latency values
func (state State) displayIO() {
- state.screen.PrintAt(0, 2, state.fsbi.Headings())
+ state.screen.
Bold
PrintAt(0, 2, state.fsbi.Headings())
// print out the data
max_rows := state.screen.Height() - 3
// print out the data
max_rows := state.screen.Height() - 3
@@
-305,11
+305,11
@@
func (state State) displayIO() {
}
// print out the totals at the bottom
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.fsbi.TotalRowContent())
+ state.screen.
Bold
PrintAt(0, state.screen.Height()-1, state.fsbi.TotalRowContent())
}
func (state *State) displayLocks() {
}
func (state *State) displayLocks() {
- state.screen.PrintAt(0, 2, state.tlwsbt.Headings())
+ state.screen.
Bold
PrintAt(0, 2, state.tlwsbt.Headings())
// print out the data
max_rows := state.screen.Height() - 3
// print out the data
max_rows := state.screen.Height() - 3
@@
-329,11
+329,11
@@
func (state *State) displayLocks() {
}
// print out the totals at the bottom
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.tlwsbt.TotalRowContent())
+ state.screen.
Bold
PrintAt(0, state.screen.Height()-1, state.tlwsbt.TotalRowContent())
}
func (state *State) displayUsers() {
}
func (state *State) displayUsers() {
- state.screen.PrintAt(0, 2, state.users.Headings())
+ state.screen.
Bold
PrintAt(0, 2, state.users.Headings())
// print out the data
max_rows := state.screen.Height() - 3
// print out the data
max_rows := state.screen.Height() - 3
@@
-353,7
+353,7
@@
func (state *State) displayUsers() {
}
// print out the totals at the bottom
}
// print out the totals at the bottom
- state.screen.PrintAt(0, state.screen.Height()-1, state.users.TotalRowContent())
+ state.screen.
Bold
PrintAt(0, state.screen.Height()-1, state.users.TotalRowContent())
}
// do we want to show all p_s data?
}
// do we want to show all p_s data?