*/
func (r *pl_by_user_row) headings() string {
- return fmt.Sprintf("%-14s|%10s %6s|%5s %4s|%4s %3s|%6s %6s %6s %6s %6s|",
+ 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")
}
} else {
u = r.username
}
- return fmt.Sprintf("%-14s|%10s %6s|%5s %4s|%4s %3s|%6s %6s %6s %6s %6s|",
+ return fmt.Sprintf("%-14s|%10s %6s|%4s %4s|%5s %3s|%6s %6s %6s %6s %6s|",
u,
lib.FormatTime(r.runtime),
lib.FormatPct(lib.MyDivide(r.runtime, totals.runtime)),
totals.runtime += t[i].runtime
totals.connections += t[i].connections
totals.active += t[i].active
- // totals.hosts += t[i].hosts This needs to be done differently to get the total number of distinct hosts
- // totals.dbs += t[i].dbs This needs to be done differently to get the total number of distinct dbs
+ // totals.hosts += t[i].hosts This needs to be done differently to get the total number of distinct hosts
+ // totals.dbs += t[i].dbs This needs to be done differently to get the total number of distinct dbs
totals.selects += t[i].selects
totals.inserts += t[i].inserts
totals.updates += t[i].updates
func (t ByRunTime) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t ByRunTime) Less(i, j int) bool {
return (t[i].runtime > t[j].runtime) ||
- ((t[i].runtime == t[j].runtime) && (t[i].connections > t[j].connections))
+ ((t[i].runtime == t[j].runtime) && (t[i].connections > t[j].connections)) ||
+ ((t[i].runtime == t[j].runtime) && (t[i].connections == t[j].connections) && (t[i].username < t[j].username))
}
func (t pl_by_user_rows) Sort() {