def initialize(cls): cls._maxCPUId = ParaverTrace.getMaxRealCPUId() cls._ltcpu = ParaverTrace.getLeaderThreadCPUId() cls._cpus = [CPU() for i in range(cls._maxCPUId + 1)] cls._cpus.append(VCPU()) # Leader Thread CPU cls._preHooks = [ ("nanos6:tc:task_create_enter", cls.hook_taskAdd), ("nanos6:oc:task_create_enter", cls.hook_taskAdd), ("nanos6:taskfor_init_enter", cls.hook_taskAdd), ("nanos6:external_thread_create", cls.hook_externalThreadCreate), ("nanos6:thread_create", cls.hook_threadCreate), ("nanos6:thread_resume", cls.hook_threadResume), ("nanos6:thread_resume", cls.hook_threadResume), ("nanos6:task_start", cls.hook_taskStart), ("nanos6:task_unblock", cls.hook_taskUnblock), ] cls._postHooks = [ ("nanos6:thread_suspend", cls.hook_threadSuspend), ("nanos6:task_block", cls.hook_taskBlock), ("nanos6:task_end", cls.hook_taskEnd), ]
def initialize(cls): # Load kernel tracepoint definitions file try: cls.loadKernelDefs("../nanos6_kerneldefs.json") except Exception as e: return False # Initialize hooks cls._preHooks = [("sched_switch", cls.hook_schedSwitch)] cls._postHooks = [] # Initialize syscall tracepoitns regex = re.compile('^sys\_') cls._syscalls = list(filter(regex.match, cls._defs)) regex = re.compile('^sys\_enter\_') cls._syscallEntryPoints = list(filter(regex.match, cls._syscalls)) regex = re.compile('^sys\_exit\_') cls._syscallExitPoints = list(filter(regex.match, cls._syscalls)) # Initialize CPUs maxCPUId = ParaverTrace.getMaxRealCPUId() cls._cpus = [CPU(cpuId) for cpuId in range(maxCPUId + 1)] # Initialize thread list with a fake Idle thread shared by all Cores # (all idle threads in the Linux Kernel have tid 0) cls._threads[0] = Thread(0, "Idle", 0) # Register the traced application's name to ensure that it always gets # the same perProcessExtraeId binaryName = ParaverTrace.getBinaryName() shortBinaryName = binaryName[:15] cls._processNames[shortBinaryName] = 1 cls._processNameId = 100 cls._enabled = True return cls._enabled