pari: branch 2.0 r3697 - /branches/2.0/config/sysinfo.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Aug 22 11:19:41 CDT 2008


Author: pari
Date: Fri Aug 22 11:19:40 2008
New Revision: 3697

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=3697
Log:

  Saving some unfinished work on displaying CPU usage.
  Will come back to this later.




Modified:
    branches/2.0/config/sysinfo.html

Modified: branches/2.0/config/sysinfo.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/sysinfo.html?view=diff&rev=3697&r1=3696&r2=3697
==============================================================================
--- branches/2.0/config/sysinfo.html (original)
+++ branches/2.0/config/sysinfo.html Fri Aug 22 11:19:40 2008
@@ -26,6 +26,8 @@
 
 </style>
 <script>
+var COUNTDOWN = 10;
+var CPU_USAGE = [];
 
 var getsysinfohtml = function(){
 	_$('sysinfohtml').innerHTML = ASTGUI.loadHTML(ASTGUI.paths.output_SysInfo);
@@ -82,12 +84,47 @@
 						$('#memory_div').show();
 					});
 				}
-			}];
+			}
+// 			,{	url: '#',
+// 				desc: 'CPU Usage',
+// 				click_function: function(){
+// 					$('.hideall').hide();
+// 					$('cpu_div').show();
+// 				}
+// 			}
+			];
 		ASTGUI.tabbedOptions( _$('tabbedMenu') , t );
 	})();
 	parent.ASTGUI.systemCmd( parent.ASTGUI.scripts.SysInfo, function(){ parent.ASTGUI.dialog.hide(); getsysinfohtml(); } );
-}
 
+// 	setInterval( function(){
+// 		var last_cpu_idle;
+// 		var last_cpu_total;
+// 
+// 		ASTGUI.systemCmdWithOutput( 'head -n 1 /proc/stat', function(stat_op){
+// 			var data = stat_op.trim().split(/\s+/);
+// 			var tot = parseInt(data[1]) + parseInt(data[2]) + parseInt(data[3]) + parseInt(data[4]) ;
+// 			var idle = parseInt(data[4]);
+// 
+// 			var cpu = 100 - Math.floor( (100 * idle)/tot );
+// 			CPU_USAGE.push(cpu);
+// 			console.log(cpu);
+// 		});
+// 
+// 		if( COUNTDOWN == 0 ){
+// 			updateCPU_Graph();
+// 			return;
+// 		}
+// 
+// 		COUNTDOWN--;
+// 	}, 1100);
+};
+
+var updateCPU_Graph = function(){
+	// update graph
+	COUNTDOWN = 10;
+
+};
 
 </script>
 <body bgcolor="EFEFEF">
@@ -122,6 +159,10 @@
 	<div id="memory_div" style="display:none;" class='hideall'>
 		<B>Memory Usage:</B><div id="memoryusage" style="font-family:courier; font-size:9.5pt;"></div>
 	</div>
+	<div id="cpu_div" style="display:none;" class='hideall'>
+		<B>CPU Usage:</B><BR>
+		<TABLE id="GRAPH_CPU" cellpadding=0 cellspacing=0 border=0></TABLE>
+	</div>
 </div>
 
 </body>




More information about the asterisk-gui-commits mailing list