| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 /** | 190 /** |
| 191 * HeapSnapshotEdge represents a directed connection between heap | 191 * HeapSnapshotEdge represents a directed connection between heap |
| 192 * graph nodes: from retaners to retained nodes. | 192 * graph nodes: from retaners to retained nodes. |
| 193 */ | 193 */ |
| 194 class V8EXPORT HeapGraphEdge { | 194 class V8EXPORT HeapGraphEdge { |
| 195 public: | 195 public: |
| 196 enum Type { | 196 enum Type { |
| 197 kContextVariable = 0, // A variable from a function context. | 197 kContextVariable = 0, // A variable from a function context. |
| 198 kElement = 1, // An element of an array. | 198 kElement = 1, // An element of an array. |
| 199 kProperty = 2, // A named object property. | 199 kProperty = 2, // A named object property. |
| 200 kInternal = 3 // A link that can't be accessed from JS, | 200 kInternal = 3, // A link that can't be accessed from JS, |
| 201 // thus, its name isn't a real property name. | 201 // thus, its name isn't a real property name |
| 202 // (e.g. parts of a ConsString). |
| 203 kHidden = 4, // A link that is needed for proper sizes |
| 204 // calculation, but may be hidden from user. |
| 205 kShortcut = 5 // A link that must not be followed during |
| 206 // sizes calculation. |
| 202 }; | 207 }; |
| 203 | 208 |
| 204 /** Returns edge type (see HeapGraphEdge::Type). */ | 209 /** Returns edge type (see HeapGraphEdge::Type). */ |
| 205 Type GetType() const; | 210 Type GetType() const; |
| 206 | 211 |
| 207 /** | 212 /** |
| 208 * Returns edge name. This can be a variable name, an element index, or | 213 * Returns edge name. This can be a variable name, an element index, or |
| 209 * a property name. | 214 * a property name. |
| 210 */ | 215 */ |
| 211 Handle<Value> GetName() const; | 216 Handle<Value> GetName() const; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 233 const HeapGraphNode* GetToNode() const; | 238 const HeapGraphNode* GetToNode() const; |
| 234 }; | 239 }; |
| 235 | 240 |
| 236 | 241 |
| 237 /** | 242 /** |
| 238 * HeapGraphNode represents a node in a heap graph. | 243 * HeapGraphNode represents a node in a heap graph. |
| 239 */ | 244 */ |
| 240 class V8EXPORT HeapGraphNode { | 245 class V8EXPORT HeapGraphNode { |
| 241 public: | 246 public: |
| 242 enum Type { | 247 enum Type { |
| 243 kInternal = 0, // Internal node, a virtual one, for housekeeping. | 248 kInternal = 0, // For compatibility, will be removed. |
| 249 kHidden = 0, // Hidden node, may be filtered when shown to user. |
| 244 kArray = 1, // An array of elements. | 250 kArray = 1, // An array of elements. |
| 245 kString = 2, // A string. | 251 kString = 2, // A string. |
| 246 kObject = 3, // A JS object (except for arrays and strings). | 252 kObject = 3, // A JS object (except for arrays and strings). |
| 247 kCode = 4, // Compiled code. | 253 kCode = 4, // Compiled code. |
| 248 kClosure = 5, // Function closure. | 254 kClosure = 5, // Function closure. |
| 249 kRegExp = 6, // RegExp. | 255 kRegExp = 6, // RegExp. |
| 250 kHeapNumber = 7 // Number stored in the heap. | 256 kHeapNumber = 7 // Number stored in the heap. |
| 251 }; | 257 }; |
| 252 | 258 |
| 253 /** Returns node type (see HeapGraphNode::Type). */ | 259 /** Returns node type (see HeapGraphNode::Type). */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 269 | 275 |
| 270 /** | 276 /** |
| 271 * Returns the number of instances. Only applicable to aggregated | 277 * Returns the number of instances. Only applicable to aggregated |
| 272 * heap snapshots. | 278 * heap snapshots. |
| 273 */ | 279 */ |
| 274 int GetInstancesCount() const; | 280 int GetInstancesCount() const; |
| 275 | 281 |
| 276 /** Returns node's own size, in bytes. */ | 282 /** Returns node's own size, in bytes. */ |
| 277 int GetSelfSize() const; | 283 int GetSelfSize() const; |
| 278 | 284 |
| 279 /** Returns node's network (self + reachable nodes) size, in bytes. */ | |
| 280 int GetReachableSize() const; | |
| 281 | |
| 282 /** | 285 /** |
| 283 * Returns node's retained size, in bytes. That is, self + sizes of | 286 * Returns node's retained size, in bytes. That is, self + sizes of |
| 284 * the objects that are reachable only from this object. In other | 287 * the objects that are reachable only from this object. In other |
| 285 * words, the size of memory that will be reclaimed having this node | 288 * words, the size of memory that will be reclaimed having this node |
| 286 * collected. | 289 * collected. |
| 290 * |
| 291 * Exact retained size calculation has O(N) (number of nodes) |
| 292 * computational complexity, while approximate has O(1). It is |
| 293 * assumed that initially heap profiling tools provide approximate |
| 294 * sizes for all nodes, and then exact sizes are calculated for the |
| 295 * most 'interesting' nodes. |
| 287 */ | 296 */ |
| 288 int GetRetainedSize() const; | 297 int GetRetainedSize(bool exact) const; |
| 289 | 298 |
| 290 /** Returns child nodes count of the node. */ | 299 /** Returns child nodes count of the node. */ |
| 291 int GetChildrenCount() const; | 300 int GetChildrenCount() const; |
| 292 | 301 |
| 293 /** Retrieves a child by index. */ | 302 /** Retrieves a child by index. */ |
| 294 const HeapGraphEdge* GetChild(int index) const; | 303 const HeapGraphEdge* GetChild(int index) const; |
| 295 | 304 |
| 296 /** Returns retainer nodes count of the node. */ | 305 /** Returns retainer nodes count of the node. */ |
| 297 int GetRetainersCount() const; | 306 int GetRetainersCount() const; |
| 298 | 307 |
| 299 /** Returns a retainer by index. */ | 308 /** Returns a retainer by index. */ |
| 300 const HeapGraphEdge* GetRetainer(int index) const; | 309 const HeapGraphEdge* GetRetainer(int index) const; |
| 301 | 310 |
| 302 /** Returns the number of simple retaining paths from the root to the node. */ | 311 /** Returns the number of simple retaining paths from the root to the node. */ |
| 303 int GetRetainingPathsCount() const; | 312 int GetRetainingPathsCount() const; |
| 304 | 313 |
| 305 /** Returns a retaining path by index. */ | 314 /** Returns a retaining path by index. */ |
| 306 const HeapGraphPath* GetRetainingPath(int index) const; | 315 const HeapGraphPath* GetRetainingPath(int index) const; |
| 316 |
| 317 /** |
| 318 * Returns a dominator node. This is the node that participates in every |
| 319 * path from the snapshot root to the current node. |
| 320 */ |
| 321 const HeapGraphNode* GetDominatorNode() const; |
| 307 }; | 322 }; |
| 308 | 323 |
| 309 | 324 |
| 310 class V8EXPORT HeapSnapshotsDiff { | 325 class V8EXPORT HeapSnapshotsDiff { |
| 311 public: | 326 public: |
| 312 /** Returns the root node for added nodes. */ | 327 /** Returns the root node for added nodes. */ |
| 313 const HeapGraphNode* GetAdditionsRoot() const; | 328 const HeapGraphNode* GetAdditionsRoot() const; |
| 314 | 329 |
| 315 /** Returns the root node for deleted nodes. */ | 330 /** Returns the root node for deleted nodes. */ |
| 316 const HeapGraphNode* GetDeletionsRoot() const; | 331 const HeapGraphNode* GetDeletionsRoot() const; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 }; | 414 }; |
| 400 | 415 |
| 401 | 416 |
| 402 } // namespace v8 | 417 } // namespace v8 |
| 403 | 418 |
| 404 | 419 |
| 405 #undef V8EXPORT | 420 #undef V8EXPORT |
| 406 | 421 |
| 407 | 422 |
| 408 #endif // V8_V8_PROFILER_H_ | 423 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |