C Code Optimization Tools for Linux Programmers
2.How to Check Execution time is taken for each System call in your program
I am not here to talk about How to write a c programming code ..?. But i like to give some tips about the optimization of code by using minimal tools. Nowadays a lot of tools (IDE) can be available in market for Debugging and Optimizing of code. But i am always using some simple tools for my coding Optimization. We all know that c is the basic of all language, so most of the people were not give clear attention while writing it. It causes a lot of problem while it run. Most common problem is memory leaks, memory allocation error,improper scaling of memory area,padding of structure, Lack of Accuracy in Data type Specification. Improper programming practices, unbalanced Execution Time Flow . Writing a code is always a simple task, But the optimization of that code is major problem when you are doing a program in HIL (Hardware Interface Layer). Optimization of a code can be easily done by using a bunch of tools. but Before that you should have a very good understanding of your programs, then only you can change that according to your needs. Each programmer has its-own style in there programs, me also . I am always uses Direct Memory Addressing Methods in my programs. That will helps me to solve so many problems before even optimization is done. DMA :-Its a Pointer Addressing Method which helps to scale the structured and no structured memory area especially when we are dong String Operation or Writing code for a Device driver.
I am here to tell you only
few optimization techniques which commonly uses in Optimization of C codes.
1.How to Check Memory Leaks in C Programs ...?
Tool : Valgrind
Valgrind is an excellent tools for Memory leaks checks and it can easily download from net for Linux Machine.
:~$ sudo apt-get install valgrind
:~$ valgrind <execbinary>
2.How to Check Execution time is taken for each System call in your program
Tool : Strace
Strace is a tools which helps you to know how your program execution flows internally in each system calls and even can calculate the time for each execution of your instruction in system calls.
2.gdb Debugger
GDB (GNU Debugger ) is the tool in which used widely for optimization of the code.This tool will help to check Stack of each function were using in our programs. If you have a very good knowledge in the GDB , then you don't need any other tool for optimization of the code.
No comments:
Post a Comment