More documentation
This commit is contained in:
parent
f9932ce527
commit
43396b50cd
5 changed files with 98 additions and 1 deletions
26
src/GC/docs/lib/chunk.md
Normal file
26
src/GC/docs/lib/chunk.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# chunk.hpp
|
||||
|
||||
A chunk struct object is the basic element of what can be
|
||||
stored on the heap. When `Heap::alloc` is called a
|
||||
chunk may be created to represent the space of memory
|
||||
that was allocated on the heap by `alloc`.
|
||||
|
||||
## Members
|
||||
`bool m_marked`: A boolean flag to mark an object during mark/sweep.
|
||||
|
||||
`uintptr_t *const m_start`: A constant pointer pointing to the start
|
||||
address of the memory space that was allocated.
|
||||
|
||||
`const size_t m_size`: The size of the memory space that was allocated.
|
||||
|
||||
## Constructors
|
||||
There are three constructors for a chunk. One regular constructor
|
||||
and two copy constructors.
|
||||
|
||||
`Chunk(size_t size, uintptr_t *start)`: Used for creating new chunks in
|
||||
`Heap::alloc`.
|
||||
|
||||
`Chunk(const Chunk *const c)`: A copy constructor used by the profiler
|
||||
to store chunk data after the initial chunk is deleted.
|
||||
|
||||
`Chunk(const Chunk &c)`: A secondary copy constructor used for debugging.
|
||||
47
src/GC/docs/lib/event.md
Normal file
47
src/GC/docs/lib/event.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# event.hpp & event.cpp
|
||||
|
||||
An event class used by the profiler to track actions
|
||||
on the heap.
|
||||
|
||||
## Members
|
||||
`const GCEventType m_type`: The type of event recorded.
|
||||
|
||||
`const std::time_t m_timestamp`: The timestamp of the event,
|
||||
initialized to the current time by `std::time(NULL)`.
|
||||
|
||||
`const Chunk *m_chunk`: The chunk an event is related to.
|
||||
For example, in `alloc` when a new chunk is created, a
|
||||
new event is recorded with the type of `NewChunk` and
|
||||
`m_chunk` then contains a copied version of that new chunk.
|
||||
If an event is not related to a chunk this member is initialized
|
||||
to a nullptr.
|
||||
|
||||
`const size_t m_size`: In an `AllocStart` event, this member
|
||||
stores the amount of bytes requested to `alloc`. Otherwise
|
||||
this member is initialized to 0.
|
||||
|
||||
## Constructors
|
||||
`GCEvent(GCEventType type)`: Used for creating events that are
|
||||
independent of a chunk and size (like `ProfilerDispose`).
|
||||
|
||||
`GCEvent(GCEventType type, Chunk *chunk)`: Used for creating events
|
||||
that are connected to a chunk (like `ChunkMarked`).
|
||||
|
||||
`GCEvent(GCEventType type, size_t size)`: Used for creating events
|
||||
that are related to a size (only `AllocStart`).
|
||||
|
||||
## Destructors
|
||||
`~GCEvent()`: Default destructor and also frees the member
|
||||
`m_chunk` if it's not the `nullptr`.
|
||||
|
||||
## Functions
|
||||
`GCEventType get_type()`: Getter for the type of the event.
|
||||
|
||||
`std::time_t get_time_stamp()`: Getter for the timestamp of
|
||||
the event.
|
||||
|
||||
`const Chunk *get_chunk()`: Getter for the Chunk the event
|
||||
is related to. The chunk data is constant.
|
||||
|
||||
`const char *type_to_string()`: Translates the type of the
|
||||
event to a string.
|
||||
12
src/GC/docs/lib/heap.md
Normal file
12
src/GC/docs/lib/heap.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# heap.hpp & heap.cpp
|
||||
|
||||
## Members
|
||||
|
||||
|
||||
## Constructors
|
||||
|
||||
|
||||
## Destructors
|
||||
|
||||
|
||||
## Functions
|
||||
12
src/GC/docs/lib/profiler.md
Normal file
12
src/GC/docs/lib/profiler.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# profiler.hpp & profiler.cpp
|
||||
|
||||
## Members
|
||||
|
||||
|
||||
## Constructors
|
||||
|
||||
|
||||
## Destructors
|
||||
|
||||
|
||||
## Functions
|
||||
|
|
@ -20,6 +20,6 @@ namespace GC
|
|||
|
||||
Chunk(size_t size, uintptr_t *start) : m_size(size), m_start(start) {}
|
||||
Chunk(const Chunk *const c) : m_marked(c->m_marked), m_start(c->m_start), m_size(c->m_size) {}
|
||||
Chunk(const Chunk& c) : m_marked(c.m_marked), m_start(c.m_start), m_size(c.m_size) {}
|
||||
Chunk(const Chunk &c) : m_marked(c.m_marked), m_start(c.m_start), m_size(c.m_size) {}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue