Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
DP3
Commits
5996a526
Commit
5996a526
authored
Jun 21, 2023
by
Chiara Salvoni
Browse files
Options
Downloads
Patches
Plain Diff
AST-1282
add python bindings for showTimings()
parent
0fb26089
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1042
AST-1282 add python bindings for showTimings()
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pythondp3/pydp3.cc
+11
-0
11 additions, 0 deletions
pythondp3/pydp3.cc
pythondp3/test/integration/tMakeMainSteps.py
+14
-0
14 additions, 0 deletions
pythondp3/test/integration/tMakeMainSteps.py
with
25 additions
and
0 deletions
pythondp3/pydp3.cc
+
11
−
0
View file @
5996a526
...
...
@@ -85,6 +85,7 @@ void register_vector(py::module &m, const char *name) {
class
PublicStep
:
public
Step
{
public:
using
Step
::
info
;
using
Step
::
showTimings
;
using
Step
::
updateInfo
;
};
...
...
@@ -122,6 +123,16 @@ PYBIND11_MODULE(pydp3, m) {
"redirected to DP3's output stream. Overrides of show() should use "
"print() "
"to output a summary of the step."
)
.
def
(
"show_timings"
,
[](
const
dp3
::
steps
::
Step
&
step
,
double
elapsed_time
)
{
std
::
stringstream
ss
;
step
.
showTimings
(
ss
,
elapsed_time
);
return
ss
.
str
();
},
"Show the processing time of current step. Also provides the "
"percentage of time the current step took compared to the total "
"elapsed time given as input (in seconds)."
)
.
def
(
"__str__"
,
[](
const
dp3
::
steps
::
Step
&
step
)
{
std
::
stringstream
ss
;
...
...
This diff is collapsed.
Click to expand it.
pythondp3/test/integration/tMakeMainSteps.py
+
14
−
0
View file @
5996a526
...
...
@@ -13,6 +13,7 @@ Script can be invoked in two ways:
import
pytest
import
os
import
sys
import
time
# Append current directory to system path in order to import testconfig
sys
.
path
.
append
(
"
.
"
)
...
...
@@ -72,6 +73,19 @@ def test_make_main_steps(tmp_path):
step
.
show
()
step
=
step
.
get_next_step
()
start_time
=
time
.
time
()
while
first_step
.
process
(
dp3
.
DPBuffer
()):
print
(
"
.
"
)
first_step
.
finish
()
end_time
=
time
.
time
()
elapsed_time
=
end_time
-
start_time
# Assert that the "show_timings" function returns the expected results.
msreader
=
first_step
averager
=
first_step
.
get_next_step
()
mswriter
=
averager
.
get_next_step
()
assert
"
ms) MSReader
"
in
msreader
.
show_timings
(
elapsed_time
)
assert
"
ms) Averager
"
in
averager
.
show_timings
(
elapsed_time
)
assert
"
ms) MSWriter
"
in
mswriter
.
show_timings
(
elapsed_time
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment