Permalink
Browse files

began implementing heap snapshots

  • Loading branch information...
1 parent a7e32cb commit 28c3b6d906d801cc740598ce6e542e0c0e27a693 @dannycoates dannycoates committed Aug 12, 2010
View
@@ -1,2 +1,5 @@
._*
v8.log
+native/build
+bin/.*
+native/.*
View
@@ -0,0 +1,25 @@
+var getLines = require('./profiler').getLogLines;
+
+
+var procProto = global.v8debug.DebugCommandProcessor.prototype;
+var oldReqHandler = procProto.processDebugJSONRequest;
+
+function newReqHandler(json_request) {
+ var req = JSON.parse(json_request);
+ if (req.command === 'getloglines') {
+ var res = response = this.createResponse(req);
+ try {
+ res.body = getLines(req.position);
+ }
+ catch (e) {
+ res.failed('profiler error');
+ }
+ res.running = this.running_;
+ return res.toJSONProtocol();
+ }
+ else {
+ return oldReqHandler.call(this, json_request);
+ }
+};
+
+procProto.processDebugJSONRequest = newReqHandler;
View
Binary file not shown.
View
@@ -53,7 +53,9 @@ exports.createSession = function (options) {
'lookup',
'evaluate',
'backtrace',
- 'listbreakpoints'],
+ 'listbreakpoints',
+ 'profile',
+ 'getloglines'],
flag = '--debug=',
proc,
sendIo,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,234 @@
+.data-grid table {
+ line-height: 120%;
+}
+
+body.attached #toolbar {
+ height: 34px;
+ border-top: 1px solid rgb(100, 100, 100);
+ cursor: default; /* overriden */
+ padding-left: 0;
+}
+
+/* Chrome theme overrides */
+
+body.platform-windows #toolbar, body.platform-windows.inactive #toolbar {
+ background-image: none;
+}
+
+body.detached.platform-mac-leopard #toolbar {
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important;
+}
+
+body.detached.platform-mac-leopard.inactive #toolbar {
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important;
+}
+
+body.detached.platform-mac-snowleopard #toolbar {
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(151, 151, 151))) !important;
+}
+
+body.detached.platform-mac-snowleopard.inactive #toolbar {
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(215, 215, 215)), to(rgb(207, 207, 207))) !important;
+}
+
+body.platform-linux #scripts-files {
+ font-size: 11px;
+ font-weight: normal;
+ line-height: 12px;
+}
+
+/* Heap Profiler Styles */
+
+.heap-snapshot-status-bar-item .glyph {
+ -webkit-mask-image: url(Images/focusButtonGlyph.png);
+}
+
+.heap-snapshot-sidebar-tree-item .icon {
+ content: url(Images/profileIcon.png);
+}
+
+.heap-snapshot-sidebar-tree-item.small .icon {
+ content: url(Images/profileSmallIcon.png);
+}
+
+.heap-snapshot-view {
+ display: none;
+ overflow: hidden;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.heap-snapshot-view.visible {
+ display: block;
+}
+
+.heap-snapshot-view .data-grid {
+ border: none;
+ max-height: 100%;
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 93px;
+}
+
+.heap-snapshot-view .data-grid th.count-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.count-column {
+ text-align: right;
+}
+
+.heap-snapshot-view .data-grid th.size-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.size-column {
+ text-align: right;
+}
+
+.heap-snapshot-view .data-grid th.countDelta-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.countDelta-column {
+ text-align: right;
+}
+
+.heap-snapshot-view .data-grid th.sizeDelta-column {
+ text-align: center;
+}
+
+.heap-snapshot-view .data-grid td.sizeDelta-column {
+ text-align: right;
+}
+
+#heap-snapshot-summary-container {
+ position: absolute;
+ padding-top: 20px;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 93px;
+ margin-left: -1px;
+ border-left: 1px solid rgb(102, 102, 102);
+ background-color: rgb(101, 111, 130);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));
+ background-repeat: repeat-x;
+ background-position: top;
+ text-align: center;
+ text-shadow: black 0 1px 1px;
+ white-space: nowrap;
+ color: white;
+ -webkit-background-size: 1px 6px;
+ -webkit-background-origin: padding;
+ -webkit-background-clip: padding;
+}
+
+.heap-snapshot-summary {
+ display: inline-block;
+ width: 50%;
+ min-width: 300px;
+ position: relative;
+}
+
+.heap-snapshot-summary canvas.summary-graph {
+ width: 225px;
+}
+
+.heap-snapshot-summary-label {
+ font-size: 12px;
+ font-weight: bold;
+ position: absolute;
+ top: 1px;
+ width: 50%;
+ left: 25%;
+}
+
+.section > .header {
+ border: 1px solid rgb(92, 116, 157);
+ background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(105, 133, 180)), to(rgb(92, 116, 157)));
+}
+
+.console-group-messages .section > .header {
+ padding: 0 8px 0 0;
+ background-image: none;
+ border: none;
+ min-height: 0;
+}
+
+#resources-filter {
+ background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(233, 233, 233)));
+}
+
+.crumbs .crumb {
+ -webkit-border-image: url(Images/segmentChromium.png) 0 12 0 2;
+ margin-right: -3px;
+ padding-left: 6px;
+}
+
+.crumbs .crumb.selected {
+ -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
+ color: white;
+ text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0;
+}
+
+.crumbs .crumb.selected:hover {
+ -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
+}
+
+.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
+ -webkit-border-image: url(Images/segmentSelectedEndChromium.png) 0 2 0 2;
+}
+
+.crumbs .crumb:hover {
+ -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
+}
+
+.crumbs .crumb.dimmed:hover {
+ -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
+}
+
+.crumbs .crumb.end:hover {
+ -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2;
+}
+
+body.drawer-visible #main-status-bar {
+ background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png);
+}
+
+.status-bar {
+ background-image: url(Images/statusbarBackgroundChromium.png);
+}
+
+button.status-bar-item {
+ background-image: url(Images/statusbarButtonsChromium.png);
+}
+
+select.status-bar-item:active {
+ -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2;
+}
+
+#drawer {
+ background-image: url(Images/statusbarBottomBackgroundChromium.png);
+}
+
+select.status-bar-item {
+ -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2;
+}
+
+.scope-bar li.selected {
+ -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
+}
+
+.scope-bar li:active {
+ -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
+}
+
+.timeline-category-statusbar-item input {
+ vertical-align: middle;
+}
View
@@ -134,6 +134,18 @@
<script type="text/javascript" src="ShortcutsHelp.js"></script>
<script type="text/javascript" src="HAREntry.js"></script>
<script type="text/javascript" src="node/Overrides.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="devTools.css">
+ <script type="text/javascript" src="v8/codemap.js"></script>
+ <script type="text/javascript" src="v8/consarray.js"></script>
+ <script type="text/javascript" src="v8/csvparser.js"></script>
+ <script type="text/javascript" src="v8/logreader.js"></script>
+ <script type="text/javascript" src="v8/profile.js"></script>
+ <script type="text/javascript" src="v8/profile_view.js"></script>
+ <script type="text/javascript" src="v8/splaytree.js"></script>
+ <script type="text/javascript" src="v8/ProfilerAgent.js"></script>
+ <script type="text/javascript" src="v8/ProfilerProcessor.js"></script>
+ <script type="text/javascript" src="v8/HeapProfilerPanel.js"></script>
</head>
<body class="attached">
<div id="toolbar">
@@ -154,14 +154,20 @@ WebInspector.nodeDebugger = (function() {
sendRequest('evaluate', {arguments: args}, callId);
},
takeHeapSnapshot: function() {
- sendRequest('profile', {arguments: {command: 'resume', modules: 65542, tag: 0}});
+ sendRequest('profile', {arguments: {command: 'resume', modules: 65542, tag: 1}});
},
startProfiling: function() {
sendRequest('profile', {arguments: {command: 'resume', modules: 1, tag: 0}});
},
stopProfiling: function() {
sendRequest('profile', {arguments: {command: 'pause', modules: 1, tag: 0}});
},
+ enableProfiler: function() {
+ //sendRequest('enableprof');
+ },
+ getLogLines: function(pos, callId) {
+ sendRequest('getloglines', {position: pos}, callId);
+ },
liveEdit: function(callId, sourceID, newContext) {
var args = {
script_id: sourceID,
@@ -223,6 +223,7 @@ WebInspector.InspectorBackendStub.prototype = {
enableProfiler: function()
{
+ WebInspector.nodeDebugger.enableProfiler();
WebInspector.profilerWasEnabled();
},
@@ -243,17 +244,33 @@ WebInspector.InspectorBackendStub.prototype = {
getProfileHeaders: function(callId)
{
- WebInspector.didGetProfileHeaders(callId, []);
+ console.log(callId);
+ WebInspector.didGetProfileHeaders(callId, [{uid:1337, typeId:"cpu", title:"elite profile" }]);
},
getProfile: function(callId, uid)
{
+ console.log(uid);
},
takeHeapSnapshot: function()
{
WebInspector.nodeDebugger.takeHeapSnapshot();
},
+
+ getProfilerLogLines: function(callId, pos)
+ {
+ WebInspector.nodeDebugger.getLogLines(pos, callId);
+ },
+
+ profilerAgent: null,
+ getProfilerAgent: function()
+ {
+ if (this.profilerAgent == null) {
+ this.profilerAgent = new devtools.ProfilerAgent();
+ }
+ return this.profilerAgent;
+ },
databaseTableNames: function(database)
{
@@ -60,6 +60,7 @@ WebInspector.InspectorFrontendHostStub = function()
injectedScriptId: value.ref || value.handle,
type: 'object'
};
+
break;
case 'function':
p.value = {
@@ -258,6 +259,9 @@ WebInspector.InspectorFrontendHostStub = function()
debugr.on('profile', function(msg) {
});
+ debugr.on('getloglines', function(msg) {
+ WebInspector.didGetProfilerLogLines(msg.callId, msg.body.position, msg.body.lines);
+ });
// events
debugr.on('break', function(msg) {
@@ -364,7 +368,7 @@ WebInspector.InspectorFrontendHostStub.prototype = {
hiddenPanels: function()
{
- return "elements,resources,timeline,profiles,storage,audits";
+ return "elements,resources,timeline,storage,audits";
},
inspectedURLChanged: function(url)
Oops, something went wrong.

0 comments on commit 28c3b6d

Please sign in to comment.