Skip to content

Commit 6cbb62a

Browse files
authored
Merge pull request #131 from NanoNabla/manual_finalize
Manual finalize and reregistering of atexit handler
2 parents 5f4ca44 + 1908616 commit 6cbb62a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/methods.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ extern "C"
1212

1313
extern const char* SCOREP_GetExperimentDirName(void);
1414

15+
extern void SCOREP_RegisterExitHandler(void);
16+
extern void SCOREP_FinalizeMeasurement(void);
17+
1518
static PyObject* enable_recording(PyObject* self, PyObject* args)
1619
{
1720
SCOREP_User_EnableRecording();
@@ -191,6 +194,18 @@ extern "C"
191194
return PyUnicode_FromString(scorepy::abspath(path).c_str());
192195
}
193196

197+
static PyObject* force_finalize(PyObject* self, PyObject* args)
198+
{
199+
SCOREP_FinalizeMeasurement();
200+
Py_RETURN_NONE;
201+
}
202+
203+
static PyObject* reregister_exit_handler(PyObject* self, PyObject* args)
204+
{
205+
SCOREP_RegisterExitHandler();
206+
Py_RETURN_NONE;
207+
}
208+
194209
static PyMethodDef ScorePMethods[] = {
195210
{ "region_begin", region_begin, METH_VARARGS, "enter a region." },
196211
{ "region_end", region_end, METH_VARARGS, "exit a region." },
@@ -206,6 +221,9 @@ extern "C"
206221
{ "get_experiment_dir_name", get_experiment_dir_name, METH_VARARGS,
207222
"Get the Score-P experiment dir." },
208223
{ "abspath", abspath, METH_VARARGS, "Estimates the absolute Path." },
224+
{ "force_finalize", force_finalize, METH_VARARGS, "triggers a finalize" },
225+
{ "reregister_exit_handler", reregister_exit_handler, METH_VARARGS,
226+
"register an new atexit handler" },
209227
{ NULL, NULL, 0, NULL } /* Sentinel */
210228
};
211229
}

0 commit comments

Comments
 (0)