Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: Source/devtools/front_end/TimelineMemoryOverview.js

Issue 121223003: DevTools: Move usedHeapSize from TimelineEvent into counters. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var records = this._model.records; 50 var records = this._model.records;
51 if (!records.length) 51 if (!records.length)
52 return; 52 return;
53 53
54 const lowerOffset = 3; 54 const lowerOffset = 3;
55 var maxUsedHeapSize = 0; 55 var maxUsedHeapSize = 0;
56 var minUsedHeapSize = 100000000000; 56 var minUsedHeapSize = 100000000000;
57 var minTime = this._model.minimumRecordTime(); 57 var minTime = this._model.minimumRecordTime();
58 var maxTime = this._model.maximumRecordTime(); 58 var maxTime = this._model.maximumRecordTime();
59 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) { 59 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) {
60 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.usedHeapSize || maxUse dHeapSize); 60 if (!r.counters || !r.counters.jsHeapSizeUsed)
61 minUsedHeapSize = Math.min(minUsedHeapSize, r.usedHeapSize || minUse dHeapSize); 61 return;
62 maxUsedHeapSize = Math.max(maxUsedHeapSize, r.counters.jsHeapSizeUse d);
63 minUsedHeapSize = Math.min(minUsedHeapSize, r.counters.jsHeapSizeUse d);
62 }); 64 });
63 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); 65 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize);
64 66
65 var width = this._canvas.width; 67 var width = this._canvas.width;
66 var height = this._canvas.height - lowerOffset; 68 var height = this._canvas.height - lowerOffset;
67 var xFactor = width / (maxTime - minTime); 69 var xFactor = width / (maxTime - minTime);
68 var yFactor = height / Math.max(maxUsedHeapSize - minUsedHeapSize, 1); 70 var yFactor = height / Math.max(maxUsedHeapSize - minUsedHeapSize, 1);
69 71
70 var histogram = new Array(width); 72 var histogram = new Array(width);
71 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) { 73 WebInspector.TimelinePresentationModel.forAllRecords(records, function(r ) {
72 if (!r.usedHeapSize) 74 if (!r.counters || !r.counters.jsHeapSizeUsed)
73 return; 75 return;
74 var x = Math.round((WebInspector.TimelineModel.endTimeInSeconds(r) - minTime) * xFactor); 76 var x = Math.round((WebInspector.TimelineModel.endTimeInSeconds(r) - minTime) * xFactor);
75 var y = (r.usedHeapSize - minUsedHeapSize) * yFactor; 77 var y = (r.counters.jsHeapSizeUsed - minUsedHeapSize) * yFactor;
76 histogram[x] = Math.max(histogram[x] || 0, y); 78 histogram[x] = Math.max(histogram[x] || 0, y);
77 }); 79 });
78 80
79 var y = 0; 81 var y = 0;
80 var isFirstPoint = true; 82 var isFirstPoint = true;
81 var ctx = this._context; 83 var ctx = this._context;
82 ctx.save(); 84 ctx.save();
83 ctx.translate(0.5, 0.5); 85 ctx.translate(0.5, 0.5);
84 ctx.beginPath(); 86 ctx.beginPath();
85 ctx.moveTo(-1, this._canvas.height); 87 ctx.moveTo(-1, this._canvas.height);
(...skipping 24 matching lines...) Expand all
110 ctx.strokeStyle = "#666"; 112 ctx.strokeStyle = "#666";
111 ctx.stroke(); 113 ctx.stroke();
112 ctx.restore(); 114 ctx.restore();
113 115
114 this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSiz e); 116 this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSiz e);
115 this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSiz e); 117 this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSiz e);
116 }, 118 },
117 119
118 __proto__: WebInspector.TimelineOverviewBase.prototype 120 __proto__: WebInspector.TimelineOverviewBase.prototype
119 } 121 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.cpp ('k') | Source/devtools/front_end/TimelinePresentationModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698