From fa1577ea8052e7f1d17a49e2ddd59cc644d9db2c Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 18 May 2023 18:46:57 -0700 Subject: [PATCH] only retrieve stack frames we need -- ~2x speed up of test_caller_fmv_fcvt --- src/openpower/test/common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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, -- 2.30.2