Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_V8_PROFILER_H_ | 5 #ifndef V8_V8_PROFILER_H_ |
| 6 #define V8_V8_PROFILER_H_ | 6 #define V8_V8_PROFILER_H_ |
| 7 | 7 |
| 8 #include "v8.h" | 8 #include "v8.h" |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 | 306 |
| 307 /** | 307 /** |
| 308 * HeapSnapshots record the state of the JS heap at some moment. | 308 * HeapSnapshots record the state of the JS heap at some moment. |
| 309 */ | 309 */ |
| 310 class V8_EXPORT HeapSnapshot { | 310 class V8_EXPORT HeapSnapshot { |
| 311 public: | 311 public: |
| 312 enum SerializationFormat { | 312 enum SerializationFormat { |
| 313 kJSON = 0 // See format description near 'Serialize' method. | 313 kJSON = 0 // See format description near 'Serialize' method. |
| 314 }; | 314 }; |
| 315 | 315 |
| 316 /** Returns heap snapshot UID (assigned by the profiler.) */ | |
| 317 unsigned GetUid() const; | |
| 318 | |
| 319 /** Returns heap snapshot title. */ | |
| 320 Handle<String> GetTitle() const; | |
| 321 | |
| 322 /** Returns the root node of the heap graph. */ | 316 /** Returns the root node of the heap graph. */ |
| 323 const HeapGraphNode* GetRoot() const; | 317 const HeapGraphNode* GetRoot() const; |
| 324 | 318 |
| 325 /** Returns a node by its id. */ | 319 /** Returns a node by its id. */ |
| 326 const HeapGraphNode* GetNodeById(SnapshotObjectId id) const; | 320 const HeapGraphNode* GetNodeById(SnapshotObjectId id) const; |
| 327 | 321 |
| 328 /** Returns total nodes count in the snapshot. */ | 322 /** Returns total nodes count in the snapshot. */ |
| 329 int GetNodesCount() const; | 323 int GetNodesCount() const; |
| 330 | 324 |
| 331 /** Returns a node by index. */ | 325 /** Returns a node by index. */ |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 360 * edge_count: nnn | 354 * edge_count: nnn |
| 361 * }, | 355 * }, |
| 362 * nodes: [nodes array], | 356 * nodes: [nodes array], |
| 363 * edges: [edges array], | 357 * edges: [edges array], |
| 364 * strings: [strings array] | 358 * strings: [strings array] |
| 365 * } | 359 * } |
| 366 * | 360 * |
| 367 * Nodes reference strings, other nodes, and edges by their indexes | 361 * Nodes reference strings, other nodes, and edges by their indexes |
| 368 * in corresponding arrays. | 362 * in corresponding arrays. |
| 369 */ | 363 */ |
| 370 void Serialize(OutputStream* stream, SerializationFormat format) const; | 364 void Serialize(OutputStream* stream, |
| 365 SerializationFormat format = kJSON) const; | |
| 371 }; | 366 }; |
| 372 | 367 |
| 373 | 368 |
| 374 /** | 369 /** |
| 375 * An interface for reporting progress and controlling long-running | 370 * An interface for reporting progress and controlling long-running |
| 376 * activities. | 371 * activities. |
| 377 */ | 372 */ |
| 378 class V8_EXPORT ActivityControl { // NOLINT | 373 class V8_EXPORT ActivityControl { // NOLINT |
| 379 public: | 374 public: |
| 380 enum ControlOption { | 375 enum ControlOption { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 /** | 440 /** |
| 446 * Returns name to be used in the heap snapshot for given node. Returned | 441 * Returns name to be used in the heap snapshot for given node. Returned |
| 447 * string must stay alive until snapshot collection is completed. | 442 * string must stay alive until snapshot collection is completed. |
| 448 */ | 443 */ |
| 449 virtual const char* GetName(Handle<Object> object) = 0; | 444 virtual const char* GetName(Handle<Object> object) = 0; |
| 450 protected: | 445 protected: |
| 451 virtual ~ObjectNameResolver() {} | 446 virtual ~ObjectNameResolver() {} |
| 452 }; | 447 }; |
| 453 | 448 |
| 454 /** | 449 /** |
| 455 * Takes a heap snapshot and returns it. Title may be an empty string. | 450 * Takes a heap snapshot and returns it. Title parameter is deprecated and |
| 451 * should be an empty string. | |
| 456 */ | 452 */ |
| 457 const HeapSnapshot* TakeHeapSnapshot( | 453 const HeapSnapshot* TakeHeapSnapshot( |
|
alph
2015/03/10 10:23:26
V8_DEPRECATED
yurys
2015/03/10 10:23:57
I will need to fix Blink side first.
Yang
2015/03/10 10:38:11
Please add a TODO.
yurys
2015/03/10 12:08:39
Done.
| |
| 458 Handle<String> title, | 454 Handle<String> title, |
| 459 ActivityControl* control = NULL, | 455 ActivityControl* control = NULL, |
| 460 ObjectNameResolver* global_object_name_resolver = NULL); | 456 ObjectNameResolver* global_object_name_resolver = NULL); |
| 461 | 457 |
| 458 const HeapSnapshot* TakeHeapSnapshot( | |
| 459 ActivityControl* control = NULL, | |
| 460 ObjectNameResolver* global_object_name_resolver = NULL); | |
| 461 | |
| 462 /** | 462 /** |
| 463 * Starts tracking of heap objects population statistics. After calling | 463 * Starts tracking of heap objects population statistics. After calling |
| 464 * this method, all heap objects relocations done by the garbage collector | 464 * this method, all heap objects relocations done by the garbage collector |
| 465 * are being registered. | 465 * are being registered. |
| 466 * | 466 * |
| 467 * |track_allocations| parameter controls whether stack trace of each | 467 * |track_allocations| parameter controls whether stack trace of each |
| 468 * allocation in the heap will be recorded and reported as part of | 468 * allocation in the heap will be recorded and reported as part of |
| 469 * HeapSnapshot. | 469 * HeapSnapshot. |
| 470 */ | 470 */ |
| 471 void StartTrackingHeapObjects(bool track_allocations = false); | 471 void StartTrackingHeapObjects(bool track_allocations = false); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 uint32_t index; // Index of the time interval that was changed. | 609 uint32_t index; // Index of the time interval that was changed. |
| 610 uint32_t count; // New value of count field for the interval with this index. | 610 uint32_t count; // New value of count field for the interval with this index. |
| 611 uint32_t size; // New value of size field for the interval with this index. | 611 uint32_t size; // New value of size field for the interval with this index. |
| 612 }; | 612 }; |
| 613 | 613 |
| 614 | 614 |
| 615 } // namespace v8 | 615 } // namespace v8 |
| 616 | 616 |
| 617 | 617 |
| 618 #endif // V8_V8_PROFILER_H_ | 618 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |