Click here to Skip to main content
15,885,051 members
Articles / Programming Languages / C++
Article

Low-level-interference logging

Rate me:
Please Sign up or sign in to vote.
2.86/5 (4 votes)
1 Mar 20061 min read 39.5K   1.7K   17   4
Low-level-interference logging.

Introduction

This DLL provides the routines necessary to achieve low-level-interference run-time textual logging. For a real-time program to log events directly without affecting the execution timings is problematic. This DLL provides a buffered array, which is written to by any of the program threads. This array is output to secondary storage and optionally a screen, by a ‘dedicated’ thread, on a lower priority than the ‘real-time’ threads. The logs are made more manageable by cycling them over time, over a set number of files. Screen prints are optional, and are discontinued when flooding with messages, and continued when such surges of data are passed. File logging always continues, and may even, on occasions, have to be done from higher priority threads.

Background

In the days of multi-threaded DOS programs, the use of some library routines was restricted to the main-thread. (They would only tolerate the main-thread stack.) This DLL grew out of workarounds to this problem. When logging data from time-constrained access to peripherals, it has proved useful. Timing accuracy below 10ms in NT, W2K etc. is available by using the multi-media library WinMM.

Using the code

The Word document JPRfuncts.doc describes all the available routines. A minimum-use set of routines is:- initialization, many (TimeStampedPrints and/or Prints), and termination.

//
// The filing thread runs at the priority of the 
// thread that calls ...InitStd
//
// Screen shot is for "PGOmailServer","PGO" & 
// files appear in the running directory
//
  Jprintf_InitStd("FileName","MarkerFileExtention");
        // once only, probably on the main thread
  ...
  ...
  Jprintf_StampP("dataToBeTimeStamppedAndLogged");// many, any thread
  ...
  ...
  Jprintf_P("dataToBeLogged");// many, any thread
  ...
  ...
  Jprintf_Term();// once only, probably on the main thread

History

  • 3.5 - Note: logging directory to be Default at Init time.
  • 3.4 - Comment/logging maintenance.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United Kingdom United Kingdom
BSc (St.Andrews(1963-67))
MSCE
Systems Programmer 39+yrs
Married to first wife 35yrs & counting, four grown-up children
Religious opinions similar to MelG's
It is not the gnosis, but the praxis must be the fruit. (Aristotle)

Comments and Discussions

 
GeneralMight be useful... Pin
Hans Dietrich8-Apr-05 7:02
mentorHans Dietrich8-Apr-05 7:02 
But as other people have pointed out, I would have to dive into code to find out, since article has very few details.

One thing I look for in articles is how the code is structured. Very often, even if I can't use the component (or whatever), I find that there are useful functions, snippets of code, etc., that I can immediately reuse. Some comments about the code structure, classes, key functions, etc., would be very helpful.

Best wishes,
Hans

GeneralComments Pin
peterchen4-May-04 7:29
peterchen4-May-04 7:29 
GeneralRe: Comments Pin
Lymington4-May-04 21:21
Lymington4-May-04 21:21 
QuestionQuality? Pin
Peter Ritchie9-Mar-04 7:50
Peter Ritchie9-Mar-04 7:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.