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

Side by Side Diff: chrome/tools/test/reference_build/chrome_linux/resources/inspector/profile_view.js

Issue 177049: On Linux, move the passing of filedescriptors to a dedicated socketpair(). (Closed)
Patch Set: Removed *.d files from reference build Created 11 years, 3 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 * Builds a profile view for the specified call tree. 46 * Builds a profile view for the specified call tree.
47 * 47 *
48 * @param {devtools.profiler.CallTree} callTree A call tree. 48 * @param {devtools.profiler.CallTree} callTree A call tree.
49 * @param {boolean} opt_bottomUpViewWeights Whether remapping 49 * @param {boolean} opt_bottomUpViewWeights Whether remapping
50 * of self weights for a bottom up view is needed. 50 * of self weights for a bottom up view is needed.
51 */ 51 */
52 devtools.profiler.ViewBuilder.prototype.buildView = function( 52 devtools.profiler.ViewBuilder.prototype.buildView = function(
53 callTree, opt_bottomUpViewWeights) { 53 callTree, opt_bottomUpViewWeights) {
54 var head; 54 var head;
55 var samplingRate = this.samplingRate; 55 var samplingRate = this.samplingRate;
56 var createViewNode = this.createViewNode;
56 callTree.traverse(function(node, viewParent) { 57 callTree.traverse(function(node, viewParent) {
57 var totalWeight = node.totalWeight * samplingRate; 58 var totalWeight = node.totalWeight * samplingRate;
58 var selfWeight = node.selfWeight * samplingRate; 59 var selfWeight = node.selfWeight * samplingRate;
59 if (opt_bottomUpViewWeights === true) { 60 if (opt_bottomUpViewWeights === true) {
60 if (viewParent === head) { 61 if (viewParent === head) {
61 selfWeight = totalWeight; 62 selfWeight = totalWeight;
62 } else { 63 } else {
63 selfWeight = 0; 64 selfWeight = 0;
64 } 65 }
65 } 66 }
66 var viewNode = new devtools.profiler.ProfileView.Node( 67 var viewNode = createViewNode(node.label, totalWeight, selfWeight, head);
67 node.label, totalWeight, selfWeight, head);
68 if (viewParent) { 68 if (viewParent) {
69 viewParent.addChild(viewNode); 69 viewParent.addChild(viewNode);
70 } else { 70 } else {
71 head = viewNode; 71 head = viewNode;
72 } 72 }
73 return viewNode; 73 return viewNode;
74 }); 74 });
75 var view = new devtools.profiler.ProfileView(head); 75 var view = this.createView(head);
76 return view; 76 return view;
77 }; 77 };
78 78
79 79
80 /** 80 /**
81 * Factory method for a profile view.
82 *
83 * @param {devtools.profiler.ProfileView.Node} head View head node.
84 * @return {devtools.profiler.ProfileView} Profile view.
85 */
86 devtools.profiler.ViewBuilder.prototype.createView = function(head) {
87 return new devtools.profiler.ProfileView(head);
88 };
89
90
91 /**
92 * Factory method for a profile view node.
93 *
94 * @param {string} internalFuncName A fully qualified function name.
95 * @param {number} totalTime Amount of time that application spent in the
96 * corresponding function and its descendants (not that depending on
97 * profile they can be either callees or callers.)
98 * @param {number} selfTime Amount of time that application spent in the
99 * corresponding function only.
100 * @param {devtools.profiler.ProfileView.Node} head Profile view head.
101 * @return {devtools.profiler.ProfileView.Node} Profile view node.
102 */
103 devtools.profiler.ViewBuilder.prototype.createViewNode = function(
104 funcName, totalTime, selfTime, head) {
105 return new devtools.profiler.ProfileView.Node(
106 funcName, totalTime, selfTime, head);
107 };
108
109
110 /**
81 * Creates a Profile View object. It allows to perform sorting 111 * Creates a Profile View object. It allows to perform sorting
82 * and filtering actions on the profile. Profile View mimicks 112 * and filtering actions on the profile.
83 * the Profile object from WebKit's JSC profiler.
84 * 113 *
85 * @param {devtools.profiler.ProfileView.Node} head Head (root) node. 114 * @param {devtools.profiler.ProfileView.Node} head Head (root) node.
86 * @constructor 115 * @constructor
87 */ 116 */
88 devtools.profiler.ProfileView = function(head) { 117 devtools.profiler.ProfileView = function(head) {
89 this.head = head; 118 this.head = head;
90 this.title = '';
91 this.uid = '';
92 this.heavyProfile = null;
93 this.treeProfile = null;
94 this.flatProfile = null;
95 }; 119 };
96 120
97 121
98 /** 122 /**
99 * Sorts the profile view using the specified sort function. 123 * Sorts the profile view using the specified sort function.
100 * 124 *
101 * @param {function(devtools.profiler.ProfileView.Node, 125 * @param {function(devtools.profiler.ProfileView.Node,
102 * devtools.profiler.ProfileView.Node):number} sortFunc A sorting 126 * devtools.profiler.ProfileView.Node):number} sortFunc A sorting
103 * functions. Must comply with Array.sort sorting function requirements. 127 * functions. Must comply with Array.sort sorting function requirements.
104 */ 128 */
(...skipping 28 matching lines...) Expand all
133 * @param {number} totalTime Amount of time that application spent in the 157 * @param {number} totalTime Amount of time that application spent in the
134 * corresponding function and its descendants (not that depending on 158 * corresponding function and its descendants (not that depending on
135 * profile they can be either callees or callers.) 159 * profile they can be either callees or callers.)
136 * @param {number} selfTime Amount of time that application spent in the 160 * @param {number} selfTime Amount of time that application spent in the
137 * corresponding function only. 161 * corresponding function only.
138 * @param {devtools.profiler.ProfileView.Node} head Profile view head. 162 * @param {devtools.profiler.ProfileView.Node} head Profile view head.
139 * @constructor 163 * @constructor
140 */ 164 */
141 devtools.profiler.ProfileView.Node = function( 165 devtools.profiler.ProfileView.Node = function(
142 internalFuncName, totalTime, selfTime, head) { 166 internalFuncName, totalTime, selfTime, head) {
143 this.callIdentifier = 0;
144 this.internalFuncName = internalFuncName; 167 this.internalFuncName = internalFuncName;
145 this.initFuncInfo();
146 this.totalTime = totalTime; 168 this.totalTime = totalTime;
147 this.selfTime = selfTime; 169 this.selfTime = selfTime;
148 this.head = head; 170 this.head = head;
149 this.parent = null; 171 this.parent = null;
150 this.children = []; 172 this.children = [];
151 this.visible = true;
152 }; 173 };
153 174
154 175
155 /**
156 * RegEx for stripping V8's prefixes of compiled functions.
157 */
158 devtools.profiler.ProfileView.Node.FUNC_NAME_STRIP_RE =
159 /^(?:LazyCompile|Function): (.*)$/;
160
161
162 /**
163 * RegEx for extracting script source URL and line number.
164 */
165 devtools.profiler.ProfileView.Node.FUNC_NAME_PARSE_RE = /^([^ ]+) (.*):(\d+)$/;
166
167
168 /**
169 * RegEx for removing protocol name from URL.
170 */
171 devtools.profiler.ProfileView.Node.URL_PARSE_RE = /^(?:http:\/)?.*\/([^/]+)$/;
172
173
174 /**
175 * Inits 'functionName', 'url', and 'lineNumber' fields using 'internalFuncName'
176 * field.
177 */
178 devtools.profiler.ProfileView.Node.prototype.initFuncInfo = function() {
179 var nodeAlias = devtools.profiler.ProfileView.Node;
180 this.functionName = this.internalFuncName;
181
182 var strippedName = nodeAlias.FUNC_NAME_STRIP_RE.exec(this.functionName);
183 if (strippedName) {
184 this.functionName = strippedName[1];
185 }
186
187 var parsedName = nodeAlias.FUNC_NAME_PARSE_RE.exec(this.functionName);
188 if (parsedName) {
189 this.url = parsedName[2];
190 var parsedUrl = nodeAlias.URL_PARSE_RE.exec(this.url);
191 if (parsedUrl) {
192 this.url = parsedUrl[1];
193 }
194 this.functionName = parsedName[1];
195 this.lineNumber = parsedName[3];
196 } else {
197 this.url = '';
198 this.lineNumber = 0;
199 }
200 };
201
202
203 /** 176 /**
204 * Returns a share of the function's total time in application's total time. 177 * Returns a share of the function's total time in application's total time.
205 */ 178 */
206 devtools.profiler.ProfileView.Node.prototype.__defineGetter__( 179 devtools.profiler.ProfileView.Node.prototype.__defineGetter__(
207 'totalPercent', 180 'totalPercent',
208 function() { return this.totalTime / 181 function() { return this.totalTime /
209 (this.head ? this.head.totalTime : this.totalTime) * 100.0; }); 182 (this.head ? this.head.totalTime : this.totalTime) * 100.0; });
210 183
211 184
212 /** 185 /**
(...skipping 29 matching lines...) Expand all
242 * Sorts all the node's children recursively. 215 * Sorts all the node's children recursively.
243 * 216 *
244 * @param {function(devtools.profiler.ProfileView.Node, 217 * @param {function(devtools.profiler.ProfileView.Node,
245 * devtools.profiler.ProfileView.Node):number} sortFunc A sorting 218 * devtools.profiler.ProfileView.Node):number} sortFunc A sorting
246 * functions. Must comply with Array.sort sorting function requirements. 219 * functions. Must comply with Array.sort sorting function requirements.
247 */ 220 */
248 devtools.profiler.ProfileView.Node.prototype.sortChildren = function( 221 devtools.profiler.ProfileView.Node.prototype.sortChildren = function(
249 sortFunc) { 222 sortFunc) {
250 this.children.sort(sortFunc); 223 this.children.sort(sortFunc);
251 }; 224 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698