Abhinash Jain
2014-May-24 01:03 UTC
[LLVMdev] How to count the number of **LLVM** instructions executed dynamically
Hi, I wanted to count the number of "*LLVM*" instruction executed dynamically in any program. Have already tried "lli -stats -force-interpreter filename.bc", but it's not giving any information related to instruction count. lli --version output:- LLVM version 3.4svn DEBUG build with assertions. Default target: x86_64-unknown-linux-gnu Host CPU: corei7 -- View this message in context: http://llvm.1065342.n5.nabble.com/How-to-count-the-number-of-LLVM-instructions-executed-dynamically-tp68837.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
John Criswell
2014-May-24 17:23 UTC
[LLVMdev] How to count the number of **LLVM** instructions executed dynamically
Dear Abhinash, You may need to build an instrumentation pass to do this. Fortunately, such a pass should be trivial to write. 1) Your pass instruments each basic block to update a counter in a global variable with the number of instructions found in that basic block. 2) You add a call to a run-time library function at the end of the main() function of the program that prints the value in the global variable. This may not work with a program that exits from a signal handler, but you can make it more sophisticated if you need to do so (e.g., by using atexit()). Regards, John Criswell On 5/23/14, 8:03 PM, Abhinash Jain wrote:> Hi, > > I wanted to count the number of "*LLVM*" instruction executed dynamically in > any program. > > Have already tried "lli -stats -force-interpreter filename.bc", but it's not > giving any information related to instruction count. > > lli --version output:- > LLVM version 3.4svn > DEBUG build with assertions. > Default target: x86_64-unknown-linux-gnu > Host CPU: corei7 > > > > > -- > View this message in context: http://llvm.1065342.n5.nabble.com/How-to-count-the-number-of-LLVM-instructions-executed-dynamically-tp68837.html > Sent from the LLVM - Dev mailing list archive at Nabble.com. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Abhinash Jain
2014-May-25 11:22 UTC
[LLVMdev] How to count the number of **LLVM** instructions executed dynamically
Hi John, Thanks for your suggestion. I'm just curious to know whether "lli -stats" also does the same thing or not? Because I found on the internet that this command used to give dynamic instruction count as a output, along with some other details. Unfortunately, In my version of lli (version 3.4), it gives all detail except instruction counts. -- View this message in context: http://llvm.1065342.n5.nabble.com/How-to-count-the-number-of-LLVM-instructions-executed-dynamically-tp68837p68854.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Possibly Parallel Threads
- [LLVMdev] Getting the memory address of all operands on an expression
- [LLVMdev] Getting the memory address of all operands on an expression
- [LLVMdev] Name of Virtual Registers
- [LLVMdev] Getting the memory address of all operands on an expression
- [LLVMdev] Passing String to an external function in llvm