[svn-commits] r192 - branches/advisor/src/back/scf/scm

thial01 at ingres.com thial01 at ingres.com
Sat Aug 16 05:49:30 PDT 2008


Author: thial01
Date: 2008-08-16 05:49:30 -0700 (Sat, 16 Aug 2008)
New Revision: 192

Modified:
   branches/advisor/src/back/scf/scm/scmonitor.sc
Log:
Monitor stores now current lock values instead of all-time sum - see #174


Modified: branches/advisor/src/back/scf/scm/scmonitor.sc
===================================================================
--- branches/advisor/src/back/scf/scm/scmonitor.sc	2008-08-13 19:28:10 UTC (rev 191)
+++ branches/advisor/src/back/scf/scm/scmonitor.sc	2008-08-16 12:49:30 UTC (rev 192)
@@ -97,6 +97,11 @@
 	ESQL_SCM	*scm;
 exec sql end declare section;
 
+/* We need these to remember the last seen value */
+i4		escalated_locks = 0;
+i4		deadlocks = 0;
+i4		lock_wait = 0;
+
 /*{
 **
 **  Name: get_statements() -   read statements from IMA
@@ -1227,36 +1232,29 @@
         {
         	statistics.locks_used = scm->statistics[i].locks_used;
         }
-        if (scm->statistics[i].deadlocks > statistics.deadlocks) 
-        {
-        	statistics.deadlocks = scm->statistics[i].deadlocks;
-        } 
-        if (scm->statistics[i].escalated_locks > statistics.escalated_locks) 
-        {
-        	statistics.escalated_locks = scm->statistics[i].escalated_locks;
-        }
-        if (scm->statistics[i].lock_wait > statistics.lock_wait) 
-        {
-        	statistics.lock_wait = scm->statistics[i].lock_wait;
-        }        
-               
-               
-        /* Use the latest value we've seen */
         
-        if (i == scm->cur_sts_idx - 1) 
-        {
-        	statistics.current_connections = scm->statistics[i].current_connections;
-        	statistics.current_sessions = scm->statistics[i].current_sessions;
-        	statistics.max_sessions = scm->statistics[i].max_sessions;
-        	statistics.total_rows = scm->statistics[i].total_rows;
-        	statistics.selects_processed = scm->statistics[i].selects_processed;
-        	statistics.locks_per_tx = scm->statistics[i].locks_per_tx;
-        	statistics.max_locks = scm->statistics[i].max_locks;
-        	
-        	STprintf(statistics.server, scm->statistics[i].server);
-        }
 	}
+        
+	/* Use the difference between this and the last value */
+	statistics.deadlocks = scm->statistics[scm->cur_sts_idx].deadlocks - deadlocks;
+	deadlocks = scm->statistics[scm->cur_sts_idx].deadlocks;
 	
+	statistics.escalated_locks = scm->statistics[scm->cur_sts_idx].escalated_locks - escalated_locks;
+	escalated_locks = scm->statistics[scm->cur_sts_idx].escalated_locks;
+	
+	statistics.lock_wait = scm->statistics[scm->cur_sts_idx].lock_wait - lock_wait;
+	lock_wait = scm->statistics[scm->cur_sts_idx].lock_wait; 
+               
+	/* Use the latest value we've seen */
+	statistics.current_connections = scm->statistics[scm->cur_sts_idx].current_connections;
+	statistics.current_sessions = scm->statistics[scm->cur_sts_idx].current_sessions;
+	statistics.max_sessions = scm->statistics[scm->cur_sts_idx].max_sessions;
+	statistics.total_rows = scm->statistics[scm->cur_sts_idx].total_rows;
+	statistics.selects_processed = scm->statistics[scm->cur_sts_idx].selects_processed;
+	statistics.locks_per_tx = scm->statistics[scm->cur_sts_idx].locks_per_tx;
+	statistics.max_locks = scm->statistics[scm->cur_sts_idx].max_locks;
+	STprintf(statistics.server, scm->statistics[i].server);
+	
 	/* Reset the array pointer */
 	scm->cur_sts_idx = 0;
 	




More information about the svn-commits mailing list