

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I profile C++ code running on Linux?
In Linux platform there are many great profiling tools for profiling C++ programs. Valgrind is one of them. It is widely used. It is a programming tool for memory debugging, memory leak detection, and profiling. We can use Valgrind by passing the binary to it and setting the tool to callgrind. First generate the binary by compiling the program
$ g++ -o abc.cpp abc
Now use valgrind to profile it
$ valgrind --tool=callgrind ./abc
This will generate a file called callgrind.out.x. You can read this file using a tool called kcachegrind.
If you're using gcc, you can use the inbuilt profiling tool, gprof. You can use it while compiling the file as follows
$ g++ -o abc abc.cpp -g -pg
- Related Questions & Answers
- How can I profile C++ code running in Linux?
- How to list running screen sessions on Linux?
- How I can install unidecode python module on Linux?
- Running GUI applications on docker in linux
- How can I stop running a MySQL query?
- How can I stop a running MySQL query?
- Executing C# code in Linux
- How to write a running C code without main()?
- How can I create directory tree using C++ in Linux?
- How to increase the scrollback buffer in a running screen session on Linux?
- How I can show progress of long running PYTHON CGI script?
- How can I add debugging code to my JavaScript?
- How to find and kill running processes in linux
- How to Install C++ Compiler on Linux?
- How can I run a Linux command using Python CGI script?
Advertisements