Skip to content

Commit

Permalink
Fix TypeError: milliseconds(): incompatible function arguments. (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
laugh12321 committed Jul 15, 2024
1 parent 4941654 commit 931e8b1
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions source/deploy/pybind/deploy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 29,24 @@ Image PyArray2Image(pybind11::array &pyarray) {
void BindUtils(pybind11::module &m) {
m.doc() = "Python bindings for CpuTimer and GpuTimer using Pybind11";

pybind11::class_<GpuTimer>(m, "GpuTimer")
pybind11::class_<TimerBase>(m, "TimerBase", "Base class for timers.")
.def(pybind11::init<>())
.def("start", &GpuTimer::start, "Start the GPU timer")
.def("stop", &GpuTimer::stop, "Stop the GPU timer")
.def("microseconds", &GpuTimer::microseconds, "Get the elapsed time in microseconds")
.def("milliseconds", &GpuTimer::milliseconds, "Get the elapsed time in milliseconds")
.def("seconds", &GpuTimer::seconds, "Get the elapsed time in seconds")
.def("reset", &GpuTimer::reset, "Reset the GPU timer");

pybind11::class_<CpuTimer>(m, "CpuTimer")
.def("start", &TimerBase::start, "Starts the timer.")
.def("stop", &TimerBase::stop, "Stops the timer.")
.def("microseconds", &TimerBase::microseconds, "Get the elapsed time in microseconds.")
.def("milliseconds", &TimerBase::milliseconds, "Get the elapsed time in milliseconds.")
.def("seconds", &TimerBase::seconds, "Get the elapsed time in seconds.")
.def("reset", &TimerBase::reset, "Resets the timer.");

pybind11::class_<GpuTimer, TimerBase>(m, "GpuTimer", "Class for GPU timer.")
.def(pybind11::init<>())
.def("start", &CpuTimer::start, "Start the CPU timer")
.def("stop", &CpuTimer::stop, "Stop the CPU timer")
.def("microseconds", &CpuTimer::microseconds, "Get the elapsed time in microseconds")
.def("milliseconds", &CpuTimer::milliseconds, "Get the elapsed time in milliseconds")
.def("seconds", &CpuTimer::seconds, "Get the elapsed time in seconds")
.def("reset", &CpuTimer::reset, "Reset the CPU timer");
.def("start", &GpuTimer::start, "Starts the GPU timer.")
.def("stop", &GpuTimer::stop, "Stops the GPU timer.");

pybind11::class_<CpuTimer, TimerBase>(m, "CpuTimer", "Class for CPU timer using high resolution clock.")
.def(pybind11::init<>())
.def("start", &CpuTimer::start, "Starts the CPU timer.")
.def("stop", &CpuTimer::stop, "Stops the CPU timer and calculates the elapsed time.");
}

// Bind result classes
Expand Down

0 comments on commit 931e8b1

Please sign in to comment.