Skip to content

Commit 71dbe59

Browse files
committed
Update MoarVM profiler output to angular 1.4.2
Use consistent bg color, avoid template recursion problems.
1 parent 99a2119 commit 71dbe59

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/vm/moar/profiler/template.html

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ <h3>Dynamic Optimization</h3>
278278
</div>
279279

280280
<script type="text/ng-template" id="icycle_graph_callee_renderer.html">
281-
<a href="#" class="call" style="background-color: {{backgroundColor()}};" ng-click="toCallee(callee)">{{callee.name}}</a>
281+
<a href="#" class="call" style="background-color:{{backgroundColor(callee)}}" ng-click="toCallee(callee)">{{callee.name}}</a>
282282
<div class="child" style="width: {{callee.inclusive_time * 100 / Current.inclusive_time}}%;" ng-repeat="callee in callee.callees" title="{{callee.name}}" ng-include="'icycle_graph_callee_renderer.html'"></div>
283283
</script>
284284

@@ -708,7 +708,7 @@ <h3>Global Deoptimization</h3>
708708

709709
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
710710
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
711-
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
711+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
712712
<script>
713713
var rawData = JSON.parse('{{{PROFIELR_OUTPUT}}}');
714714

@@ -729,8 +729,10 @@ <h3>Global Deoptimization</h3>
729729
walkCallGraphNode(rawData[0].call_graph);
730730
}());
731731

732-
// Register application and add controllers.
733-
var moarProfApp = angular.module('moarProfApp', []);
732+
// Register application and add controllers, increase recursion depth for callGraphController
733+
var moarProfApp = angular.module('moarProfApp', []).config(function($rootScopeProvider) {
734+
$rootScopeProvider.digestTtl(100);
735+
});
734736

735737
moarProfApp.controller('NavigationController', function ($scope) {
736738
$scope.Tab = 'Overview';
@@ -924,11 +926,15 @@ <h3>Global Deoptimization</h3>
924926
updateCurrentData();
925927
}
926928

927-
$scope.backgroundColor = function () {
928-
var component = Math.floor(128 + Math.random()*127).toString(16);
929-
if (component.length == 1)
930-
component = '0' + component;
931-
return '#' + component + component + 'ff';
929+
/*
930+
* Given a callee, create a unique, repeatable color;
931+
* h/t https://stackoverflow.com/questions/3426404
932+
*/
933+
$scope.backgroundColor = function (callee) {
934+
var str = callee.$$hashKey + callee.file + callee.name;
935+
for (var i = 0, hash = 0; i < str.length; hash = str.charCodeAt(i++) + ((hash << 5) - hash));
936+
for (var i = 0, colour = "#"; i < 3; colour += ("00" + ((hash >> i++ * 8) & 0xFF).toString(16)).slice(-2));
937+
return colour;
932938
}
933939

934940
function updateCurrentData() {

0 commit comments

Comments
 (0)