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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 /** Returns node type (see HeapGraphNode::Type). */ | 251 /** Returns node type (see HeapGraphNode::Type). */ |
252 Type GetType() const; | 252 Type GetType() const; |
253 | 253 |
254 /** | 254 /** |
255 * Returns node name. Depending on node's type this can be the name | 255 * Returns node name. Depending on node's type this can be the name |
256 * of the constructor (for objects), the name of the function (for | 256 * of the constructor (for objects), the name of the function (for |
257 * closures), string value, or an empty string (for compiled code). | 257 * closures), string value, or an empty string (for compiled code). |
258 */ | 258 */ |
259 Handle<String> GetName() const; | 259 Handle<String> GetName() const; |
260 | 260 |
| 261 /** |
| 262 * Returns node id. For the same heap object, the id remains the same |
| 263 * across all snapshots. |
| 264 */ |
| 265 uint64_t GetId() const; |
| 266 |
261 /** Returns node's own size, in bytes. */ | 267 /** Returns node's own size, in bytes. */ |
262 int GetSelfSize() const; | 268 int GetSelfSize() const; |
263 | 269 |
264 /** Returns node's network (self + reachable nodes) size, in bytes. */ | 270 /** Returns node's network (self + reachable nodes) size, in bytes. */ |
265 int GetTotalSize() const; | 271 int GetTotalSize() const; |
266 | 272 |
267 /** | 273 /** |
268 * Returns node's private size, in bytes. That is, the size of memory | 274 * Returns node's private size, in bytes. That is, the size of memory |
269 * that will be reclaimed having this node collected. | 275 * that will be reclaimed having this node collected. |
270 */ | 276 */ |
(...skipping 12 matching lines...) Expand all Loading... |
283 const HeapGraphEdge* GetRetainer(int index) const; | 289 const HeapGraphEdge* GetRetainer(int index) const; |
284 | 290 |
285 /** Returns the number of simple retaining paths from the root to the node. */ | 291 /** Returns the number of simple retaining paths from the root to the node. */ |
286 int GetRetainingPathsCount() const; | 292 int GetRetainingPathsCount() const; |
287 | 293 |
288 /** Returns a retaining path by index. */ | 294 /** Returns a retaining path by index. */ |
289 const HeapGraphPath* GetRetainingPath(int index) const; | 295 const HeapGraphPath* GetRetainingPath(int index) const; |
290 }; | 296 }; |
291 | 297 |
292 | 298 |
| 299 class V8EXPORT HeapSnapshotsDiff { |
| 300 public: |
| 301 /** Returns the root node for added nodes. */ |
| 302 const HeapGraphNode* GetAdditionsRoot() const; |
| 303 |
| 304 /** Returns the root node for deleted nodes. */ |
| 305 const HeapGraphNode* GetDeletionsRoot() const; |
| 306 }; |
| 307 |
| 308 |
293 /** | 309 /** |
294 * HeapSnapshots record the state of the JS heap at some moment. | 310 * HeapSnapshots record the state of the JS heap at some moment. |
295 */ | 311 */ |
296 class V8EXPORT HeapSnapshot { | 312 class V8EXPORT HeapSnapshot { |
297 public: | 313 public: |
298 /** Returns heap snapshot UID (assigned by the profiler.) */ | 314 /** Returns heap snapshot UID (assigned by the profiler.) */ |
299 unsigned GetUid() const; | 315 unsigned GetUid() const; |
300 | 316 |
301 /** Returns heap snapshot title. */ | 317 /** Returns heap snapshot title. */ |
302 Handle<String> GetTitle() const; | 318 Handle<String> GetTitle() const; |
303 | 319 |
304 /** Returns the root node of the heap graph. */ | 320 /** Returns the root node of the heap graph. */ |
305 const HeapGraphNode* GetHead() const; | 321 const HeapGraphNode* GetRoot() const; |
| 322 |
| 323 /** Returns a diff between this snapshot and another one. */ |
| 324 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; |
306 }; | 325 }; |
307 | 326 |
308 | 327 |
309 /** | 328 /** |
310 * Interface for controlling heap profiling. | 329 * Interface for controlling heap profiling. |
311 */ | 330 */ |
312 class V8EXPORT HeapProfiler { | 331 class V8EXPORT HeapProfiler { |
313 public: | 332 public: |
314 /** Returns the number of snapshots taken. */ | 333 /** Returns the number of snapshots taken. */ |
315 static int GetSnapshotsCount(); | 334 static int GetSnapshotsCount(); |
316 | 335 |
317 /** Returns a snapshot by index. */ | 336 /** Returns a snapshot by index. */ |
318 static const HeapSnapshot* GetSnapshot(int index); | 337 static const HeapSnapshot* GetSnapshot(int index); |
319 | 338 |
320 /** Returns a profile by uid. */ | 339 /** Returns a profile by uid. */ |
321 static const HeapSnapshot* FindSnapshot(unsigned uid); | 340 static const HeapSnapshot* FindSnapshot(unsigned uid); |
322 | 341 |
323 /** Takes a heap snapshot and returns it. Title may be an empty string. */ | 342 /** Takes a heap snapshot and returns it. Title may be an empty string. */ |
324 static const HeapSnapshot* TakeSnapshot(Handle<String> title); | 343 static const HeapSnapshot* TakeSnapshot(Handle<String> title); |
325 }; | 344 }; |
326 | 345 |
327 | 346 |
328 } // namespace v8 | 347 } // namespace v8 |
329 | 348 |
330 | 349 |
331 #undef V8EXPORT | 350 #undef V8EXPORT |
332 | 351 |
333 | 352 |
334 #endif // V8_V8_PROFILER_H_ | 353 #endif // V8_V8_PROFILER_H_ |
OLD | NEW |