// a row from performance_schema.events_waits_summary_global_by_event_name
// Note: upper case names to match the performance_schema column names.
// This type is _not_ meant to be exported.
// a row from performance_schema.events_waits_summary_global_by_event_name
// Note: upper case names to match the performance_schema column names.
// This type is _not_ meant to be exported.
return fmt.Sprintf("%-30s %10s %6s %6s", "Mutex Name", "Latency", "MtxCnt", "%")
}
// generate a printable result
return fmt.Sprintf("%-30s %10s %6s %6s", "Mutex Name", "Latency", "MtxCnt", "%")
}
// generate a printable result
this.SUM_TIMER_WAIT += other.SUM_TIMER_WAIT
this.COUNT_STAR += other.COUNT_STAR
}
// subtract the countable values in one row from another
this.SUM_TIMER_WAIT += other.SUM_TIMER_WAIT
this.COUNT_STAR += other.COUNT_STAR
}
// subtract the countable values in one row from another
// check for issues here (we have a bug) and log it
// - this situation should not happen so there's a logic bug somewhere else
if this.SUM_TIMER_WAIT >= other.SUM_TIMER_WAIT {
this.SUM_TIMER_WAIT -= other.SUM_TIMER_WAIT
this.COUNT_STAR -= other.COUNT_STAR
} else {
// check for issues here (we have a bug) and log it
// - this situation should not happen so there's a logic bug somewhere else
if this.SUM_TIMER_WAIT >= other.SUM_TIMER_WAIT {
this.SUM_TIMER_WAIT -= other.SUM_TIMER_WAIT
this.COUNT_STAR -= other.COUNT_STAR
} else {
lib.Logger.Println("this=", this)
lib.Logger.Println("other=", other)
}
}
lib.Logger.Println("this=", this)
lib.Logger.Println("other=", other)
}
}
// we collect all information even if it's mainly empty as we may reference it later
sql := "SELECT EVENT_NAME, SUM_TIMER_WAIT, COUNT_STAR FROM events_waits_summary_global_by_event_name WHERE SUM_TIMER_WAIT > 0 AND EVENT_NAME LIKE 'wait/synch/mutex/innodb/%'"
// we collect all information even if it's mainly empty as we may reference it later
sql := "SELECT EVENT_NAME, SUM_TIMER_WAIT, COUNT_STAR FROM events_waits_summary_global_by_event_name WHERE SUM_TIMER_WAIT > 0 AND EVENT_NAME LIKE 'wait/synch/mutex/innodb/%'"
-func (t events_waits_summary_global_by_event_name_rows) Len() int { return len(t) }
-func (t events_waits_summary_global_by_event_name_rows) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
+func (t table_rows) Len() int { return len(t) }
+func (t table_rows) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
sort.Sort(t)
}
// remove the initial values from those rows where there's a match
// - if we find a row we can't match ignore it
sort.Sort(t)
}
// remove the initial values from those rows where there's a match
// - if we find a row we can't match ignore it
// if the data in t2 is "newer", "has more values" than t then it needs refreshing.
// check this by comparing totals.
// if the data in t2 is "newer", "has more values" than t then it needs refreshing.
// check this by comparing totals.
return fmt.Sprintf("%-30s|%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s",
r.pretty_name(),
lib.FormatTime(r.SUM_TIMER_WAIT),
return fmt.Sprintf("%-30s|%10s %10s %10s %10s %10s|%10s %10s|%10s %10s %10s %10s %10s|%10s %10s",
r.pretty_name(),
lib.FormatTime(r.SUM_TIMER_WAIT),