Runtime Monitoring Agent

Designed and developed by Zoran M.Todorovic and Miodrag D.Stojadinovic.

Often while developing an application, programmer needs an information about a value of specific variable, time needed to execute a piece of code or just plain info that some function/module has been entered/exited. Most of these information can be collected using a debugger but, debugger interrupts normal program execution (critical for communication programs) and doesn't give any time related info (for example, how long does it take to execute an SQL statement or what is the time difference between sending a command and receiving a response from a device connected to a serial port). Also, once you build a release version, you lose any debugging capabilities unless they are hard-coded into the program.

Most often, programmers use dump to file as a way to collect info but it has several limitations. You cannot view info while program is running, you lose some or all data if program crashes and it's very difficult to find something in a mass of data collected in this way.

That's were Runtime Monitoring Agent (plain Agent in further text) comes in !!!

Agent is a separate, stand-alone process which uses Win32 inter process communication facilities to receive programmer defined messages coming from a client process via an Agent DLL loaded into the client process. Agent has an Explorer like user interface. One of the requirements we set for the Agent was that it can be used with programming environments other then C++ (for example, Delphi). This is the reason why the Agent is statically linked with MFC and C++ runtime library (programmer doesn't need anything else but the Agent itself to run it on a target computer). Agent DLL is a non-MFC DLL with a very small footprint. It is used for programming environments like Delphi. For convenience and for Visual C++ projects, there is also a C++ Agent LIB library which takes care of dynamically loading the Agent DLL. It is also very small and will enable a process to work even if Agent DLL is not found or Agent is not running.

Agent monitors a System -- set of executable modules which are part of a project programmer is working on. Module is either an executable file or a DLL. Within a System, programmer defines processes. Process is equivalent to a module (executable or DLL). Process can also be a part of a module if it is convenient for a programmer (for example a special worker thread). Each process contains one or more fibers. Fiber is related to one function, algorithm or any other piece of code programmer can think of. Each fiber contains one or more messages. Message is at the lowest level and contains a user defined text (usually built with a sprintf or CString in order to contain current values of program variables) and optionally a Win32 error code. It can also contain a source code file name and a line number from which a message is sent. Agent DLL automatically adds a timestamp when the message is sent.

Some of the features of the Agent are:

  • Agent can be removed from the screen and left on a taskbar.
  • Stand-alone process requires neither MFC nor C++ runtime  library DLLs.
  • Monitored session can be saved to disk and loaded later for analysis.
  • Agent can monitor complex projects containing several executables and DLLs.
  • User can select a combination of fibers to watch.
  • Within a list of messages, user can hide a selection of messages.
  • Win32 error codes are automatically expanded by Agent to their symbolic names.
  • We found Agent very useful for a variety of purposes. Some very difficult bugs (related to background worker threads, serial communications and time related problems with SQL Server) were eliminated with the help of an Agent. We are planning to add new features listed below:
  • Find a message containing line number, (sub)string or error code.
  • Automatically calculate time difference between two selected messages.
  • Automatically start the Agent when a client program starts.
  • Auto save feature.
  • Take it and try it. If you find it useful or if you have any suggestions or if you found a bug, please let us know. Agent started as a small utility to solve debugging related problems in a multithreaded communication program but it behaved so well that we redesigned a user interface and added some new features and this is the final result.

    Zip file (Agent.zip) contains the following:

  • AGENT.EXE
  • AGENT.DLL
  • Source code for an Agent.lib
  • Demo projects for an EXE and a DLL.
  • Manual in HTML format
  •  

    Download Files The zip file is 248K.



    Comments

    • Agent gets stuck after several hunderd messages

      Posted by Legacy on 02/11/2000 12:00am

      Originally posted by: Giridhar

      I am running a heavyduty MT application, which sends lot of messages to the agent , initially messages appear on the agent screen but, after few minutes agent stops getting messages.

      can anybody have a solution to this problem?

      Reply
    • Agent GUI is stuck

      Posted by Legacy on 01/05/2000 12:00am

      Originally posted by: Gal

      I've tried the agent mechanism and it is found to be very useful. However, in several occasions, where I've used heavy-weight massive server applications the agent was stucked. I need a mechanism that will log the a special file on different scenario. Can you send me in the Agent GUI code. I'll sent it back to you with the enhancement, or maybe mail me directly and we can discuss several requierd changes.
      
      

      Also, I this that it will be useful (at least in my project) to add a callback to the client, to enable the GUI to locate the possible clients when it came up (The GUI should not be always up). I've implemented such interface in COM, Currently I'm using a cmd process to trigger the clients for registration on the Agent GUI, I think that it should be part of the Agent GUI itself.

      Thanks,

      - Gal

      Reply
    Leave a Comment
    • Your email address will not be published. All fields are required.

    Top White Papers and Webcasts

    • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

    • Mobile devices, social business apps, and business analytics are converging with the Cloud to create the most substantial changes in technology since the Internet revolution. Businesses have to change the way they think and operate, and with rising budgets for technology, they need someone to provide the services that will keep them competitive in this environment. Learn more about the important technology trends you need to stay on top of to ensure your business doesn't get left behind.

    Most Popular Programming Stories

    More for Developers

    Latest Developer Headlines

    RSS Feeds