As requested by Philip Guenther here is more information on how to use
this new dt provider.

After applying the diff you need to add to /etc/sysctl.conf
ddb.profile=1
kern.allowdt=1
kern.allowkmem=1

There are two way to start the tracing.
The first one is to use kgmon that will instantiate all entry probes,
gprof for reading the gmon.out files.

The second one is whith btrace. Btrace can take scripts as input to
start tracing. It follows the bpftrace language.
Here is the bpftrace man:
https://www.mankier.com/8/bpftrace

Example of a simple script that you can write.
(btrace -l for the list of available probes)

BEGIN
{
    @open_entry = 0;
    @open_ret = 0;
}

kprobe:sys_pread:entry
{
     printf("sys_open: %d\n", @open_entry);
    @open_entry = @open_entry + 1;

    //Dump all cpus used
    @[cpu] = count();

}

kprobe:sys_pread:return
{
     printf("sys_ret: %d\n", @open_entry);
    @ret_entry = @open_entry + 1;
}

Printf are done at trace time whereas maps (@[...]) are dumped when the
tracing is ended with Ctr-c.

Tom

Reply via email to