Skip to content

Commit

Permalink
Support saving the tnp recalculated file in profile testing
Browse files Browse the repository at this point in the history
  • Loading branch information
bgbsww authored and chennes committed May 9, 2024
1 parent 2f9b97c commit 0095e52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Mod/Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SET(Test_SRCS
unittestgui.py
testmakeWireString.py
TestPythonSyntax.py
TestPerf.py
)

SET(TestData_SRCS
Expand Down
8 changes: 8 additions & 0 deletions src/Mod/Test/TestPerf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def setUp(self):
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:
Expand Down Expand Up @@ -91,6 +96,9 @@ def testAll(self):
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:
Expand Down
3 changes: 2 additions & 1 deletion tools/profile/perftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0095e52

Please sign in to comment.