Code covered by the BSD License  

Highlights from
tracer4m

5.0

5.0 | 1 rating Rate this file 18 Downloads (last 30 days) File Size: 125 KB File ID: #28929
image thumbnail

tracer4m

by

 

tracer4m traces calls to methods and functions.

| Watch this File

File Information
Description

tracer4m traces calls to methods and functions.

Object-oriented design is about distributing responsibilities among interacting objects.
The objects should be small and focused. This results in a complex flow of calls.
Furthermore, in a GUI the user manipulates controls, which in turns trigger events and
chains of calls to methods and functions. There is a need to trace the calls.

The goal of tracer4m is to support unit testing, debugging, and analysis of existing code.

Example based on "Example - Using Events to Update Graphs" from the Matlab on-line help
 
feobject = fcneval( @(x,y) x.*exp(-x.^2-y.^2), [-2 2 ] );
fcnview.createViews( feobject );
log = TraceHistory.Instance;
log.setup( { 'fcneval', 'fcnview', 'createViews' } )
feobject.FofXY = @(x,y) x.*exp(-x.^.5-y.^.5);
disp( log )
%
log.clearHistory
feobject.Lm = [-8 3];
disp( log )

Part of the result is depicted in the image above.

Documentation: tracer4m_demo.html, which is generated by PUBLISH, discusses and demonstrate the use and behaviour of tracer4m.

I would appreciate comments especially regarding requirements on tracing tools for Matlab

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
01 Nov 2012 per isakson

Jesse, thanks for the comment. The purpose of pause(0.001) *was* to ensure that each successive call should have a unique timestamp. That was useful during debugging.

23 Oct 2012 Jesse Hopkins

Wow thank you for this incredibly useful utility. I had one hickup which was user error. I used the output of "dir" to pass into the setup function, which broke the setup. Worked fine once I stripped off the ".m" extension from the filenames returned by dir.

Afterwords, everything "just worked", and I was able to get incredibly useful traces. I had attempted something simliar in the past, but never could get anything working without instrumenting the code. Well done using mlint & conditional breakpoint side effects to get function traces without needing to modify code.

Question: Why call pause(0.001) in TraceHistory.add?

Contact us