function profData = processOnTargetData(lGlobalRegistry,profData)
% this method updates the raw results to account the overall execution
% time

% Copyright 2022 The MathWorks, Inc.

mapIds = lGlobalRegistry.getTimeProbeRangeIds();
[~, idx] = sort(mapIds(:, 2));
mapIds = mapIds(idx,:);
dim = size(mapIds);
nElements = dim(1);

currentOffset = 0;
idx = 2; % the first column is the ROOT node
totalExecTime = 0;
for i = 1:nElements
currentOffset = currentOffset + mapIds(i, 2);
nElemToModify = mapIds(i, 1);
for j = 1:nElemToModify
profData.nodes(2, idx) = j + currentOffset;
totalExecTime = totalExecTime + profData.nodes(4, idx);
idx = idx + 1;
end
end
profData.nodes(4, 1) = totalExecTime;
end