PS7a

Home Assignments Lecture Blog Resources Discussion Group

Kronos Time Clock: Introduction to Regular Expression Parsing

In this assignment, we begin the analysis of the Kronos InTouch time clock log by using regular expressions to parse the file.

Details

Here is a summary of the whole assignment:

  1. Verify device boot up timing.
  2. Verify device startup services.
  3. Verify device software upgrades.

In this portion of the assignment, we will only be doing (1) – boot up timing.

Your job is to read in an entire InTouch log and report:

  • each startup
  • whether it completed
    • if so, how much time it required
  • whether it failed

Your output should begin with the line number of the startup message “(log.c.166) server started”, the timestamp of the startup, and either: success followed by elapsed time, or failure.

  • Success is determined by a line containing the string “oejs.AbstractConnector:Started SelectChannelConnector” that follows the startup message.
  • Failure is determined by another startup message before the success message, or end of file.

Each of these output reports should be on a single line.

The whole assignment may be viewed here: Attach:Intouch Startup Log Parsing_03.pdf

Here is sample code to get you started: Attach:stdin_boost.cpp
The code will read a regex from stdin, and then let you type input strings which are matched against the regex.

Notes

  • While it's possible to do the assignment without the use of regular expressions, the point of this assignment is to learn about regular expressions.
Therefore it is required that you use the C++ regular expression (regex) library.
  • This assignment must be done in the Unix environment. You may either use your own Unix installation or the one on the CS cluster at cs.uml.edu. If you have any trouble with set-up, I suggest using the CS cluster because everything is already configured.
  • The built-in regex library provided with gcc is incomplete and should not be used. Instead, we will use the Boost regex library: http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/index.html
    • To install the Boost regex library on your own machine, run this command: sudo apt-get install libboost-regex-dev
    • To use the Boost regex library in your source code, use the following:
      • header include directive #include <boost/regex.hpp>
      • convenience directive using namespace boost;
    • To link to the Boost regex library, use this compiler flag: -lboost_regex
  • The Kronos log files are large. If you are working on the CS cluster, you don't need to copy them over to your account; you may simply pipe them into your binaries as needed when you're running your code.
On the CS cluster, the files are located at: /usr/web/ecg/uploads/Comp4spr14/kronos/
If you wish to download them, you may browse them here: http://www.cs.uml.edu/ecg/uploads/Comp4spr14/kronos/

Submit

Submit the following:

  • Your source code .cpp file and any header file.
  • A Makefile for building the code. Only a Unix Makefile will be accepted—not instructions.
  • Output from running your code on each of the five InTouch log files. Your output files must be named device[1-5]_intouch.log.out.
  • A filled-out copy of the Attach:ps7a-readme.txt file.
 submit fredm 204-ps7a files

Grading Rubric

FeatureValueComment
core implementation4full & correct implementation=4 pts; nearly complete=3pts; part way=2 pts; started=1 pt
use of Boost time methods2please use them
output files included2full & correct = 2 pts; partial = 1 pt; absent = 0 pt
Makefile2Makefile included
Readme42 pts for describing regexs in readme; 2 pts for discussion
Total14