Version 15 (modified by sherbold, 14 years ago) (diff) |
---|
EventBenchConsole
Table of Contents
Requirements
- Java 6
- EventBenchCore
- JavaHelperLib
Description
A console application that uses the EventBenchCore. It provides a translation layer for Windows MFC applications logged with the MFCUsageMonitor and for replaying with MFCReplay.
Exemplary Work-flows
Creating a based on monitored sessions:
convertToXml logfile.txt log.xml parseXML log.xml generateReplayfile replay.xml
Creating a randomly generated replay session based on a first-order Markov model:
convertToXml logfile.txt log.xml parseXML log.xml trainMarkovModel markovModel generateRandomReplay markovModel replay.xml
Commands
- calcEntropy <modelname>
- Calculates the entropy of a first-order Markov model.
- Examples:
- calcEntropy markovModel
- convertToXml <filenameSource> <filenameTarget> {<base64>}
- Converts a logfile with prefixes created by the MFCUsageMonitor into an XML file containing the logged sessions.
- Examples:
- convertToXml d:/logfile.txt d:/log.xml
- convertToXml d:/logfile.txt d:/log.xml true
- convertDirToXml <directoryNames> <filenameTarget> {<base64>}
- Converts all files in a directory into one XML file containing all sessions, the same way convertToXml works.
- Examples:
- convertDirToXml d:/logdir d:/log.xml
- convertDirToXml d:/logdir d:/log.xml true
- generateRandomReplay <modelname> <filename> {<numSessions>}
- Generates a randomly generated replay from a previously learned usage model. The default number of sessions generate is 1.
- Examples:
- generateRandomReplay markovModel replay.xml
- generateRandomReplay markovModel replay.xml 5
- generateReplayfile <filename>
- Generates a replay file for the MFCReplay tool of the currently loaded sessions
- Examples:
- generateReplayfile d:/replay.xml
- parseXML <filename> {<countMessageOccurences>}
- Parses an XML file containing users sessions. If countMessageOccurences is true, a statistic containing how often each message occurred in the log is printed.
- Examples:
- parseXML d:/log.xml
- parseXML d:/log.xml true
- printDot <modelname>
- Prints the Dot graph representation of a model to the console.
- Examples:
- printDot markovModel
- showMarkovModel <modelname> {<showNodeNames>}
- Opens a window that display a first-order Markov model as a directed graph. Per default, the node names are not shown, as the graph gets very ugly and has overlapping nodes if they are shown.
- Examples:
- showMarkovModel markovModel
- showMarkovModel markovModel true
- trainMarkovModel <modelname> {<order>}
- Trains a Markov model based on the currently loaded sessions. The default order of the model is 1, and may be changed using the second parameter.
- Examples:
- trainMarkovModel markovModel
- trainMarkovModel markovModel 3
- trainPPM <modelname> <order>
- Trains a Prediction by Partial Match (PPM) model based on the currently loaded sessions with the specified order.
- Examples:
- trainPPM PPMModel 3
Translating MFC Messages into Events
The messages are aggregated into events using a set of rules defined in XML. The order of the rules in the XML file defines their priority.
Single Messages and Sequences
There is a distinction between single messages and whole sequences of messages of the same type. The former may be used for, e.g., WM_LBUTTONDOWN and WM_LBUTTONUP:
<msg type="&WM_LBUTTONDOWN;"/> <msg type="&WM_LBUTTONUP;"/>
Sequences of the same message occur, e.g., when scrolling:
<msg type="&WM_LBUTTONDOWN;"/> <msg type="&WM_HSCROLL;" multiple=true/> <msg type="&WM_LBUTTONUP;"/>
The distinction is using the multiple attribute of the msg node, which is per default false. If it is true, it means at least one, similar to + in regular expressions.
Storage of messages
Each message or message sequence can be stored for later use, e.g., comparisons with other messages or generating replays. This is done using the store and storeSeq nodes:
<msg type="&WM_LBUTTONDOWN;"> <store var="clicked"/> </msg> <msg type=&WM_HSCROLL;" multiple=true> <storeSeq varSeq="scrolls/> </msg>
When storing a message, the window.hwnd is automatically resolved and its target string is stored as an attribute of the message (winParamType). If other parameters contain HWNDs that need to be later on to address a target, they can be resolved manually and stored as a further parameter:
<msg type=&WM_HSCROLL;" multiple=true> <storeSeq varSeq="scrolls> <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/> </storeSeq> </msg>
Checking equalities
Only matching messages by their type is insufficient. Comparisons between their parameters are also required. This can be done using equals nodes:
<msg type="&WM_LBUTTONDOWN;"> <store var="clicked"/> </msg> <msg type="&WM_LBUTTONUP;"> <equals> <paramValue obj="this" param="window.hwnd"/> <paramvalue obj="clicked" param="window.hwnd/> </equals> </msg>
In the example above, the equals node compares whether the value of the parameter window.hwnd is equal for the stored variable clicked and the current message itself, i.e., this.
In general, each equals node has the same structure:
<equals> termNode1 termNode2 </equals>
There are four types of term nodes:
- paramValue: of the messages (example above)
- constValue: constant value, e.g., <constValue value="Button"/>
- winInfoValue: information about the target of the message.
- <winInfoValue obj="this" winParam="class"/> for the class of the target
- <winInfoValue obj="this" winParam="hwnd"/> for the HWND
- <winInfoValue obj="this" winParam="resourceId"/> for the resource Id.
- <winInfoValue obj="this" winParam="parentTarget"/> for the target of the GUI objects parent
- msgInfoValue: information about the type and target of the message.
- <msgInfoValue obj="this" msgParam="type"/> for the type of the message (its integer)
- <msgInfoValue obj="this" msgParam="target"/> for the target of the message (its string representation)
The comparison of sequence variables is not yet implemented!
Generation of replay sequences
If a message sequence has been successfully matched to a rule, a replay sequence is generated. This is done using genMsg and genMsgSeq nodes.
The first way to generate a replay message is to directly replay a message that has been stored during the matching phase:
<genMsg delay="100"> <storedVar obj=clicked"/> </genMsg>
The delay attribute signifies that the replaying tool pauses for 100 ms after sending the message stored in the variable clicked.
The second way is to construct it:
<genMsg delay="100"> <type> <msgInfoValue obj="cmd" msgParam="type"/> </type> <target> <msgInfoValue obj="cmd" msgParam="target"/> </target> <LPARAM> <paramValue obj="cmd" param="sourceDesc"/> </LPARAM> <WPARAM> <paramValue obj="cmd" param="WPARAM"/> </WPARAM> </genMsg>
The type needs to be an integer. The target needs to be a target string. The LPARAM and WPARAM are both optional, their default values are 0. They can be either numerical or target strings. Furthermore, it is possible to define the HI and LO word of them separatly:
<LPARAM> <LOWORD> value </LOWORD> <HIWORD> value </HIWORD> </LPARAM>
The value types are the same that can be used as terms for equals nodes.
To generate message sequences, the genMsgSeq node is used:
<genMsgSeq delay="20"> <type> <constValue value="&TBM_SETPOS;"/> </type> <target> <seqValue seqObj="scrolls" param="scrollBarTarget"/> </target> <LPARAM> <constValue value="1"/> </LPARAM> <WPARAM> <seqValue seqObj="scrolls" param="scrollPos"/> </WPARAM> </genMsgSeq>
The three value types used for equals are allowed. However, either the type or the target must be of a seqValue, otherwise the creation will fail. In case more than one seqValue variable is used, e.g., a different one for the LPARAM than for the target, both sequences must have the same length.