-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stats-for-supported-archs script
This script shows popularity of system calls on supported Linux architectures.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |