[Profiler] Optimize time panel IS
This commit is contained in:
parent
d4300b95a5
commit
b879397bda
@ -93,6 +93,7 @@
|
|||||||
var text,
|
var text,
|
||||||
ms,
|
ms,
|
||||||
xc,
|
xc,
|
||||||
|
mainEvents,
|
||||||
colors = {{ colors|json_encode|raw }},
|
colors = {{ colors|json_encode|raw }},
|
||||||
space = 10.5,
|
space = 10.5,
|
||||||
ratio = (width - space * 2) / max,
|
ratio = (width - space * 2) / max,
|
||||||
@ -102,24 +103,17 @@
|
|||||||
canvas = document.getElementById('timeline_' + request.id),
|
canvas = document.getElementById('timeline_' + request.id),
|
||||||
ctx = canvas.getContext("2d");
|
ctx = canvas.getContext("2d");
|
||||||
|
|
||||||
request.events.forEach(function(event) {
|
request.events = request.events.filter(function(event) {
|
||||||
if (event.totaltime >= threshold) {
|
return event.totaltime >= threshold;
|
||||||
height += 38;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
height += 38 * request.events.length;
|
||||||
canvas.width = width;
|
canvas.width = width;
|
||||||
ctx.textBaseline = "middle";
|
ctx.textBaseline = "middle";
|
||||||
ctx.lineWidth = 0;
|
ctx.lineWidth = 0;
|
||||||
|
|
||||||
request.events.forEach(function(event) {
|
request.events.forEach(function(event) {
|
||||||
|
|
||||||
if (event.totaltime < threshold) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.periods.forEach(function(period) {
|
event.periods.forEach(function(period) {
|
||||||
|
|
||||||
if ('section.child' === event.name) {
|
if ('section.child' === event.name) {
|
||||||
ctx.fillStyle = colors.child_sections;
|
ctx.fillStyle = colors.child_sections;
|
||||||
ctx.fillRect(x + period.begin * ratio, 0, (period.end - period.begin) * ratio, height);
|
ctx.fillRect(x + period.begin * ratio, 0, (period.end - period.begin) * ratio, height);
|
||||||
@ -137,11 +131,11 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
request.events.forEach(function(event) {
|
mainEvents = request.events.filter(function(event) {
|
||||||
|
return 'section.child' !== event.name;
|
||||||
|
});
|
||||||
|
|
||||||
if (event.totaltime < threshold || 'section.child' === event.name) {
|
mainEvents.forEach(function(event) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
h += 8;
|
h += 8;
|
||||||
|
|
||||||
@ -204,11 +198,7 @@
|
|||||||
|
|
||||||
h = space;
|
h = space;
|
||||||
|
|
||||||
request.events.forEach(function(event) {
|
mainEvents.forEach(function(event) {
|
||||||
|
|
||||||
if (event.totaltime < threshold || 'section.child' === event.name) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.fillStyle = "#444";
|
ctx.fillStyle = "#444";
|
||||||
ctx.font = "12px sans-serif";
|
ctx.font = "12px sans-serif";
|
||||||
|
Reference in New Issue
Block a user