0

I have a school assignment that is marked according to the number of instructions executed in the code. I want to do a count before handing in the assignment. I want to know if there is a function or code that can help me count the number of instructions executed.

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
  • 1
    a single line can have 1 or more instructions. For example, a function is a single line and execute more than one instruction. So I want to count the number of instructions instead of the number of lines. – edmund chee Jan 23 '20 at 10:35
  • 2
    maybe try asking your teacher how he/she will determine the number of instructions? – bretauv Jan 23 '20 at 10:41
  • 3
    Please, define "instruction". For instance `findInterval(runif(100,1,10),1:10)` how many instructions are? – nicola Jan 23 '20 at 10:42
  • [How do I determine the number of x86 machine instructions executed in a C program?](https://stackoverflow.com/q/54355631) doesn't need source; you can run `perf stat R my_script` or something like that to find out how many CPU machine-code / assembly instructions total are executed in the R interpreter to run your program. – Peter Cordes Apr 26 '20 at 04:36

0 Answers0