From f009ce9e0f837b8a744e2feda2451887eddab5b9 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 2 Feb 2023 17:16:45 +0100 Subject: [PATCH] Updated mem_analysis.m to use fgetl instead of readlines. Updated prepare_instrumentation.sh to keep MEM_COUNT_DETAILS in stripped code. --- scripts/mem_analysis.m | 19 ++++++++++++++----- scripts/prepare_instrumentation.sh | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/mem_analysis.m b/scripts/mem_analysis.m index ad75efa1c7..98611c7a30 100644 --- a/scripts/mem_analysis.m +++ b/scripts/mem_analysis.m @@ -1,15 +1,20 @@ %% -lines = readlines('../mem_analysis.csv','EmptyLineRule','skip'); +fid = fopen('../mem_analysis.csv','r'); + +% lines = readlines('../mem_analysis.csv','EmptyLineRule','skip'); names = {}; -Nframes = length(lines); +% Nframes = length(lines); -mem = zeros(1,Nframes); +% mem = zeros(1,Nframes); +mem = []; +i = 1; % Load mem_analysis.csv into matrix -for i = 1:Nframes - entries = split(lines(i),';'); +line = fgetl(fid); +while(ischar(line)) + entries = split(line,';'); for j = 1:length(entries) a = split(entries(j),','); if(length(a)==2) @@ -23,8 +28,12 @@ for i = 1:Nframes mem(I,i) = num; end end + i = i + 1; + line = fgetl(fid); end +fclose(fid); + % Reorder the matrix such that the fixed allocations are at the bottom: % --> Find all rows which are constant (sum of abs diff is zero). The >0 is % to limit the reordering to constant values only. diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index cadf4bc47a..17179fc57c 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -87,8 +87,9 @@ fi # strip switches, to remove the macros (turn on extended globing to allow !(pattern*) matching) shopt -s extglob if coan_exists; then - # remove WMOPS from the list -> otherwise it will be removed with coan and wmc_auto.h will not see it + # remove WMOPS and MEM_COUNT_DETAILS from the list to preserve the options in the instrumented code sed -i "/-DWMOPS/d" $ifdef_list + sed -i "/-UMEM_COUNT_DETAILS/d" $ifdef_list coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,rend,util,debug}/!(wmc_auto*).[hc] coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/apps/*.[hc] -- GitLab