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

Side by Side Diff: src/heap.h

Issue 661170: Add information about time spent in external callback to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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/heap.cc » ('j') | src/heap.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 ~DisableAssertNoAllocation() { } 1513 ~DisableAssertNoAllocation() { }
1514 }; 1514 };
1515 1515
1516 #endif 1516 #endif
1517 1517
1518 // GCTracer collects and prints ONE line after each garbage collector 1518 // GCTracer collects and prints ONE line after each garbage collector
1519 // invocation IFF --trace_gc is used. 1519 // invocation IFF --trace_gc is used.
1520 1520
1521 class GCTracer BASE_EMBEDDED { 1521 class GCTracer BASE_EMBEDDED {
1522 public: 1522 public:
1523 // Time spent while in the external scope counts towards the
1524 // external time in the tracer and will be reported separately.
1525 class ExternalScope BASE_EMBEDDED {
1526 public:
1527 explicit ExternalScope(GCTracer* tracer) : tracer_(tracer) {
1528 start_time_ = OS::TimeCurrentMillis();
1529 }
1530 ~ExternalScope() {
1531 tracer_->external_time_ += OS::TimeCurrentMillis() - start_time_;
1532 }
1533
1534 private:
1535 GCTracer* tracer_;
1536 double start_time_;
1537 };
1538
1523 GCTracer(); 1539 GCTracer();
1524
1525 ~GCTracer(); 1540 ~GCTracer();
1526 1541
1527 // Sets the collector. 1542 // Sets the collector.
1528 void set_collector(GarbageCollector collector) { collector_ = collector; } 1543 void set_collector(GarbageCollector collector) { collector_ = collector; }
1529 1544
1530 // Sets the GC count. 1545 // Sets the GC count.
1531 void set_gc_count(int count) { gc_count_ = count; } 1546 void set_gc_count(int count) { gc_count_ = count; }
1532 1547
1533 // Sets the full GC count. 1548 // Sets the full GC count.
1534 void set_full_gc_count(int count) { full_gc_count_ = count; } 1549 void set_full_gc_count(int count) { full_gc_count_ = count; }
(...skipping 13 matching lines...) Expand all
1548 1563
1549 // Returns size of object in heap (in MB). 1564 // Returns size of object in heap (in MB).
1550 double SizeOfHeapObjects() { 1565 double SizeOfHeapObjects() {
1551 return (static_cast<double>(Heap::SizeOfObjects())) / MB; 1566 return (static_cast<double>(Heap::SizeOfObjects())) / MB;
1552 } 1567 }
1553 1568
1554 double start_time_; // Timestamp set in the constructor. 1569 double start_time_; // Timestamp set in the constructor.
1555 double start_size_; // Size of objects in heap set in constructor. 1570 double start_size_; // Size of objects in heap set in constructor.
1556 GarbageCollector collector_; // Type of collector. 1571 GarbageCollector collector_; // Type of collector.
1557 1572
1573 // Keep track of the amount of time spent in external callbacks.
1574 double external_time_;
1575
1558 // A count (including this one, eg, the first collection is 1) of the 1576 // A count (including this one, eg, the first collection is 1) of the
1559 // number of garbage collections. 1577 // number of garbage collections.
1560 int gc_count_; 1578 int gc_count_;
1561 1579
1562 // A count (including this one) of the number of full garbage collections. 1580 // A count (including this one) of the number of full garbage collections.
1563 int full_gc_count_; 1581 int full_gc_count_;
1564 1582
1565 // True if the current GC is a compacting full collection, false 1583 // True if the current GC is a compacting full collection, false
1566 // otherwise. 1584 // otherwise.
1567 bool is_compacting_; 1585 bool is_compacting_;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 1725
1708 // To speed up scavenge collections new space string are kept 1726 // To speed up scavenge collections new space string are kept
1709 // separate from old space strings. 1727 // separate from old space strings.
1710 static List<Object*> new_space_strings_; 1728 static List<Object*> new_space_strings_;
1711 static List<Object*> old_space_strings_; 1729 static List<Object*> old_space_strings_;
1712 }; 1730 };
1713 1731
1714 } } // namespace v8::internal 1732 } } // namespace v8::internal
1715 1733
1716 #endif // V8_HEAP_H_ 1734 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698