Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog-entries/226.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added profiling API which was introduced in preCICE in https://github.com/precice/precice/pull/1657
5 changes: 5 additions & 0 deletions cyprecice/Participant.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ cdef extern from "precice/Participant.hpp" namespace "precice":

void writeGradientData(const string& meshName, const string& dataName, vector[int] vertices, vector[double] gradientValues)

# Experimental profiling API

void startProfilingSection(const string& eventName)

void stopLastProfilingSection()

cdef extern from "precice/Tooling.hpp" namespace "precice":
string getVersionInformation()
28 changes: 28 additions & 0 deletions cyprecice/cyprecice.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,34 @@ cdef class Participant:

return np_ids, np_coordinates.reshape((size, dimensions))

def start_profiling_section(self, event_name):
"""
Starts a profiling section with the given event name.

Parameters
----------
event_name : str
Name of the event to profile.

Examples
--------
Start a profiling section with the event name "EventOne":
>>> event_name = "EventOne"
>>> participant.start_profiling_section(event_name)
"""
self.thisptr.startProfilingSection(convert(event_name))

def stop_last_profiling_section(self):
"""
Stops the last profiling section.

Examples
--------
Stop the last profiling section:
>>> participant.stop_last_profiling_section()
"""
self.thisptr.stopLastProfilingSection()

def get_version_information ():
"""
Returns
Expand Down
9 changes: 9 additions & 0 deletions test/Participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ void Participant::writeGradientData(
}
}

void Participant::startProfilingSection(
precice::string_view sectionName)
{
}

void Participant::stopLastProfilingSection()
{
}

std::string getVersionInformation()
{
return fake_version;
Expand Down