How to record and replay Linux terminal commands ?

If you want to capture something like commands when you are installing some software, compiling some opensource codes or just want to see debug logs printed on the terminal by some program, there is command “script” which does all the work very efficiently for us. Just open a terminal, and type below command before you … Read more

Using electric fence for debugging memory leaks in Linux

Electric Fence helps you detect two common programming bugs: software that overruns the boundaries of a malloc() memory allocation, and software that touches a memory allocation that has been released by free(). Unlike other malloc() debuggers, Electric Fence will detect read accesses as well as writes, and it will pinpoint the exact instruction that causes an error. Create … Read more

How to use Valgrind to find memory leaks ?

Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools. We will need to install valgrind for ubuntu, Create a test program which has some memory … Read more

How to measure Network Throughput using iperf ?

iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, buffers and protocols (TCP, UDP, SCTP with IPv4 and IPv6). For each test it reports the bandwidth, loss, and other parameters.  In this post, we will demo the steps required for … Read more

Understanding /proc/meminfo – Analysing Linux memory utilisation

/proc/meminfo Provides valuable information about the system’s RAM usage. (utilization of run time memory).  This varies by architecture and compile options.  The following is from a 4GB RAM, 64bit Ubuntu Desktop MemTotal: Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code) MemTotal is the sum of HighTotal and … Read more

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 – and Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google … Read more

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