Skip to content

Commit

Permalink
Remove old, unused code from ctau_impl.c
Browse files Browse the repository at this point in the history
The Python profiler had a bunch of commented-out code that has been
superceded. This cleans that up.


Former-commit-id: 490ee06614f19e00223efe0ad8d360115b9064cb
  • Loading branch information
nchaimov committed Oct 16, 2023
1 parent 5828351 commit 5740f06
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions src/Profile/ctau_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,20 +524,6 @@ static void Stop(ProfilerObject *pObj, ProfilerContext *self, ProfilerEntry *ent


static void ptrace_enter_call(PyObject *self, void *key, PyObject *userObj, PyFrameObject *frame, char *cname) {
// char *name;

// PyObject *stringObj;
// printf ("enter:\n");

// stringObj = normalizeUserObj(userObj);

/* name = PyString_AsString(((PyFrameObject*)(key))->f_code->co_name); */
// TAU_START(name);

/* if (PyArg_ParseTuple(stringObj, "|s", &name)) { */
/* printf ("got name: %s\n", name); */
/* } */

/* entering a call to the function identified by 'key'
(which can be a PyCodeObject or a PyMethodDef pointer) */
ProfilerObject *pObj = (ProfilerObject*)self;
Expand All @@ -557,50 +543,25 @@ static void ptrace_enter_call(PyObject *self, void *key, PyObject *userObj, PyFr
Tau_start_timer(profEntry->fi,0,Tau_get_thread());
}

/* /\* grab a ProfilerContext out of the free list *\/ */
/* pContext = pObj->freelistProfilerContext; */
/* if (pContext) { */
/* pObj->freelistProfilerContext = pContext->previous; */
/* } */
/* else { */
/* /\* free list exhausted, allocate a new one *\/ */
/* pContext = (ProfilerContext*) */
/* malloc(sizeof(ProfilerContext)); */
/* if (pContext == NULL) { */
/* pObj->flags |= POF_NOMEMORY; */
/* return; */
/* } */
/* } */
/* initContext(pObj, pContext, profEntry); */
}

static void ptrace_leave_call(PyObject *self, void *key) {
char *name;
/* name = PyString_AsString(((PyFrameObject*)(key))->f_code->co_name); */
// TAU_STOP(name);

//printf ("exit:\n");
/* leaving a call to the function identified by 'key' */
ProfilerObject *pObj = (ProfilerObject*)self;
ProfilerEntry *profEntry;
ProfilerContext *pContext;

/* pContext = pObj->currentProfilerContext; */
/* if (pContext == NULL) */
/* return; */
profEntry = getEntry(pObj, key);
if (profEntry) {
if (profEntry->fi) {
Tau_stop_timer(profEntry->fi, Tau_get_thread());
}
}
else {
printf ("Error in Python later!\n");
/* pObj->currentProfilerContext = pContext->previous; */
printf ("Error in TAU Python profiler: tried to stop timer but timer not found in ptrace_leave_call!\n");
}
/* /\* put pContext into the free list *\/ */
/* pContext->previous = pObj->freelistProfilerContext; */
/* pObj->freelistProfilerContext = pContext; */
}


Expand All @@ -616,19 +577,6 @@ static int profiler_callback(PyObject *self, PyFrameObject *frame, int what, PyO
init = 1;
}

/* char routine[4096]; */
/* char *co_name, *co_filename; */
/* int co_firstlineno; */


/* co_name = PyString_AsString(frame->f_code->co_name); */
/* co_filename = PyString_AsString(frame->f_code->co_filename); */
/* while (strchr(co_filename,'/')) { */
/* co_filename = strchr(co_filename,'/')+1; */
/* } */
/* co_firstlineno =frame->f_code->co_firstlineno; */
/* sprintf (routine,"%s [{%s}{%d}]", co_name, co_filename, co_firstlineno); */

switch (what) {

/* the 'frame' of a called function is about to start its execution */
Expand Down

0 comments on commit 5740f06

Please sign in to comment.