Skip to content

Instantly share code, notes, and snippets.

@tylerkahn
Created May 8, 2013 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerkahn/5542129 to your computer and use it in GitHub Desktop.
Save tylerkahn/5542129 to your computer and use it in GitHub Desktop.
index-via-relay.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>Sysstat Widgets Demo</title>
<!-- To use the widgets in your page, include the line below
The widgets are <div> and <span> elements with classes memstat
and loadavg, respectively. Change the 'url' to point to your
web service.
-->
<script language="javascript" type="text/javascript" src="http://courses.cs.vt.edu/~cs3214/fall2009/sysstatwebservice/widget/sysstatwidgets.js">
</script>
<script type="text/javascript">
function send(url, rselector) {
var $ = jQuerySysStatWidget;
$.get(url, function (response) {
$(rselector).html(response);
});
}
</script>
</head>
<body>
<p>This page shows you how to use the two widgets to display the
physical memory
usage and the overall CPU load average of a machine that runs your
web service. Adjust the 'url' attribute in the respective &lt;div&gt;
and &lt;span&gt; elements.</p>
<p>
<script>var count = 0;</script>
<a href="#" onclick="javascript:send('/group335/runloop', '#responsemsg');">Click here</a> to run a 15 second loop on this machine (which will result in an increase in the load average).
<span id="responsemsg"></span>
</p>
<p>
<a href="#" onclick="javascript:send('/group335/allocanon', '#responsemsg2');">Click here</a> to force allocation of 64MB of physical
memory used as application (anonymous) memory.
<span id="responsemsg2"></span>
</p>
<p>
<a href="#" onclick="javascript:send('/group335/freeanon', '#responsemsg3');">Click here</a> to force deallocation of last
chunk of allocated physical memory.
<span id="responsemsg3"></span>
</p>
<table>
<tr>
<th>Memory</th>
<th>CPU Load Average</th>
</tr>
<tr>
<td>
<div id="meminfo" url="http://cs3214.cs.vt.edu:9055/group335" update="5000"
style="margin-top:20px; margin-left:20px; width:180px; height:400px;">
</div>
</td>
<td>
<div id="loadavg" url="http://cs3214.cs.vt.edu:9055/group335" update="2500"
style="margin-top:20px; margin-left:20px; width:600px; height:400px;">
Loading, please wait...
</div>
</td>
</tr>
</table>
<p>A text-only version of the load average widget:
<span class="loadavg-text" url="http://cs3214.cs.vt.edu:9055/group335" update="4000"
style="font-weight: bold">
</span>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment