Skip to content

Commit

Permalink
Return duration instead of scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
schnellerhase committed Oct 23, 2024
1 parent 739846f commit 9b6301c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cpp/dolfinx/common/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class Timer
/// Stop timer, return wall time elapsed and store timing data into
/// logger
template <typename unit = std::chrono::nanoseconds>
double stop()
unit stop()
{
auto end_time = chrono_timer::now();
auto elapsed = unit(end_time - _start_time).count();
auto elapsed = unit(end_time - _start_time);
// TODO: reactivate
// if (_task.has_value())
// TimeLogManager::logger().register_timing(_task.value(), wall, user,
Expand Down
3 changes: 2 additions & 1 deletion python/dolfinx/wrappers/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>
#include <nanobind/stl/array.h>
#include <nanobind/stl/chrono.h>
#include <nanobind/stl/optional.h>
#include <nanobind/stl/pair.h>
#include <nanobind/stl/string.h>
Expand Down Expand Up @@ -167,7 +168,7 @@ void common(nb::module_& m)
nb::class_<dolfinx::common::Timer<>>(m, "Timer", "Timer class")
.def(nb::init<std::optional<std::string>>(), nb::arg("task").none())
.def("start", &dolfinx::common::Timer<>::start, "Start timer")
.def("stop", &dolfinx::common::Timer<>::stop, "Stop timer");
.def("stop", &dolfinx::common::Timer<>::stop<>, "Stop timer");

// dolfinx::common::Timer enum
nb::enum_<dolfinx::TimingType>(m, "TimingType")
Expand Down

0 comments on commit 9b6301c

Please sign in to comment.