| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * Returns node name. Depending on node's type this can be the name | 264 * Returns node name. Depending on node's type this can be the name |
| 265 * of the constructor (for objects), the name of the function (for | 265 * of the constructor (for objects), the name of the function (for |
| 266 * closures), string value, or an empty string (for compiled code). | 266 * closures), string value, or an empty string (for compiled code). |
| 267 */ | 267 */ |
| 268 Handle<String> GetName() const; | 268 Handle<String> GetName() const; |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * Returns node id. For the same heap object, the id remains the same | 271 * Returns node id. For the same heap object, the id remains the same |
| 272 * across all snapshots. Not applicable to aggregated heap snapshots | 272 * across all snapshots. |
| 273 * as they only contain aggregated instances. | |
| 274 */ | 273 */ |
| 275 uint64_t GetId() const; | 274 uint64_t GetId() const; |
| 276 | 275 |
| 277 /** | |
| 278 * Returns the number of instances. Only applicable to aggregated | |
| 279 * heap snapshots. | |
| 280 */ | |
| 281 int GetInstancesCount() const; | |
| 282 | |
| 283 /** Returns node's own size, in bytes. */ | 276 /** Returns node's own size, in bytes. */ |
| 284 int GetSelfSize() const; | 277 int GetSelfSize() const; |
| 285 | 278 |
| 286 /** | 279 /** |
| 287 * Returns node's retained size, in bytes. That is, self + sizes of | 280 * Returns node's retained size, in bytes. That is, self + sizes of |
| 288 * the objects that are reachable only from this object. In other | 281 * the objects that are reachable only from this object. In other |
| 289 * words, the size of memory that will be reclaimed having this node | 282 * words, the size of memory that will be reclaimed having this node |
| 290 * collected. | 283 * collected. |
| 291 * | 284 * |
| 292 * Exact retained size calculation has O(N) (number of nodes) | 285 * Exact retained size calculation has O(N) (number of nodes) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 316 const HeapGraphNode* GetDominatorNode() const; | 309 const HeapGraphNode* GetDominatorNode() const; |
| 317 }; | 310 }; |
| 318 | 311 |
| 319 | 312 |
| 320 /** | 313 /** |
| 321 * HeapSnapshots record the state of the JS heap at some moment. | 314 * HeapSnapshots record the state of the JS heap at some moment. |
| 322 */ | 315 */ |
| 323 class V8EXPORT HeapSnapshot { | 316 class V8EXPORT HeapSnapshot { |
| 324 public: | 317 public: |
| 325 enum Type { | 318 enum Type { |
| 326 kFull = 0, // Heap snapshot with all instances and references. | 319 kFull = 0 // Heap snapshot with all instances and references. |
| 327 kAggregated = 1 // Snapshot doesn't contain individual heap entries, | |
| 328 // instead they are grouped by constructor name. | |
| 329 }; | 320 }; |
| 330 enum SerializationFormat { | 321 enum SerializationFormat { |
| 331 kJSON = 0 // See format description near 'Serialize' method. | 322 kJSON = 0 // See format description near 'Serialize' method. |
| 332 }; | 323 }; |
| 333 | 324 |
| 334 /** Returns heap snapshot type. */ | 325 /** Returns heap snapshot type. */ |
| 335 Type GetType() const; | 326 Type GetType() const; |
| 336 | 327 |
| 337 /** Returns heap snapshot UID (assigned by the profiler.) */ | 328 /** Returns heap snapshot UID (assigned by the profiler.) */ |
| 338 unsigned GetUid() const; | 329 unsigned GetUid() const; |
| 339 | 330 |
| 340 /** Returns heap snapshot title. */ | 331 /** Returns heap snapshot title. */ |
| 341 Handle<String> GetTitle() const; | 332 Handle<String> GetTitle() const; |
| 342 | 333 |
| 343 /** Returns the root node of the heap graph. */ | 334 /** Returns the root node of the heap graph. */ |
| 344 const HeapGraphNode* GetRoot() const; | 335 const HeapGraphNode* GetRoot() const; |
| 345 | 336 |
| 346 /** Returns a node by its id. */ | 337 /** Returns a node by its id. */ |
| 347 const HeapGraphNode* GetNodeById(uint64_t id) const; | 338 const HeapGraphNode* GetNodeById(uint64_t id) const; |
| 348 | 339 |
| 340 /** Returns total nodes count in the snapshot. */ |
| 341 int GetNodesCount() const; |
| 342 |
| 343 /** Returns a node by index. */ |
| 344 const HeapGraphNode* GetNode(int index) const; |
| 345 |
| 349 /** | 346 /** |
| 350 * Deletes the snapshot and removes it from HeapProfiler's list. | 347 * Deletes the snapshot and removes it from HeapProfiler's list. |
| 351 * All pointers to nodes, edges and paths previously returned become | 348 * All pointers to nodes, edges and paths previously returned become |
| 352 * invalid. | 349 * invalid. |
| 353 */ | 350 */ |
| 354 void Delete(); | 351 void Delete(); |
| 355 | 352 |
| 356 /** | 353 /** |
| 357 * Prepare a serialized representation of the snapshot. The result | 354 * Prepare a serialized representation of the snapshot. The result |
| 358 * is written into the stream provided in chunks of specified size. | 355 * is written into the stream provided in chunks of specified size. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 }; | 493 }; |
| 497 | 494 |
| 498 | 495 |
| 499 } // namespace v8 | 496 } // namespace v8 |
| 500 | 497 |
| 501 | 498 |
| 502 #undef V8EXPORT | 499 #undef V8EXPORT |
| 503 | 500 |
| 504 | 501 |
| 505 #endif // V8_V8_PROFILER_H_ | 502 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |