Menu

Home

AriJuu

Description

The Tracebuffer is driver for the user process tracing. It holds a ram buffer in kernel space and provides interface for saving and reading buffer via device file.

Initialisation

can be done by initdriver.sh

mknod /dev/tracebuf c 60 0 ; create filenode
chmod 666 /dev/tracebuf ; setup permissions
insmod t_driver.ko tbuf_size=10000 ; install driver, tbus_size = size of tracebuffer in bytes

Usage

From shell
echo 'testrace' > /dev/tracebuffer ; write to buffer
cat /dev/tracebuffer ; reads buffer

From code

Add t_buffer.c and t_buffer.h into your project

include"t_buffer.h"

main()
{
T_INIT();

..your code
T_PRINT("trace single print");
T_PRINT("trace a value %d",value);
..your code

T_CLOSE();
}

normal printf formatting can be used

Configuration
undef following defines if detailed prints are not needed from t_buffer.h

TRACE_PRINT_CODELINE
TRACE_PRINT_PID