1 package replication_workload
6 // "github.com/sjmudd/pstop/lib"
7 ps "github.com/sjmudd/pstop/performance_schema"
11 type Replication_workload struct {
14 initial replication_workload_rows
15 current replication_workload_rows
16 results replication_workload_rows
17 totals replication_workload_row
20 // reset the statistics to current values
21 func (t *Replication_workload) UpdateInitialValues() {
23 t.initial = make(replication_workload_rows, len(t.current))
24 copy(t.initial, t.current)
26 t.results = make(replication_workload_rows, len(t.current))
27 copy(t.results, t.current)
29 if t.WantRelativeStats() {
30 t.results.subtract(t.initial) // should be 0 if relative
34 t.totals = t.results.totals()
37 // Collect data from the db, then merge it in.
38 func (t *Replication_workload) Collect(dbh *sql.DB) {
47 // return the headings for a table
48 func (t Replication_workload) Headings() string {
49 var r replication_workload_row
54 // return the rows we need for displaying
55 func (t Replication_workload) RowContent(max_rows int) []string {
56 rows := make([]string, 0, max_rows)
58 for i := range t.results {
60 rows = append(rows, t.results[i].row_content(t.totals))
67 // return all the totals
68 func (t Replication_workload) TotalRowContent() string {
69 return t.totals.row_content(t.totals)
72 // return an empty string of data (for filling in)
73 func (t Replication_workload) EmptyRowContent() string {
74 var emtpy replication_workload_row
75 return emtpy.row_content(emtpy)
78 func (t Replication_workload) Description() string {
79 return "File I/O by filename (replication_workload)"