Download AspectMatlab - Sable Research Group

Transcript
D.3. Measuring floating point operations
any : call(*);
end
actions
% before tracked call set up vars
beforeTrack : before tracking : (name)
fprintf(’encountered call to %s, recording flops...\n’,name);
this.callSite = struct(); % callsite -> id
this.call = []; % number of calls per call site
this.flop = []; % flops per call site
this.nextId = 1;
this.s = this.stack();
this.record = true;
end
% before any call - take care of loops on stack (if recording)
% this gets called after the beforeTrack advice, so that the tracked
call can
% report information
bany : before any
if (˜this.record)
return; % return if we are not recording
end
this.s = this.push(this.s,0);
end
% after call - store info and put flops on previous ’stack frame’
% ’aany’ should get called first, because a call to the tracking
function
% should still list said call with the corresponding flops
information
aany : after any : (name,line,loc);
if (˜this.record)
return; % return if we are not recording
end
[this.s,f] = this.pop(this.s); % get flops and return stack
id = this.getId(loc,line,name);
99