How to install perf in Ubuntu Linux ?

Perf is a profiler tool for Linux 2.6+ based systems that abstracts away CPU hardware differences in Linux performance measurements and presents a simple commandline interface. The documentation for perf inside kernel is available at “linux_kernel_src/tools/perf/Documentation” References – https://perf.wiki.kernel.org/index.php/Tutorialhttp://www.brendangregg.com/perf.html and http://www.brendangregg.com/linuxperf.html

Understanding execution and debugging of C program using ltrace

As we seen in previous post “Understanding Very Minimal C Program and its execution in Ubuntu Linux” , we tried to understand the basic minimum C program. Here we will try to understand, how its actually getting executed, when we tried to run this program with debugging tool ltrace as below, ltrace is a “A … Read more

C program to interact with frame buffer devices

Screen information are queried by applications using the FBIOGET_FSCREENINFO and FBIOGET_VSCREENINFO ioctls. Those ioctls take a pointer to a fb_fix_screeninfo and fb_var_screeninfo structure respectively. struct fb_fix_screeninfo stores device independent unchangeable information about the frame buffer device and the current format. Those information can’t be directly modified by applications, but can be changed by the driver … Read more

Linux test case for framebuffer driver

Screen information are queried by applications using the FBIOGET_FSCREENINFO and FBIOGET_VSCREENINFO ioctls. Those ioctls take a pointer to a fb_fix_screeninfo and fb_var_screeninfo structure respectively. struct fb_fix_screeninfo stores device independent unchangeable information about the frame buffer device and the current format. Those information can’t be directly modified by applications, but can be changed by the driver … Read more

C program to read information from sysfs file in Linux

In this post, we will write a simple C program which can read any sysfs file from Linux and display the output to console. Above makefile is using GCC so it can be compiled for Desktop / Laptop but if you want to cross compile for some embedded target like ARM boards, you can export … Read more

Debugging using C macros __FILE__ and __func__ and __LINE__

Following program shows a sample example of how we can use C macros __FILE__ , __func__ and __LINE__ to print the debug information which will show us, where is execution reached to, if any error it can print the line number of error and if in case of multi file programs like library, it can … Read more

Network throughput measurement using netperf

Netperf is a benchmark that can be used to measure various aspects of networking performance. Its primary focus is on bulk data transfer and request/response performance using either TCP or UDP and the Berkeley Sockets interface. There are optional tests available to measure the performance of DLPI, Unix Domain Sockets, the Fore ATM API and … Read more

Debug levels for Linux kernel PrintK

If you have already tried to write the first kernel module from port “Writing first Linux kernel Module and understanding Kernel module compilation, loading and unloading” , you might have seen that in Linux kernel we used “printk” whereas we use “printf” into the application programs. Application printf example, Whereas, same code if we want … Read more