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

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

Issue 3311028: Implement heap snapshots serialization into JSON. API is designed (Closed)
Patch Set: Comments addressed Created 10 years, 3 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
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 317
318 /** 318 /**
319 * HeapSnapshots record the state of the JS heap at some moment. 319 * HeapSnapshots record the state of the JS heap at some moment.
320 */ 320 */
321 class V8EXPORT HeapSnapshot { 321 class V8EXPORT HeapSnapshot {
322 public: 322 public:
323 enum Type { 323 enum Type {
324 kFull = 0, // Heap snapshot with all instances and references. 324 kFull = 0, // Heap snapshot with all instances and references.
325 kAggregated = 1 // Snapshot doesn't contain individual heap entries, 325 kAggregated = 1 // Snapshot doesn't contain individual heap entries,
326 //instead they are grouped by constructor name. 326 // instead they are grouped by constructor name.
327 };
328 enum SerializationFormat {
329 kJSON = 0 // See format description near 'Serialize' method.
327 }; 330 };
328 331
329 /** Returns heap snapshot type. */ 332 /** Returns heap snapshot type. */
330 Type GetType() const; 333 Type GetType() const;
331 334
332 /** Returns heap snapshot UID (assigned by the profiler.) */ 335 /** Returns heap snapshot UID (assigned by the profiler.) */
333 unsigned GetUid() const; 336 unsigned GetUid() const;
334 337
335 /** Returns heap snapshot title. */ 338 /** Returns heap snapshot title. */
336 Handle<String> GetTitle() const; 339 Handle<String> GetTitle() const;
337 340
338 /** Returns the root node of the heap graph. */ 341 /** Returns the root node of the heap graph. */
339 const HeapGraphNode* GetRoot() const; 342 const HeapGraphNode* GetRoot() const;
340 343
341 /** 344 /**
342 * Returns a diff between this snapshot and another one. Only snapshots 345 * Returns a diff between this snapshot and another one. Only snapshots
343 * of the same type can be compared. 346 * of the same type can be compared.
344 */ 347 */
345 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; 348 const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const;
349
350 /**
351 * Prepare a serialized representation of the snapshot. The result
352 * is written into the stream provided in chunks of specified size.
353 * The total length of the serialized snapshot is unknown in
354 * advance, it is can be roughly equal to JS heap size (that means,
355 * it can be really big - tens of megabytes).
356 *
357 * For the JSON format, heap contents are represented as an object
358 * with the following structure:
359 *
360 * {
361 * snapshot: {title: "...", uid: nnn},
362 * nodes: [
363 * meta-info (JSON string),
364 * nodes themselves
365 * ],
366 * strings: [strings]
367 * }
368 *
369 * Outgoing node links are stored after each node. Nodes reference strings
370 * and other nodes by their indexes in corresponding arrays.
371 */
372 void Serialize(OutputStream* stream, SerializationFormat format) const;
346 }; 373 };
347 374
348 375
349 /** 376 /**
350 * Interface for controlling heap profiling. 377 * Interface for controlling heap profiling.
351 */ 378 */
352 class V8EXPORT HeapProfiler { 379 class V8EXPORT HeapProfiler {
353 public: 380 public:
354 /** Returns the number of snapshots taken. */ 381 /** Returns the number of snapshots taken. */
355 static int GetSnapshotsCount(); 382 static int GetSnapshotsCount();
(...skipping 14 matching lines...) Expand all
370 }; 397 };
371 398
372 399
373 } // namespace v8 400 } // namespace v8
374 401
375 402
376 #undef V8EXPORT 403 #undef V8EXPORT
377 404
378 405
379 #endif // V8_V8_PROFILER_H_ 406 #endif // V8_V8_PROFILER_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698