Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Memory statistic #817

Merged
merged 5 commits into from
Aug 31, 2017
Merged

Memory statistic #817

merged 5 commits into from
Aug 31, 2017

Conversation

KonstantinAnisimov
Copy link
Contributor

No description provided.

@@ -17,6 +17,7 @@
#ifndef RUNTIME_MEMORY_H
#define RUNTIME_MEMORY_H

#include <cstdio>
#include "Assert.h"
#include "Common.h"
#include "TypeInfo.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это лучше в Memory.cpp перенести.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделано

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это лучше в MemoryState.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделано

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]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше konan::consolePrintf() и печатать все же в каком-то цикле.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так проще и нагляднее. В цикле придется делать массив с текстами

fprintf(stderr, "UpdateRef[stack -> stack ]: %lld\n", counters[3][3]);
}
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А по количеству и месту аллокаций?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал


#if MEMORY_STATISTIC
#define INC_UPDATE_REF_STATISTIC memoryState->statistic.incUpdateRef(old, object);
#define INIT_STATISTIC memoryState->statistic.init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да тут-то не обязательно как с логгированием делать, можно и явно код писать под #if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я могу вставить код под #if, но это снижает читабельность. Может так оставим?

@olonho olonho merged commit 7782195 into master Aug 31, 2017
@olonho olonho deleted the memory_statistic branch August 31, 2017 15:54
vvlevchenko pushed a commit that referenced this pull request Sep 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants