The Logproc logging tool
Logproc is a "remote-top" application which allows the user to
examine the CPU and memory usage of each application in a running
IP-STB. A server which accepts connections from clients (one at a
time) is run in the box.
To enable the logproc server in an IP-STB, include the
kreatv-tool-logproc IIP in the boot image config file:
kreatv-tool-logproc:[port=<port>]
If no port is specified, the default port 19998 is used.
Running the logproc client
Process logs are received by running the
logprocclient
application. The application is available in the SDK. Run
logprocclient -h to see a list of available options.
While running, the logprocclient can sort the processes in three
different ways:
- By PID: press 'p'
- By CPU usage: press 'c'
- By memory usage: press 'm'
Press 'q' to exit logprocclient.
Stored file format
The client can save all data to a file. The fields of each line is
whitespace separated, and the following fields exist (in this order):
| Col # |
Format |
Meaning |
| 1 |
YYYY/MM/DD:HH:MM:SS |
The time when the sample was generated. |
| 2 |
HH:MM:SS |
Relative time when the sample was generated, measured from
when the logprocclient was started. |
| 3 |
string |
Name of application. The client tries to collect processes
into applications, so multithreaded applications appear only
once. If several instances of an
application (single or multithreaded) is run, then several rows
with the same application name appears in the log file. |
| 4 |
integer |
Memory usage, in kB. |
| 5 |
float |
CPU usage, in %. If the application is multi threaded, then
this value is the total CPU usage of all threads. |
| 6 |
integer |
Number of threads in application. |
| 7 |
integer |
Process ID of application. If the application is multi
threaded, then the lowest PID of all threads is shown. |
System information rows look a bit different:
| Col # |
Format |
Meaning |
| 1 |
YYYY/MM/DD:HH:MM:SS |
The time when the sample was generated. |
| 2 |
HH:MM:SS |
Relative time when the sample was generated, measured from
when the logprocclient was started. |
| 3 |
System |
A constant which shows that this row shows system information,
not application information. |
| 4 |
integer |
Free system memory, in kB. |
| 5 |
float |
Total CPU usage, in % |
| 6 |
float |
Load average the last minute, in %. May be > 100% |
| 7 |
float |
Load average the last five minutes, in %. May be > 100% |
| 8 |
float |
Load average the last 15 minutes, in %. May be > 100% |
Parsing and plotting data
The
logprocplot script, which is also provided with the
SDK, can:
- Parse the output data from
logprocclient and store
data for each application in a file. This is gnuplot friendly.
- Display graphs of CPU and memory consumption.
- Store png files with graphs of CPU and memory.
Running the logprocplot script with only the log file as
argument will simply split the log file into a number of files which
can then be shown using gnuplot. The format of each row
will be as described above. The name of each file will either be
System.data for system data, or
<application>-<pid>.data for all other components /
applications.
logprocplot will try to be a bit clever and avoid parsing the
log file if it has already been parsed to the given output
directory. To force parsing the file, remove the files from the output
directory.
Run logprocplot -h for all options.
logprocplot
requires that gnuplot is installed on the client computer.
Examples
Run logprocclient, store data in /tmp/processlog.txt:
./logprocclient -f /tmp/processlog.txt 192.168.5.155 19998
Show the memory usage of the streamers and CPU usage of the system, the
infobroker and the streamers:
./logprocplot -C -m streamer -c streamer -c infobroker -p /tmp/processlog.txt
The DIY version; first split the log file, then run gnuplot. For
instance, to show a graph of X memory usage and free system memory,
measured relative to the start of the log file, do:
gnuplot> set timefmt "%H:%M:%S"
gnuplot> set xdata time
gnuplot> set autoscale x
gnuplot> set autoscale y
gnuplot> set grid
gnuplot> set ylabel "Kb"
gnuplot> plot "./logprocplot_output/X.data" using 2:4 title "X mem" with lines, "./logprocplot_output/System.data" using 2:4 title "System free" with lines
Note the columns: 2 is relative time, 4 is memory usage for normal
applications, and 4 is free system memory for the system.