From: Jacob Lifshay Date: Fri, 19 May 2023 01:46:57 +0000 (-0700) Subject: only retrieve stack frames we need -- ~2x speed up of test_caller_fmv_fcvt X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa1577ea8052e7f1d17a49e2ddd59cc644d9db2c;p=openpower-isa.git only retrieve stack frames we need -- ~2x speed up of test_caller_fmv_fcvt --- diff --git a/src/openpower/test/common.py b/src/openpower/test/common.py index e4bded79..d6ee02b9 100644 --- a/src/openpower/test/common.py +++ b/src/openpower/test/common.py @@ -4,7 +4,7 @@ Bugreports: """ from contextlib import contextmanager -import inspect +import sys import functools import types import os @@ -125,11 +125,11 @@ class TestAccumulatorBase: initial_fpscr=None, src_loc_at=0): + c = sys._getframe(1 + src_loc_at).f_code # name of caller of this function - test_name = inspect.stack()[1 + src_loc_at][3] + test_name = c.co_name # name of file containing test case - test_file = os.path.splitext(os.path.basename( - inspect.stack()[1][1]))[0] + test_file = os.path.splitext(os.path.basename(c.co_filename))[0] tc = TestCase(prog, test_name, regs=initial_regs, sprs=initial_sprs, cr=initial_cr, msr=initial_msr,