| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 /** | 261 /** |
| 262 * Returns node id. For the same heap object, the id remains the same | 262 * Returns node id. For the same heap object, the id remains the same |
| 263 * across all snapshots. | 263 * across all snapshots. Not applicable to aggregated heap snapshots |
| 264 * as they only contain aggregated instances. |
| 264 */ | 265 */ |
| 265 uint64_t GetId() const; | 266 uint64_t GetId() const; |
| 266 | 267 |
| 268 /** |
| 269 * Returns the number of instances. Only applicable to aggregated |
| 270 * heap snapshots. |
| 271 */ |
| 272 int GetInstancesCount() const; |
| 273 |
| 267 /** Returns node's own size, in bytes. */ | 274 /** Returns node's own size, in bytes. */ |
| 268 int GetSelfSize() const; | 275 int GetSelfSize() const; |
| 269 | 276 |
| 270 /** Returns node's network (self + reachable nodes) size, in bytes. */ | 277 /** Returns node's network (self + reachable nodes) size, in bytes. */ |
| 271 int GetReachableSize() const; | 278 int GetReachableSize() const; |
| 272 | 279 |
| 273 /** | 280 /** |
| 274 * Returns node's retained size, in bytes. That is, self + sizes of | 281 * Returns node's retained size, in bytes. That is, self + sizes of |
| 275 * the objects that are reachable only from this object. In other | 282 * the objects that are reachable only from this object. In other |
| 276 * words, the size of memory that will be reclaimed having this node | 283 * words, the size of memory that will be reclaimed having this node |
| (...skipping 29 matching lines...) Expand all Loading... |
| 306 /** Returns the root node for deleted nodes. */ | 313 /** Returns the root node for deleted nodes. */ |
| 307 const HeapGraphNode* GetDeletionsRoot() const; | 314 const HeapGraphNode* GetDeletionsRoot() const; |
| 308 }; | 315 }; |
| 309 | 316 |
| 310 | 317 |
| 311 /** | 318 /** |
| 312 * HeapSnapshots record the state of the JS heap at some moment. | 319 * HeapSnapshots record the state of the JS heap at some moment. |
| 313 */ | 320 */ |
| 314 class V8EXPORT HeapSnapshot { | 321 class V8EXPORT HeapSnapshot { |
| 315 public: | 322 public: |
| 323 enum Type { |
| 324 kFull = 0, // Heap snapshot with all instances and references. |
| 325 kAggregated = 1 // Snapshot doesn't contain individual heap entries, |
| 326 //instead they are grouped by constructor name. |
| 327 }; |
| 328 |
| 329 /** Returns heap snapshot type. */ |
| 330 Type GetType() const; |
| 331 |
| 316 /** Returns heap snapshot UID (assigned by the profiler.) */ | 332 /** Returns heap snapshot UID (assigned by the profiler.) */ |
| 317 unsigned GetUid() const; | 333 unsigned GetUid() const; |
| 318 | 334 |
| 319 /** Returns heap snapshot title. */ | 335 /** Returns heap snapshot title. */ |
| 320 Handle<String> GetTitle() const; | 336 Handle<String> GetTitle() const; |
| 321 | 337 |
| 322 /** Returns the root node of the heap graph. */ | 338 /** Returns the root node of the heap graph. */ |
| 323 const HeapGraphNode* GetRoot() const; | 339 const HeapGraphNode* GetRoot() const; |
| 324 | 340 |
| 325 /** Returns a diff between this snapshot and another one. */ | 341 /** |
| 342 * Returns a diff between this snapshot and another one. Only snapshots |
| 343 * of the same type can be compared. |
| 344 */ |
| 326 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; | 345 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; |
| 327 }; | 346 }; |
| 328 | 347 |
| 329 | 348 |
| 330 /** | 349 /** |
| 331 * Interface for controlling heap profiling. | 350 * Interface for controlling heap profiling. |
| 332 */ | 351 */ |
| 333 class V8EXPORT HeapProfiler { | 352 class V8EXPORT HeapProfiler { |
| 334 public: | 353 public: |
| 335 /** Returns the number of snapshots taken. */ | 354 /** Returns the number of snapshots taken. */ |
| 336 static int GetSnapshotsCount(); | 355 static int GetSnapshotsCount(); |
| 337 | 356 |
| 338 /** Returns a snapshot by index. */ | 357 /** Returns a snapshot by index. */ |
| 339 static const HeapSnapshot* GetSnapshot(int index); | 358 static const HeapSnapshot* GetSnapshot(int index); |
| 340 | 359 |
| 341 /** Returns a profile by uid. */ | 360 /** Returns a profile by uid. */ |
| 342 static const HeapSnapshot* FindSnapshot(unsigned uid); | 361 static const HeapSnapshot* FindSnapshot(unsigned uid); |
| 343 | 362 |
| 344 /** Takes a heap snapshot and returns it. Title may be an empty string. */ | 363 /** |
| 345 static const HeapSnapshot* TakeSnapshot(Handle<String> title); | 364 * Takes a heap snapshot and returns it. Title may be an empty string. |
| 365 * See HeapSnapshot::Type for types description. |
| 366 */ |
| 367 static const HeapSnapshot* TakeSnapshot( |
| 368 Handle<String> title, |
| 369 HeapSnapshot::Type type = HeapSnapshot::kFull); |
| 346 }; | 370 }; |
| 347 | 371 |
| 348 | 372 |
| 349 } // namespace v8 | 373 } // namespace v8 |
| 350 | 374 |
| 351 | 375 |
| 352 #undef V8EXPORT | 376 #undef V8EXPORT |
| 353 | 377 |
| 354 | 378 |
| 355 #endif // V8_V8_PROFILER_H_ | 379 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |