How to Use Intel’s PIN program: A super simple tutorial

If you’re reading this, you probably already know what pin is for, but basically it is used to profile programs. You can use it to answer things like how many instructions does this executable have or how many branches occur, etc. It does this in most cases by inserting counters and other code while your executable is running. So let’s get to a quick demo.

I will be demonstrating with Linux, specifically with Ubuntu, because this was a headache on Windows. Note that you might need root permission to execute some of these commands, so if they don’t work, try re-running with sudo.

(1) Download the pin program tarball
Download the tool from here, making sure that you have a compatible version of gcc. Continue reading