Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages   Examples  

HtmlTrace Class Reference
[Base]

Inherits TraceConsumer, and TraceFilter.


Detailed Description

HTML trace.

Author:
Ralf Gerstenberger

HtmlTrace logs simulation events of all model components to a html file or an open output stream. If the user provides a filename HtmlTrace opens and closes this file automatically.

Example:
To use a HtmlTrace the user has to create an object of type HtmlTrace first. A good place to do this is initSimulation().
class UserSimulation : public Simulation {
...
public:
HtmlTrace* myTrace;
...
virtual void initSimulation() 
{
        myTrace = new HtmlTrace(this, "MyTrace.html");
After that the created trace object has to be registered to the simulation to receive events with addConsumer(). It can be unregistered with removeConsumer().
        addConsumer(myTrace);
HtmlTrace provides a crude filter to reduce the number of logged simulation events. The filter is set with setFilter(). This has to be done before the trace is started or while it is paused. (see setFilter() for details)
        myTrace->setFilter("none; st:class odemx::Condq;");
Finally to activate the logging call startTrace() on the simulation. You can use pauseTrace() and continueTrace() to break the trace temporarily.
        startTrace();
...
}
...
int main() 
{
        UserSimulation sim;
        sim.runUntil(20.0);
        sim.pauseTrace();
        sim.runUntil(25.0);
        sim.continueTrace();
        sim.runUntil(31.0);
Use stopTrace() to stop tracing manually.
        sim.stopTrace();
        sim.run();
}       
It is possible to have more than one HtmlTrace registered to a simulation. Each could use a different filter.
in main()
{
        UserSimulation sim;
        HtmlTrace mySecondTrace(&sim, "My2Trace.html");
        mySecondTrace.setFilter("all; sl: MyCondq");
        sim.addConsumer(&mySecondTrace);
        ...
}
Since:
1.0


Public Member Functions

Construction
 HtmlTrace (Simulation *s, const char *filename=0)
 HtmlTrace (Simulation *s, std::ostream &os)
Destruction
virtual ~HtmlTrace ()
Filter
virtual void setFilter (const char *f)
 Set trace filter.


Constructor & Destructor Documentation

HtmlTrace Simulation s,
const char *  filename = 0
 

Parameters:
s Simulation
filename file for output
HtmlTrace opens the file filename and writes into this file. When HtmlTrace is deleted the file is closed. If HtmlTrace fails to open the file the output is send to stdout.

HtmlTrace Simulation s,
std::ostream &  os
 

Parameters:
s Simulation
os ostream for output
HtmlTrace writes its output to the ostream os.

~HtmlTrace  )  [virtual]
 

In case HtmlTrace has opened a file it is closed by the destructor.


Member Function Documentation

void setFilter const char *  f  )  [virtual]
 

Set trace filter.

Parameters:
f filter string
HtmlTrace provides a filter to remove marks from the trace. This filter is set with the string f. The string is read from left to right. If the keywords none or all are found the filter-policy is set. The last occurrence of one of these keywords is used. If none of these keywords is found all is used by default. The none policy blocks all marks except those specified in the string f. The all policy passes all marks except those specified in the string f. A mark can be specified by its MarkType or its sender. The MarkType consists of the MarkTypeId, the MarkTypeName and the scope of the mark. Each of these fields can be used to specify Marks. The keyword mti: is used to specify MarkTypeIds:
mti:1
mti: 345; mti:1334;
mti: 15, 2354, 2;               
The keyword mtn: can be used to specify MarktTypeNames:
mtn:begin
mtn:end , activate; mtn: destroy;
The keyword mts: is used to specify a scope:
mts:class odemx::Process
mts:class odemx::Res, class odemx::Bin; mts: class odemx::Waitq;
The sender can be specified by its label or its type. The keyword sl: is used to specify the label:
sl:MyWaitq, Car
sl: Client 2, Client 3; sl: Servant;
The keyword st: specifies the sender type:
st:class ServantType, class Bin
st:class MyTestProcess1; st:class Storage
A mark is specified if the MarkTypeId, the MarkTypeName, the mark scope, the sender label or the sender type are specified by the filter.

Note:
The filter can only be set in pause mode or before trace starts.


Generated on Mon Aug 11 10:36:06 2003 for ODEMx by doxygen1.3