From: Simon J Mudd Date: Fri, 14 Nov 2014 20:35:15 +0000 (+0100) Subject: Change counters to uint64 as something broke on my box and bump up to v0.0.11 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=ec6cd477f09b69398f512cbe480afa86da326370;p=pstop.git Change counters to uint64 as something broke on my box and bump up to v0.0.11 --- diff --git a/lib/common.go b/lib/common.go index c04aab9..1f21c7f 100644 --- a/lib/common.go +++ b/lib/common.go @@ -9,7 +9,7 @@ import ( ) const ( - myname = "pstop" + myname = "pstop" copyright = "Copyright (C) 2014 Simon J Mudd " ) @@ -32,7 +32,7 @@ func Copyright() string { // sec_to_time() converts a number of hours, minutes and seconds into hh:mm:ss format. // e.g. 7384 = 2h 3m 4s, 7200 + 180 + 4 -func sec_to_time(d int) string { +func sec_to_time(d uint64) string { hours := d / 3600 // integer value minutes := (d - hours*3600) / 60 // integer value seconds := d - hours*3600 - minutes*60 @@ -40,11 +40,11 @@ func sec_to_time(d int) string { return fmt.Sprintf("%02d:%02d:%02d", hours, minutes, seconds) } -// FormatTime is based on sys.format_time. It +// FormatTime is based on sys.format_time. It // formats to 10 characters including space and suffix. // All values have 2 decimal places. Zero is returned as // an empty string. -func FormatTime(picoseconds int) string { +func FormatTime(picoseconds uint64) string { if picoseconds == 0 { return "" } @@ -91,7 +91,7 @@ func FormatPct(pct float64) string { // For values = 0 return an empty string. // For values < 1000 show 6,2 decimal places. // For values >= 1000 show 6,1 decimal place. -func FormatAmount(amount int) string { +func FormatAmount(amount uint64) string { var suffix string var formatted string var decimal_amount float64 @@ -100,7 +100,7 @@ func FormatAmount(amount int) string { return "" } if amount <= 1024 { - return strconv.Itoa(amount) + return strconv.Itoa(int(amount)) } if amount > (1024 * 1024 * 1024 * 1024) { @@ -126,7 +126,7 @@ func FormatAmount(amount int) string { } // MyDivide() divides a by b except if b is 0 in which case we return 0. -func MyDivide(a int, b int) float64 { +func MyDivide(a uint64, b uint64) float64 { if b == 0 { return float64(0) } else { diff --git a/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go b/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go index 0f36edd..64dd145 100644 --- a/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go +++ b/performance_schema/file_summary_by_instance/file_summary_by_instance_row.go @@ -46,18 +46,18 @@ CREATE TABLE `file_summary_by_instance` ( type file_summary_by_instance_row struct { FILE_NAME string - COUNT_STAR int - COUNT_READ int - COUNT_WRITE int - COUNT_MISC int - - SUM_TIMER_WAIT int - SUM_TIMER_READ int - SUM_TIMER_WRITE int - SUM_TIMER_MISC int - - SUM_NUMBER_OF_BYTES_READ int - SUM_NUMBER_OF_BYTES_WRITE int + COUNT_STAR uint64 + COUNT_READ uint64 + COUNT_WRITE uint64 + COUNT_MISC uint64 + + SUM_TIMER_WAIT uint64 + SUM_TIMER_READ uint64 + SUM_TIMER_WRITE uint64 + SUM_TIMER_MISC uint64 + + SUM_NUMBER_OF_BYTES_READ uint64 + SUM_NUMBER_OF_BYTES_WRITE uint64 } // represents a table or set of rows diff --git a/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go b/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go index a4a1a26..cde898f 100644 --- a/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go +++ b/performance_schema/table_io_waits_summary_by_table/table_io_waits_summary_by_table_row.go @@ -21,21 +21,21 @@ type table_io_waits_summary_by_table_row struct { OBJECT_SCHEMA string // in theory redundant but keep anyway OBJECT_NAME string // in theory redundant but keep anyway - SUM_TIMER_WAIT int - SUM_TIMER_READ int - SUM_TIMER_WRITE int - SUM_TIMER_FETCH int - SUM_TIMER_INSERT int - SUM_TIMER_UPDATE int - SUM_TIMER_DELETE int - - COUNT_STAR int - COUNT_READ int - COUNT_WRITE int - COUNT_FETCH int - COUNT_INSERT int - COUNT_UPDATE int - COUNT_DELETE int + SUM_TIMER_WAIT uint64 + SUM_TIMER_READ uint64 + SUM_TIMER_WRITE uint64 + SUM_TIMER_FETCH uint64 + SUM_TIMER_INSERT uint64 + SUM_TIMER_UPDATE uint64 + SUM_TIMER_DELETE uint64 + + COUNT_STAR uint64 + COUNT_READ uint64 + COUNT_WRITE uint64 + COUNT_FETCH uint64 + COUNT_INSERT uint64 + COUNT_UPDATE uint64 + COUNT_DELETE uint64 } type table_io_waits_summary_by_table_rows []table_io_waits_summary_by_table_row diff --git a/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go b/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go index 73d1bfc..01dda25 100644 --- a/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go +++ b/performance_schema/table_lock_waits_summary_by_table/table_lock_waits_summary_by_table_row.go @@ -98,21 +98,21 @@ type table_lock_waits_summary_by_table_row struct { OBJECT_NAME string // in theory redundant but keep anyway COUNT_STAR int - SUM_TIMER_WAIT int - SUM_TIMER_READ int - SUM_TIMER_WRITE int - - SUM_TIMER_READ_WITH_SHARED_LOCKS int - SUM_TIMER_READ_HIGH_PRIORITY int - SUM_TIMER_READ_NO_INSERT int - SUM_TIMER_READ_NORMAL int - SUM_TIMER_READ_EXTERNAL int - - SUM_TIMER_WRITE_ALLOW_WRITE int - SUM_TIMER_WRITE_CONCURRENT_INSERT int - SUM_TIMER_WRITE_LOW_PRIORITY int - SUM_TIMER_WRITE_NORMAL int - SUM_TIMER_WRITE_EXTERNAL int + SUM_TIMER_WAIT uint64 + SUM_TIMER_READ uint64 + SUM_TIMER_WRITE uint64 + + SUM_TIMER_READ_WITH_SHARED_LOCKS uint64 + SUM_TIMER_READ_HIGH_PRIORITY uint64 + SUM_TIMER_READ_NO_INSERT uint64 + SUM_TIMER_READ_NORMAL uint64 + SUM_TIMER_READ_EXTERNAL uint64 + + SUM_TIMER_WRITE_ALLOW_WRITE uint64 + SUM_TIMER_WRITE_CONCURRENT_INSERT uint64 + SUM_TIMER_WRITE_LOW_PRIORITY uint64 + SUM_TIMER_WRITE_NORMAL uint64 + SUM_TIMER_WRITE_EXTERNAL uint64 } type table_lock_waits_summary_by_table_rows []table_lock_waits_summary_by_table_row diff --git a/version/version.go b/version/version.go index f9a7aa1..2ff23ad 100644 --- a/version/version.go +++ b/version/version.go @@ -1,7 +1,7 @@ package version const ( - version = "0.0.10" + version = "0.0.11" ) func Version() string {