Support saving the tnp recalculated file in profile testing

This commit is contained in:
bgbsww
2024-05-09 07:01:31 -04:00
committed by Chris Hennes
parent 2f9b97ce3a
commit 0095e52466
3 changed files with 11 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ SET(Test_SRCS
unittestgui.py
testmakeWireString.py
TestPythonSyntax.py
TestPerf.py
)
SET(TestData_SRCS

View File

@@ -58,6 +58,11 @@ class PerfTestCase(unittest.TestCase):
self.fileList = sys.argv[sys.argv.index("--pass") + 1 :]
else:
raise FileNotFoundError("Must provide filename parameter(s) via --pass")
if "--save" in sys.argv:
self.saveModels = True
self.fileList = sys.argv[sys.argv.index("--save") + 1 :]
else:
self.saveModels = False
if Part.Shape().ElementMapVersion == "":
self.tnp = ""
else:
@@ -91,6 +96,9 @@ class PerfTestCase(unittest.TestCase):
dumpdata = hpy().heap()
dumpdata.stat.dump(self.memfile)
self.memfile.flush()
if self.saveModels:
filenametnp = App.ActiveDocument.Name + self.tnp
App.ActiveDocument.saveAs(filenametnp)
App.closeDocument(doc.Name)
try:

View File

@@ -7,9 +7,10 @@
notnp=<Path to your first executable to profile goes here> #<dir>/bin/FreeCAD${cmd}
tnp=<Path to your second executable to profile goes here> #<dir/bin/FreeCAD${cmd}
results="results.txt" # File to append measurements to. We do not clear so xargs works on script
save="--save" # or "" Whether to save the resulting file from the tnp executable for further testing.
perf record -o "$1.perf" $notnp -t TestPerf --pass "$@"
perf record -o "$1.tnp.perf" $tnp -t TestPerf --pass "$@"
perf record -o "$1.tnp.perf" $tnp -t TestPerf --pass "$save" "$@"
# For interactive walking of the details using perf:
#perf report -i $1.perf