Skip to content

Commit

Permalink
Let execStat keep track of heap free/total size
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Apr 9, 2016
1 parent 312e5a4 commit 6a704ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Compiler/Global/Global.mo
Expand Up @@ -46,8 +46,6 @@ constant Integer instOnlyForcedFunctions = 0;
constant Integer codegenTryThrowIndex = 1;
// Global roots start at index=9
constant Integer instHashIndex = 9;
constant Integer typesIndex = 10;
constant Integer crefIndex = 11;
constant Integer builtinIndex = 12;
constant Integer builtinEnvIndex = 13;
constant Integer profilerTime1Index = 14;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Util/Error.mo
Expand Up @@ -833,7 +833,7 @@ public constant Message SUBCLOCK_CONFLICT = MESSAGE(570, TRANSLATION(), ERROR(),
public constant Message CLOCK_CONFLICT = MESSAGE(571, TRANSLATION(), ERROR(),
Util.gettext("Partitions have different base clocks."));
public constant Message EXEC_STAT = MESSAGE(572, TRANSLATION(), NOTIFICATION(),
Util.gettext("Performance of %s: time %s/%s, memory: %s / %s"));
Util.gettext("Performance of %s: time %s/%s, allocations: %s / %s, free: %s / %s"));
public constant Message EXEC_STAT_GC = MESSAGE(573, TRANSLATION(), NOTIFICATION(),
Util.gettext("Performance of %s: time %s/%s, GC stats:%s"));
public constant Message MAX_TEARING_SIZE = MESSAGE(574, SYMBOLIC(), NOTIFICATION(),
Expand Down
8 changes: 5 additions & 3 deletions Compiler/Util/ExecStat.mo
Expand Up @@ -30,11 +30,11 @@ function execStat
protected
Real t, total;
String timeStr, totalTimeStr, gcStr;
Integer memory, oldMemory, since, before;
Integer memory, oldMemory, heapsize_full, free_bytes_full, since, before;
GC.ProfStats stats, oldStats;
algorithm
if Flags.isSet(Flags.EXEC_STAT) then
(stats as GC.PROFSTATS(bytes_allocd_since_gc=since, allocd_bytes_before_gc=before)) := GC.getProfStats();
(stats as GC.PROFSTATS(bytes_allocd_since_gc=since, allocd_bytes_before_gc=before, heapsize_full=heapsize_full, free_bytes_full=free_bytes_full)) := GC.getProfStats();
memory := since+before;
oldStats := getGlobalRoot(Global.gcProfilingIndex);
(oldStats as GC.PROFSTATS(bytes_allocd_since_gc=since, allocd_bytes_before_gc=before)) := oldStats;
Expand All @@ -49,7 +49,9 @@ algorithm
else
Error.addMessage(Error.EXEC_STAT, {name, timeStr, totalTimeStr,
StringUtil.bytesToReadableUnit(memory-oldMemory, maxSizeInUnit=500, significantDigits=4),
StringUtil.bytesToReadableUnit(memory, maxSizeInUnit=500, significantDigits=4)
StringUtil.bytesToReadableUnit(memory, maxSizeInUnit=500, significantDigits=4),
StringUtil.bytesToReadableUnit(free_bytes_full, maxSizeInUnit=500, significantDigits=4),
StringUtil.bytesToReadableUnit(heapsize_full, maxSizeInUnit=500, significantDigits=4)
});
end if;
System.realtimeTick(ClockIndexes.RT_CLOCK_EXECSTAT);
Expand Down

0 comments on commit 6a704ad

Please sign in to comment.