-
Notifications
You must be signed in to change notification settings - Fork 564
Conversation
runtime/src/main/cpp/Memory.h
Outdated
@@ -17,6 +17,7 @@ | |||
#ifndef RUNTIME_MEMORY_H | |||
#define RUNTIME_MEMORY_H | |||
|
|||
#include <cstdio> | |||
#include "Assert.h" | |||
#include "Common.h" | |||
#include "TypeInfo.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это лучше в Memory.cpp перенести.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделано
runtime/src/main/cpp/Memory.cpp
Outdated
@@ -64,6 +66,13 @@ typedef KStdVector<ContainerHeader*> ContainerHeaderList; | |||
typedef KStdVector<KRef*> KRefPtrList; | |||
#endif | |||
|
|||
#if MEMORY_STATISTIC | |||
#define INC_UPDATE_REF_STATISTIC memoryStatistic.inc(old, object); | |||
MemoryStatistic memoryStatistic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это лучше в MemoryState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделано
runtime/src/main/cpp/Memory.cpp
Outdated
void printStatistic() { | ||
fprintf(stderr, "\nMemory manager statistic:\n"); | ||
fprintf(stderr, "UpdateRef[null -> null ]: %lld\n", counters[0][0]); | ||
fprintf(stderr, "UpdateRef[null -> permanent]: %lld\n", counters[0][1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше konan::consolePrintf() и печатать все же в каком-то цикле.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так проще и нагляднее. В цикле придется делать массив с текстами
runtime/src/main/cpp/Memory.cpp
Outdated
fprintf(stderr, "UpdateRef[stack -> stack ]: %lld\n", counters[3][3]); | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А по количеству и месту аллокаций?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сделал
runtime/src/main/cpp/Memory.cpp
Outdated
|
||
#if MEMORY_STATISTIC | ||
#define INC_UPDATE_REF_STATISTIC memoryState->statistic.incUpdateRef(old, object); | ||
#define INIT_STATISTIC memoryState->statistic.init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да тут-то не обязательно как с логгированием делать, можно и явно код писать под #if
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я могу вставить код под #if, но это снижает читабельность. Может так оставим?
fb120c3
to
5d7acfe
Compare
No description provided.