<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="Tony L. Requena" />
<title>Javascript Function Profiler :: Version 1.0.0</title>
<script type="text/javascript" src="class.timeprofiler.js"></script>
</head>
<body>
<h3>Performance Result</h3>
<textarea style="width: 90%; height: 400px;" id="result">
Starting execution...
</textarea>
<script type="text/javascript">
function imprime($greeting, $friend){
return bin2hex($greeting+" "+$friend)+" -- "+$greeting+" "+$friend;
}
function blah($n){
if($n == undefined){
$n = 1;
}
for($i = 0; $i<= $n; $i++){
$a = $i;
}
}
function bin2hex(s) {
var i, l, o = '',
n;
s += '';
for (i = 0, l = s.length; i < l; i++) {
n = s.charCodeAt(i)
.toString(16);
o += n.length < 2 ? '0' + n : n;
}
return o;
}
var $timer = new TimeProfiler('imprime',10,Array('hola','amigo'));
var outputFunction = $timer.getMicro()+" µs ("+$timer.getMili()+" ms) Return: '"+$timer.funcOutput()+"'";
document.getElementById('result').innerHTML = outputFunction+"\n";
var $timer = new TimeProfiler('blah',10000);
outputFunction = $timer.getMicro()+" µs ("+$timer.getMili()+" ms)";
document.getElementById('result').innerHTML = document.getElementById('result').innerHTML + outputFunction+"\n";
</script>
</body>
</html>
|