Skip to content

Commit

Permalink
1) Minor modification in Matlab profiler template class
Browse files Browse the repository at this point in the history
2) Added a class for "call by reference" of large matrices
  • Loading branch information
hkhauke committed Feb 15, 2024
1 parent ce49998 commit 48186ad
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classdef jvxMatrixReference < handle
properties
data
end
methods
function h = jvxMatrixReference(N, M)
h.data = zeros(N,M);
end

function setRow(obj, idx, dat)
obj.data(idx, :) = dat;
end

function m = matrix(obj)
m = obj.data;
end

function r = row(obj, idx)
r = obj.data(idx,:);
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CjvxMexCallsProfileTpl : public CjvxMexCallsTpl<T>, public CjvxMexCallsPro
struct
{
jvxBool matlab_debug_enabled = false; // <- this means: allow matlab and c code operated in parallel - required for verification
jvxBool skipInvolveCCode = false;
jvxCBool skipInvolveCCode = c_false;
jvxBool matlab_profiling_enabled = false;
} config;

Expand Down Expand Up @@ -142,18 +142,20 @@ class CjvxMexCallsProfileTpl : public CjvxMexCallsTpl<T>, public CjvxMexCallsPro
CjvxMexCallsProfiler::profile_start_in_process();
}

// Copy input data for later usage
for (i = 0; i < _common_set_icon.theData_in->con_params.number_channels; i++)
if (config.skipInvolveCCode)
{
jvxData* ptrTo = dbgFldCopyInputs[i];
jvxData* ptrFrom = (jvxData*)buffers_in[i];
memcpy(ptrTo, ptrFrom, sizeof(jvxData) * _common_set_icon.theData_in->con_params.buffersize);
skipCCode = true;
}


if (config.skipInvolveCCode)
if (!skipCCode)
{
skipCCode = true;
// Copy input data for later usage
for (i = 0; i < _common_set_icon.theData_in->con_params.number_channels; i++)
{
jvxData* ptrTo = dbgFldCopyInputs[i];
jvxData* ptrFrom = (jvxData*)buffers_in[i];
memcpy(ptrTo, ptrFrom, sizeof(jvxData) * _common_set_icon.theData_in->con_params.buffersize);
}
}

// This lets Matlab run one frame of processing
Expand Down

0 comments on commit 48186ad

Please sign in to comment.