Search notes:

Shell command: perf

$ perf list
$ perf stat ls

Counting instructions

The following simple program counts more than 280,000 instructions on my machine! The number varies with each invocation.
$ echo '
.intel_syntax noprefix

.data

string_to_print:
.ascii "Hello, World\n"

.text
.globl _start

_start:
    mov rax, 60        # syscall number for exit
    xor rdi, rdi       # exit status is in rdi, set it to 0:
    syscall            # invoke kernel
' | gcc -nostdlib -x assembler -o /tmp/small -

$ perf stat -e instructions /tmp/small

See also

/proc/sys/kernel/perf_event_paranoid
Shell commands

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/sh...', 1743445923, '3.128.192.177', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/shell/commands/perf(64): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78