Commit e6c3edc5 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

Generate stack-checking Python script.

parent 106f87dd
......@@ -4,11 +4,41 @@
@@-- If you have no internet access you can also use (with vim) Ctrl-W-f or gf in vim to open the text doc:
@@-- $HOME/tool-inst/share/kazoo/doc/templates_concurrency_view_sub_partition.ascii
def report_partition_@_LOWER:Name_@():
mapping = {
@_Threads'Indent_@
}
@@TABLE@@
# if mapping[@_LOWER:Thread_Names_@] < computedStack:
# print("NOT GOOD")
@@END_TABLE@@
print("[-] Checking stack usage of tasks inside @_LOWER:Name_@...")
stack_usage = {}
@@IF@@ @_CPU_Platform_@ = PLATFORM_LEON_RTEMS_POSIX or @_CPU_Platform_@ = PLATFORM_AIR
elf_binary = "../binaries/@_LOWER:Name_@_leon3_rtems.exe"
@@ELSE@@
elf_binary = "../binaries/@_LOWER:Name_@"
@@END_IF@@
if not os.path.exists(elf_binary):
print("[x] Failed to locate ELF binary:", elf_binary)
print("[x] Aborting...")
sys.exit(1)
for line in os.popen("checkStackUsage.py " + elf_binary):
data = line.strip().split(':')
try:
stack_usage[data[1].strip()] = int(data[0])
except:
pass
pohic_stack_of = {
@_Threads'Indent_@
}
def check_task(task_name):
task_name_job = task_name + "_job"
print("[-] Checking", task_name_job, "...")
if task_name not in pohic_stack_of:
print("[!] WARNING: Unable to check stack usage of", task_name+"_job")
elif task_name_job not in stack_usage:
print("[!] WARNING: ", task_name_job,
" is either recursive or missing in", elf_binary)
else:
reserved_stack = pohic_stack_of[task_name]
actual_stack = stack_usage[task_name_job]
if reserved_stack < actual_stack:
print("[x] ERROR: Stack usage of", task_name, "is", actual_stack,
"which is higher than", reserved_stack)
@@TABLE@@
check_task("@_LOWER:Thread_Names_@")
@@END_TABLE@@
......@@ -5,6 +5,9 @@
@@-- $HOME/tool-inst/share/kazoo/doc/templates_concurrency_view_sub_system.ascii
#!/usr/bin/env python3
import os
import sys
# This system contains the following nodes:
# @_Node_Names_@
......@@ -18,4 +21,4 @@ def check_all():
if __name__ == '__main__':
''' Run main application '''
check_all()
check_all()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment