= !EventBenchConsole = [[TracNav(TOC|nocollapse)]] [[TOC(inline)]] == Recent Changes == [[ChangeLog(/trunk/EventBenchConsole, 3)]] == Requirements == * Java 6 * [wiki:/Software/EventBenchCore EventBenchCore] * [wiki:/Software/JavaHelperLib JavaHelperLib] == Description == A console application that uses the [wiki:Software/EventBenchCore EventBenchCore]. It provides two translation layers: 1. Windows MFC applications logged with the [wiki:Software/userlog MFCUsageMonitor] and for replaying with [wiki:Software/MFCReplay MFCReplay] 2. PHP based web applications logged with [wiki:Software/PHPMonitor PHPMonitor] and replaying with [http://curl.haxx.se/ curl] == 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 == This list is outdated and needs to be updated! * {{{calcCoverage [sequenceNames] }}} - Calculates the coverage criteria. - Examples: - {{{calcCoverage markovModel trainingSequences [generatedSequences_1 generatedSequences_2] 2 3}}} * {{{calcEntropy }}} - Calculates the entropy of a first-order Markov model. - Examples: - {{{calcEntropy markovModel}}} * {{{deleteObject }}} - Deletes an object from the storage. - Examples: - {{{deleteObject markovModel}}} - {{{deleteObject sequences}}} * {{{generateFixedLengthSequences {} {}}}} - Generates sequences of a predefined length. This command first generates all possible sequences of the defined lengths. In case {{{}}} is {{{true}}}, all generated sequences are then stored. In case {{{}}} is false {{{}}} sequences will be randomly drawn from all the sequences, based on their probability according to {{{}}}. The default value for {{{}}} is true. - Examples: - {{{generateFixedLengthSequences markovModel generatedSequences 3 5}}} - {{{generateFixedLengthSequences markovModel generatedSequences 3 5 true}}} - {{{generateFixedLengthSequences markovModel generatedSequences 3 5 false 1000}}} * {{{generateRandomReplay {}}}} - Generates a randomly generated replay from a previously learned usage model. The default number of sessions generate is 1. With this command, is it not possible to configure the length of the generated sequences. - Examples: - {{{generateRandomReplay markovModel replay.xml}}} - {{{generateRandomReplay markovModel replay.xml 5}}} * {{{generateRandomSequenecs {}}}} - Generates sequences of a predefined length. This command randomly generates sequences from the usage profile. In case the length of a generated session has the desired length, it is added to the set of sequences. The maximum number of randomly generated sequences is defined by {{{}}}, which is by default {{{}}}*10. * {{{generateReplayfile }}} - Generates a replay file from a set of sequences. - Examples: - {{{generateReplayfile d:/data/replay.xml sequences}}} * {{{listStates {}}}} - Lists all states of a stochastic process. If {{{}}} is true, the states will be sorted alphabetically. - Examples: - {{{listStates markovModel}}} - {{{listStates markovModel true}}} * {{{load }}} - Loads a data container from a file. All currently stored data is discarded. - Examples: - {{{load d:/data.dat}}} * {{{loadObject }}} - Loads an object from a file to the storage. - Examples: - {{{loadObject d:/markovModel.obj markovModel}}} * {{{modelSize }}} - Prints information about the size of a usage profile. - Examples: - {{{modelSize markovModel>}}} * {{{printDot }}} - Prints the [http://en.wikipedia.org/wiki/DOT_language Dot] graph representation of a model to the console. - Examples: - {{{printDot markovModel}}} * {{{printTrieDot }}} - Prints the [http://en.wikipedia.org/wiki/DOT_language Dot] graph representation of a trie used by a model to the console. - Examples: - {{{printTrieDot markovModel}}} - {{{printTrieDot predictionByPartialMatch}}} * {{{save }}} - Saves all currently stored data to a file. - Examples: - {{{save d:/data.dat}}} * {{{saveObject }}} - Saves a single object from the storage to a file. - Examples: - {{{saveObject d:/markovModel.obj markovModel}}} * {{{sequenceStatistics }}} - Prints statistics about a collection of sequences. - Examples: - {{{sequenceStatistics sequences}}} * {{{showMarkovModel {}}}} - Opens a window that displays 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}}} * {{{showSequences }}} - Opens a dialog that display a list of all sequences that are part of the current sequence set, including their sizes. The sequences can be edited using this dialog. * {{{showTimer }}} - Prints how many milliseconds elapsed since the start of the time. - Examples: - {{{showTimer timer}}} * {{{showTrie }}} - Opens a window that displays a trie underlying a stochastic process. - Examples: - {{{showTrie markovModel}}} - {{{showTrie predictionByPartialMatch}}} * {{{startTimer }}} - Starts a timer. - Examples: - {{{startTimer timer}}} * {{{trainDFA }}} - Trains a Deterministic Finite Automaton (DFA) from a collection of sequences. - Examples: - {{{trainDFA dfa trainingSequences}}} * {{{trainMarkovModel {}}}} - Trains a Markov model based from a collection of seqeuences. The default {{{}}} of the model is 1. - Examples: - {{{trainMarkovModel markovModel trainingSequences}}} - {{{trainMarkovModel markovModel trainingSequences 3}}} * {{{trainPPM {}}}} - Trains a Prediction by Partial Match (PPM) model based from a collection of sequences. The default {{{}}} is 0, i.e., random selection. - Examples: - {{{trainPPM PPMModel trainingSequences 0.01 3}}} - {{{trainPPM PPMModel trainingSequences 0.01 3 1}}} * {{{updateModel }}} - Updates a usage profile with a collection of sequences. This reinforces the model, i.e., it is not completly retrained, but the probabilities are merely updated using the new information. - Examples: - {{{updateModel markovModel newTrainingSequences}}} === Commands for handling data generated by [wiki:Software/userlog MFCUsageMonitor] === * {{{convertToXml {}}}} - Converts a logfile with prefixes created by the [wiki:Software/userlog 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 {}}}} - 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}}} * {{{parseXML {}}}} - 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}}} === Commands for handling data generated by [wiki:Software/PHPMonitor PHPMonitor] === * {{{loadWebSequences {} { } {}}}} - Parses a logfile generated by [wiki:Software/PHPMonitor PHPMonitor] and creates a collection of sequences from it. The default {{{}}} is 3600000 milliseconds, the default {{{}}} is 2, the default {{{}}} is 100. In case a {{{}}} is defined, additional collection of sequences will be defined for all users that have more sessions than this threshold, that fulfill the session length requirements. - Examples: - {{{loadWebSequences d:/websessions.log web-sequences}}} - {{{loadWebSequences d:/websessions.log web-seqeunces http://www.swe.informatik.uni-goettingen.de}}} - {{{loadWebSequences d:/websessions.log web-seqeunces http://www.swe.informatik.uni-goettingen.de 7200000 4 50}}} - {{{loadWebSequences d:/websessions.log web-seqeunces http://www.swe.informatik.uni-goettingen.de 7200000 4 50 20}}} == 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}}}: {{{ }}} Sequences of the same message occur, e.g., when scrolling: {{{ }}} 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: {{{ }}} === Checking equalities === Only matching messages by their type is insufficient. Comparisons between their parameters are also required. This can be done using {{{equals}}} nodes: {{{ }}} 1. {{{winInfoValue}}}: information about the target of the message. - {{{}}} for the class of the target - {{{}}} for the HWND - {{{}}} for the resource Id. - {{{}}} for the target of the GUI objects parent 1. {{{msgInfoValue}}}: information about the type and target of the message. - {{{}}} for the type of the message (its integer) - {{{}}} 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: {{{ }}} 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: {{{ }}} 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: {{{ value value }}} The value types are the same that can be used as terms for {{{equals}}} nodes. To generate message sequences, the {{{genMsgSeq}}} node is used: {{{ }}} 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.