Skip to content

Commit

Permalink
Include return value in record
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Wang <[email protected]>
  • Loading branch information
wangvsa committed Jul 30, 2024
1 parent 250e3f9 commit 73fd64c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/recorder-logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef struct Record_t {
unsigned char arg_count;
char **args; // Store all arguments in array
pthread_t tid;
void* res; // return value

void* record_stack; // per-thread record stack of cascading calls
struct Record_t *prev, *next;
Expand Down
7 changes: 6 additions & 1 deletion include/recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@
record->tstart = recorder_wtime(); \
GOTCHA_SET_REAL_CALL_NOCHECK(func); \
ret res = GOTCHA_REAL_CALL(func) real_args ; \
record->tend = recorder_wtime();
record->tend = recorder_wtime(); \
record->res = NULL; \
if (sizeof(ret)) { \
record->res = malloc(sizeof(ret)); \
memcpy(record->res, &res, sizeof(ret)); \
}

// Fortran wrappers call this
// ierr is of type MPI_Fint*, set only for fortran calls
Expand Down
5 changes: 5 additions & 0 deletions lib/recorder-logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ void free_record(Record *record) {
recorder_free(record->args, sizeof(char*)*record->arg_count);
}

// we don't the return type so we use the system free()
if(record->res)
free(record->res);

record->res = NULL;
record->args = NULL;
recorder_free(record, sizeof(Record));
}
Expand Down

0 comments on commit 73fd64c

Please sign in to comment.