Skip to content

Commit

Permalink
add teca_time_py_event a class for profiling Python algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
burlen committed Dec 14, 2020
1 parent 4abf991 commit f6a0db8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/teca_py_core.i
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
profiler
***************************************************************************/
%include "teca_profiler.h"
%inline
%{
class teca_time_py_event
{
public:
// logs an event named:
// <name>
teca_time_py_event(const std::string &name) : eventname(name)
{ teca_profiler::start_event(name.c_str()); }

~teca_time_py_event()
{ teca_profiler::end_event(this->eventname.c_str()); }

private:
std::string eventname;
};
%}

/***************************************************************************
parallel_id
Expand Down

0 comments on commit f6a0db8

Please sign in to comment.