Sample Header Ad - 728x90

perf instruction count

1 vote
0 answers
248 views
so i've been playing with perf and assembly i have the following program:
.intel_syntax noprefix

.global _start
_start:
  mov cl, 2
  mov ebx, 0b101
  shr ebx, cl
  and bl, 1 
  je do_stuff

  do_stuff:
  mov eax, 1
  mov ebx, 0
  int 0x80
and when I use it with perf -e instructions:u ./shift it shows 9 instructions instead of 8, I could not find why is that. is there any way to find out which is the +1 instruction? is it just one of the program instructions but running in parallel then the cpu retires it? if thats the case how can observe how that works at a lower level? compiling with: as -msyntax=intel -mnaked-reg shift.s -o shift.o && ld shift.o -o shift /proc/sys/kernel/perf_event_paranoid set to -1
Asked by Joao Luca (11 rep)
Sep 11, 2023, 07:02 PM