Game test!
Co-authored-by: ValterMiari <ValterMiari@users.noreply.github.com>
This commit is contained in:
parent
24daa73a39
commit
02c9ae0ab4
10 changed files with 162 additions and 69 deletions
|
|
@ -175,6 +175,8 @@ namespace GC
|
|||
*/
|
||||
void Heap::mark(uintptr_t *start, const uintptr_t *end, vector<Chunk *> &worklist)
|
||||
{
|
||||
if (getProfilerMode())
|
||||
Profiler::record(MarkStart);
|
||||
int counter = 0;
|
||||
// To find adresses thats in the worklist
|
||||
for (; start < end; start++)
|
||||
|
|
@ -202,6 +204,8 @@ namespace GC
|
|||
|
||||
if (!chunk->marked)
|
||||
{
|
||||
if (getProfilerMode())
|
||||
Profiler::record(ChunkMarked, chunk);
|
||||
chunk->marked = true;
|
||||
// Remove the marked chunk from the worklist
|
||||
it = worklist.erase(it);
|
||||
|
|
@ -247,6 +251,7 @@ namespace GC
|
|||
{
|
||||
// Add the unmarked chunks to freed chunks and remove from
|
||||
// the list of allocated chunks
|
||||
Profiler::record(ChunkSwept, chunk);
|
||||
heap->m_freed_chunks.push_back(chunk);
|
||||
iter = heap->m_allocated_chunks.erase(iter);
|
||||
}
|
||||
|
|
@ -336,8 +341,10 @@ namespace GC
|
|||
*
|
||||
* @param flags Bitmap of flags
|
||||
*/
|
||||
void Heap::collect(uint flags)
|
||||
void Heap::collect(CollectOption flags)
|
||||
{
|
||||
if (getProfilerMode())
|
||||
Profiler::record(CollectStart);
|
||||
|
||||
cout << "DEBUG COLLECT\nFLAGS: ";
|
||||
if (flags & MARK)
|
||||
|
|
|
|||
|
|
@ -33,14 +33,31 @@ namespace GC
|
|||
auto end = profiler->m_events.end();
|
||||
|
||||
std::ofstream fstr = profiler->createFileStream();
|
||||
char buffer[22];
|
||||
std::tm *btm;
|
||||
std::time_t tt;
|
||||
Chunk *chunk;
|
||||
|
||||
while (start != end)
|
||||
{
|
||||
auto event = *start++;
|
||||
|
||||
fstr << "--------------------------------"
|
||||
<< event->TypeToString()
|
||||
<< event->getTimeStamp
|
||||
tt = event->getTimeStamp();
|
||||
btm = std::localtime(&tt);
|
||||
std::strftime(buffer, 22, "%a %T", btm);
|
||||
|
||||
fstr << "--------------------------------\n"
|
||||
<< buffer
|
||||
<< "\nEvent:\t" << event->TypeToString();
|
||||
|
||||
chunk = event->getChunk();
|
||||
|
||||
if (chunk) {
|
||||
fstr << "\nChunk:\t" << chunk->start
|
||||
<< "\n Size: " << chunk->size
|
||||
<< "\n Mark: " << chunk->marked;
|
||||
}
|
||||
fstr << "--------------------------------\n" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,11 +65,14 @@ namespace GC
|
|||
{
|
||||
std::time_t tt = std::time(NULL);
|
||||
std::tm *ptm = std::localtime(&tt);
|
||||
|
||||
char buffer[32];
|
||||
std::strftime(buffer, 32, "/profiler/log_%a_%H_%M_%S.txt", ptm);
|
||||
std::string filename(buffer);
|
||||
|
||||
const std::string ABS_PATH = "/home/virre/dev/systemF/org/language/src/GC/";
|
||||
std::string fullpath = ABS_PATH + filename;
|
||||
|
||||
std::ofstream fstr(buffer);
|
||||
std::ofstream fstr(fullpath);
|
||||
return fstr;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue