Skip to content

Commit

Permalink
add stats-for-supported-archs script
Browse files Browse the repository at this point in the history
This script shows popularity of system calls on supported Linux
architectures.
  • Loading branch information
hrw committed Jul 2, 2024
1 parent 72efd89 commit 44f1b38
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/stats-for-supported-archs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/python3

import system_calls

from system_calls.architectures_in_kernel import architectures

popular_syscalls = {}

syscalls = system_calls.syscalls()

for arch in syscalls.archs():
if arch not in architectures:
del syscalls.syscalls["archs"][arch]


for syscall_name in syscalls.names():
counter = 0

for arch in syscalls.archs():
try:
syscalls.get(syscall_name, arch)
counter += 1
except system_calls.NotSupportedSystemCall:
pass

try:
popular_syscalls[counter].append(syscall_name)
except KeyError:
popular_syscalls[counter] = []
popular_syscalls[counter].append(syscall_name)

amount_of_archs = len(syscalls.archs())

for amount in range(1, amount_of_archs + 1):
try:
tmp = popular_syscalls[amount]
print(f"System calls supported on {amount} of {amount_of_archs} "
"architectures:")
for syscall in popular_syscalls[amount]:
print(f"{syscall} ", end='')
print("\n")
except KeyError:
pass

0 comments on commit 44f1b38

Please sign in to comment.