Architecture

Home | Architecture | Features | Documentation | Releases | FAQ | Support

The following block diagram shows that collectl is much more than a tool that reads data from /proc and writes its results into a file or on the terminal. Spending a few minutes studying this diagram may help to gain a better understanding about the different ways you might use collectl more effectively. As you can see, there are a variety of paths data can follow and the ones it takes depends on the switches you select. For clarity I have not included all possibilities.

Interactive Mode

This is the default and in this mode data is read from /proc and passes through analyze. It is really nothing more than a function that looks at the change between the current and previous values. It then divides by the duration of the interval (unless you specicify -on) and produces the rate, for those values that are indeed rate based. This function is also responsible for formatting/disposing the output. More on that in a little while.

Record Mode

Data passes from /proc the same way as Interactive Mode but instead of going through the Analyze function it written it to a file. By eliminating the calculations and formatting, this is the most efficient path the data can take and is why collectl it so light-weight when run in this way.

Playback Mode

Here collectl works virtually identical to Interactive Mode except instead of reading data from /proc it reads it from a file. This means all the switches that control data formatting still apply. There are also a couple of switches that allow you to select the time period from which you want to play back data.

Plot Format

When you select the -P switch, it directs the formatting of the data to be delimitter separated (the default is to use spaces) on a single line, starting with the date and time. Typically you also include the -f switch to name the location to write the data to. If you leave off the -f, collectl will send the data to your terminal which isn't particularly useful.

Socket

While this has not been heavily used, when you run collectl with -a and specify an address and optional port number (the default is 1234), rather than writing its output to the display or a plot file, collectl will send its data to a socket at the address specified. The assumption here is that the socket has already been opened. There is not a lot of error handling here and if the socket at the other end goes away, collectl will simply shut down.

S-Expressions

This too is rarely used, but if one specifies the --sexpr switch, which must be used in conjunction with -f, collectl will write its output in the form of s-expressions to a file named S, in the named directory along with either raw or plot data depending on whether or not -P was specified. The contents of the S file depends on the argument to --sexpr which can be rate or , which result in either rates or incrementing raw counters are reported.