summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <markwkm@gmail.com>2009-10-17 14:48:55 -0700
committerMark Wong <markwkm@gmail.com>2009-10-17 14:48:55 -0700
commit6445bc8f293bec5911f155d78413a46c5f261064 (patch)
treecd91b657f9c3bedefcfdac33dc107fb87dc69de4
parent26f15d8dd5193af6ff23c5b8a55a8b1865b6484c (diff)
Cumulative statistics is constantly growing on redraws
This patch from Alexey Torkhov (atorkhov) fixed bug #1010710. Cumulative statistics is constantly growing on every redraw even if no queries were made. How to reproduce: 1. Create test database with test table. Make a query to it. 2. Start pg_top connecting to test database (-dtest). 3. Switch to cumulative statistics (press 'R', then 't'). 4. Wait for redraw - press a key for redraw, without making a query. Actual results: Statistics grows. Expected results: Statistics stays the same.
-rw-r--r--pg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pg.c b/pg.c
index 89c1b22..a601466 100644
--- a/pg.c
+++ b/pg.c
@@ -798,9 +798,9 @@ update_index_stats(struct index_node * node, long long idx_scan,
long long idx_tup_read, long long idx_tup_fetch)
{
/* Add to the index totals */
- node->total_idx_scan += idx_scan;
- node->total_idx_tup_read += idx_tup_read;
- node->total_idx_tup_fetch += idx_tup_fetch;
+ node->total_idx_scan = idx_scan;
+ node->total_idx_tup_read = idx_tup_read;
+ node->total_idx_tup_fetch = idx_tup_fetch;
/* Calculate difference between previous and current values. */
node->diff_idx_scan = idx_scan - node->old_idx_scan;
@@ -819,13 +819,13 @@ update_table_stats(struct table_node * node, long long seq_scan,
long long n_tup_ins, long long n_tup_upd, long long n_tup_del)
{
/* Add to the table totals */
- node->total_idx_scan += idx_scan;
- node->total_idx_tup_fetch += idx_tup_fetch;
- node->total_n_tup_del += n_tup_del;
- node->total_n_tup_ins += n_tup_ins;
- node->total_n_tup_upd += n_tup_upd;
- node->total_seq_scan += seq_scan;
- node->total_seq_tup_read += seq_tup_read;
+ node->total_idx_scan = idx_scan;
+ node->total_idx_tup_fetch = idx_tup_fetch;
+ node->total_n_tup_del = n_tup_del;
+ node->total_n_tup_ins = n_tup_ins;
+ node->total_n_tup_upd = n_tup_upd;
+ node->total_seq_scan = seq_scan;
+ node->total_seq_tup_read = seq_tup_read;
/* Calculate difference between previous and current values. */
node->diff_idx_scan = idx_scan - node->old_idx_scan;