Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
dart::PageSpaceGarbageCollectionHistory Class Reference

#include <pages.h>

Public Member Functions

 PageSpaceGarbageCollectionHistory ()
 
 ~PageSpaceGarbageCollectionHistory ()
 
void AddGarbageCollectionTime (int64_t start, int64_t end)
 
int GarbageCollectionTimeFraction ()
 
bool IsEmpty () const
 

Detailed Description

Definition at line 32 of file pages.h.

Constructor & Destructor Documentation

◆ PageSpaceGarbageCollectionHistory()

dart::PageSpaceGarbageCollectionHistory::PageSpaceGarbageCollectionHistory ( )
inline

Definition at line 34 of file pages.h.

34{}

◆ ~PageSpaceGarbageCollectionHistory()

dart::PageSpaceGarbageCollectionHistory::~PageSpaceGarbageCollectionHistory ( )
inline

Definition at line 35 of file pages.h.

35{}

Member Function Documentation

◆ AddGarbageCollectionTime()

void dart::PageSpaceGarbageCollectionHistory::AddGarbageCollectionTime ( int64_t  start,
int64_t  end 
)

Definition at line 1774 of file pages.cc.

1775 {
1776 Entry entry;
1777 entry.start = start;
1778 entry.end = end;
1779 history_.Add(entry);
1780}
void Add(const T &t)
Definition: ring_buffer.h:19
glong glong end

◆ GarbageCollectionTimeFraction()

int dart::PageSpaceGarbageCollectionHistory::GarbageCollectionTimeFraction ( )

Definition at line 1782 of file pages.cc.

1782 {
1783 int64_t gc_time = 0;
1784 int64_t total_time = 0;
1785 for (int i = 0; i < history_.Size() - 1; i++) {
1786 Entry current = history_.Get(i);
1787 Entry previous = history_.Get(i + 1);
1788 gc_time += current.end - current.start;
1789 total_time += current.end - previous.end;
1790 }
1791 if (total_time == 0) {
1792 return 0;
1793 } else {
1794 ASSERT(total_time >= gc_time);
1795 int result = static_cast<int>(
1796 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100);
1797 return result;
1798 }
1799}
const T & Get(int i) const
Definition: ring_buffer.h:22
int64_t Size() const
Definition: ring_buffer.h:28
#define ASSERT(E)
GAsyncResult * result

◆ IsEmpty()

bool dart::PageSpaceGarbageCollectionHistory::IsEmpty ( ) const
inline

Definition at line 41 of file pages.h.

41{ return history_.Size() == 0; }

The documentation for this class was generated from the following files: