[ltt-dev] Potential lack of documentation for userspace tracing via debugfs.

Matthew Khouzam matthew.khouzam at ericsson.com
Fri Jul 9 16:43:01 EDT 2010


Hi,

I am writing a test app to benchmark Java using LTTng. I am first trying 
to familiarize myself with the interface, and wanted to use the 
"write_event" file in /mnt/debugfs/ltt as detailed in the help file.

I wrote some C test programs and I am getting some odd functionality.

<code>
#include <stdio.h>
#include <time.h>

int main(int argc, char* argv[])
{
     int i = 0;
     for( i = 0 ; i < 10000 ; i++)
     {
         system("echo \"Hello world\" >/mnt/debugfs/ltt/write_event");
         usleep(3);
     }
     return 0;
}
</code>
or

<code>
#include <stdio.h>
#include <time.h>

int main(int argc, char* argv[])
{
     int i = 0;
     for( i = 0 ; i < 10000 ; i++)
     {
         FILE *f;
         f = fopen("/mnt/debugfs/ltt/write_event", "w");
         fputs("Hello World" , f);
         fclose(f);
         usleep(3);
     }
     return 0;
}
</code>

I would basically get an event generated rarely, containing MANY 
hello_worlds.
Is there a way to force the file to flush and write immediately. That 
way the events would be in the right parts of the traces and make the 
reading much easier.

Thank You,
Matt.




More information about the lttng-dev mailing list