Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: include/v8-profiler.h

Issue 6685084: Add support for CPU and heap profiles deletion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implemente per-profile deletion Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 unsigned GetUid() const; 124 unsigned GetUid() const;
125 125
126 /** Returns CPU profile title. */ 126 /** Returns CPU profile title. */
127 Handle<String> GetTitle() const; 127 Handle<String> GetTitle() const;
128 128
129 /** Returns the root node of the bottom up call tree. */ 129 /** Returns the root node of the bottom up call tree. */
130 const CpuProfileNode* GetBottomUpRoot() const; 130 const CpuProfileNode* GetBottomUpRoot() const;
131 131
132 /** Returns the root node of the top down call tree. */ 132 /** Returns the root node of the top down call tree. */
133 const CpuProfileNode* GetTopDownRoot() const; 133 const CpuProfileNode* GetTopDownRoot() const;
134
135 /**
136 * Deletes the profile and removes it from CpuProfiler's list.
137 * All pointers to nodes previously returned become invalid.
138 * Profiles with the same uid but obtained using different
139 * security token are not deleted, but become inaccessible
140 * using FindProfile method. It is embedder's responsibility
141 * to call Delete on these profiles.
142 */
143 void Delete() const;
Vitaly Repeshko 2011/03/22 14:30:36 "const" looks weird here.
mnaganov (inactive) 2011/03/22 16:03:09 Hmm, maybe. I added 'const' because all methods re
134 }; 144 };
135 145
136 146
137 /** 147 /**
138 * Interface for controlling CPU profiling. 148 * Interface for controlling CPU profiling.
139 */ 149 */
140 class V8EXPORT CpuProfiler { 150 class V8EXPORT CpuProfiler {
141 public: 151 public:
142 /** 152 /**
143 * A note on security tokens usage. As scripts from different 153 * A note on security tokens usage. As scripts from different
(...skipping 30 matching lines...) Expand all
174 */ 184 */
175 static void StartProfiling(Handle<String> title); 185 static void StartProfiling(Handle<String> title);
176 186
177 /** 187 /**
178 * Stops collecting CPU profile with a given title and returns it. 188 * Stops collecting CPU profile with a given title and returns it.
179 * If the title given is empty, finishes the last profile started. 189 * If the title given is empty, finishes the last profile started.
180 */ 190 */
181 static const CpuProfile* StopProfiling( 191 static const CpuProfile* StopProfiling(
182 Handle<String> title, 192 Handle<String> title,
183 Handle<Value> security_token = Handle<Value>()); 193 Handle<Value> security_token = Handle<Value>());
194
195 /**
196 * Deletes all existing profiles, also cancelling all profiling
197 * activity. All previously returned pointers to profiles and their
198 * contents become invalid after this call.
199 */
200 static void DeleteAllProfiles();
184 }; 201 };
185 202
186 203
187 class HeapGraphNode; 204 class HeapGraphNode;
188 205
189 206
190 /** 207 /**
191 * HeapSnapshotEdge represents a directed connection between heap 208 * HeapSnapshotEdge represents a directed connection between heap
192 * graph nodes: from retaners to retained nodes. 209 * graph nodes: from retaners to retained nodes.
193 */ 210 */
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 /** Returns a node by its id. */ 378 /** Returns a node by its id. */
362 const HeapGraphNode* GetNodeById(uint64_t id) const; 379 const HeapGraphNode* GetNodeById(uint64_t id) const;
363 380
364 /** 381 /**
365 * Returns a diff between this snapshot and another one. Only snapshots 382 * Returns a diff between this snapshot and another one. Only snapshots
366 * of the same type can be compared. 383 * of the same type can be compared.
367 */ 384 */
368 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; 385 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const;
369 386
370 /** 387 /**
388 * Deletes the snapshot and removes it from HeapProfiler's list.
389 * All pointers to nodes, edges and paths previously returned become
390 * invalid.
391 */
392 void Delete() const;
Vitaly Repeshko 2011/03/22 14:30:36 Ditto.
mnaganov (inactive) 2011/03/22 16:03:09 Done.
393
394 /**
371 * Prepare a serialized representation of the snapshot. The result 395 * Prepare a serialized representation of the snapshot. The result
372 * is written into the stream provided in chunks of specified size. 396 * is written into the stream provided in chunks of specified size.
373 * The total length of the serialized snapshot is unknown in 397 * The total length of the serialized snapshot is unknown in
374 * advance, it is can be roughly equal to JS heap size (that means, 398 * advance, it is can be roughly equal to JS heap size (that means,
375 * it can be really big - tens of megabytes). 399 * it can be really big - tens of megabytes).
376 * 400 *
377 * For the JSON format, heap contents are represented as an object 401 * For the JSON format, heap contents are represented as an object
378 * with the following structure: 402 * with the following structure:
379 * 403 *
380 * { 404 * {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 444
421 /** 445 /**
422 * Takes a heap snapshot and returns it. Title may be an empty string. 446 * Takes a heap snapshot and returns it. Title may be an empty string.
423 * See HeapSnapshot::Type for types description. 447 * See HeapSnapshot::Type for types description.
424 */ 448 */
425 static const HeapSnapshot* TakeSnapshot( 449 static const HeapSnapshot* TakeSnapshot(
426 Handle<String> title, 450 Handle<String> title,
427 HeapSnapshot::Type type = HeapSnapshot::kFull, 451 HeapSnapshot::Type type = HeapSnapshot::kFull,
428 ActivityControl* control = NULL); 452 ActivityControl* control = NULL);
429 453
454 /**
455 * Deletes all snapshots taken. All previously returned pointers to
456 * snapshots and their contents become invalid after this call.
457 */
458 static void DeleteAllSnapshots();
459
430 /** Binds a callback to embedder's class ID. */ 460 /** Binds a callback to embedder's class ID. */
431 static void DefineWrapperClass( 461 static void DefineWrapperClass(
432 uint16_t class_id, 462 uint16_t class_id,
433 WrapperInfoCallback callback); 463 WrapperInfoCallback callback);
434 464
435 /** 465 /**
436 * Default value of persistent handle class ID. Must not be used to 466 * Default value of persistent handle class ID. Must not be used to
437 * define a class. Can be used to reset a class of a persistent 467 * define a class. Can be used to reset a class of a persistent
438 * handle. 468 * handle.
439 */ 469 */
(...skipping 16 matching lines...) Expand all
456 * 486 *
457 * Thus, if an embedder wants to provide information about native 487 * Thus, if an embedder wants to provide information about native
458 * objects for heap snapshots, he can do it in a GC prologue 488 * objects for heap snapshots, he can do it in a GC prologue
459 * handler, and / or by assigning wrapper class ids in the following way: 489 * handler, and / or by assigning wrapper class ids in the following way:
460 * 490 *
461 * 1. Bind a callback to class id by calling DefineWrapperClass. 491 * 1. Bind a callback to class id by calling DefineWrapperClass.
462 * 2. Call SetWrapperClassId on certain persistent handles. 492 * 2. Call SetWrapperClassId on certain persistent handles.
463 * 493 *
464 * V8 takes ownership of RetainedObjectInfo instances passed to it and 494 * V8 takes ownership of RetainedObjectInfo instances passed to it and
465 * keeps them alive only during snapshot collection. Afterwards, they 495 * keeps them alive only during snapshot collection. Afterwards, they
466 * are freed by calling the Dispose class function. 496 * are freed by calling the Delete class function.
Vitaly Repeshko 2011/03/22 14:30:36 Accidental edit?
mnaganov (inactive) 2011/03/22 16:03:09 Ah, yes. Massive renaming. Reverted.
467 */ 497 */
468 class V8EXPORT RetainedObjectInfo { // NOLINT 498 class V8EXPORT RetainedObjectInfo { // NOLINT
469 public: 499 public:
470 /** Called by V8 when it no longer needs an instance. */ 500 /** Called by V8 when it no longer needs an instance. */
471 virtual void Dispose() = 0; 501 virtual void Dispose() = 0;
472 502
473 /** Returns whether two instances are equivalent. */ 503 /** Returns whether two instances are equivalent. */
474 virtual bool IsEquivalent(RetainedObjectInfo* other) = 0; 504 virtual bool IsEquivalent(RetainedObjectInfo* other) = 0;
475 505
476 /** 506 /**
(...skipping 27 matching lines...) Expand all
504 }; 534 };
505 535
506 536
507 } // namespace v8 537 } // namespace v8
508 538
509 539
510 #undef V8EXPORT 540 #undef V8EXPORT
511 541
512 542
513 #endif // V8_V8_PROFILER_H_ 543 #endif // V8_V8_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698