Skip to content
Snippets Groups Projects
Commit bb2cf105 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Use relative tics from the start of time so we can compare MPI ranks

Probablyh not perfect, but better than nothing
parent 44a25c71
No related branches found
No related tags found
1 merge request!757Memory allocations logger
...@@ -65,8 +65,8 @@ struct memuse_log_entry { ...@@ -65,8 +65,8 @@ struct memuse_log_entry {
/* Address of memory. */ /* Address of memory. */
void *ptr; void *ptr;
/* Time of this action. */ /* Relative time of this action. */
ticks tic; ticks dtic;
/* Label associated with the memory. */ /* Label associated with the memory. */
char label[MEMUSE_MAXLAB + 1]; char label[MEMUSE_MAXLAB + 1];
...@@ -140,7 +140,7 @@ void memuse_log_allocation(const char *label, void *ptr, int allocated, ...@@ -140,7 +140,7 @@ void memuse_log_allocation(const char *label, void *ptr, int allocated,
memuse_log[ind].ptr = ptr; memuse_log[ind].ptr = ptr;
strncpy(memuse_log[ind].label, label, MEMUSE_MAXLAB); strncpy(memuse_log[ind].label, label, MEMUSE_MAXLAB);
memuse_log[ind].label[MEMUSE_MAXLAB] = '\0'; memuse_log[ind].label[MEMUSE_MAXLAB] = '\0';
memuse_log[ind].tic = getticks(); memuse_log[ind].dtic = getticks() - clocks_start_ticks;
atomic_inc(&memuse_log_done); atomic_inc(&memuse_log_done);
} }
...@@ -162,10 +162,10 @@ void memuse_log_dump(const char *filename) { ...@@ -162,10 +162,10 @@ void memuse_log_dump(const char *filename) {
/* Write a header. */ /* Write a header. */
fprintf(fd, "# Current use: %s\n", memuse_process(1)); fprintf(fd, "# Current use: %s\n", memuse_process(1));
fprintf(fd, "# cpufreq: %lld\n", clocks_get_cpufreq()); fprintf(fd, "# cpufreq: %lld\n", clocks_get_cpufreq());
fprintf(fd, "# tic adr rank step allocated label size\n"); fprintf(fd, "# dtic adr rank step allocated label size\n");
for (size_t k = 0; k < memuse_log_count; k++) { for (size_t k = 0; k < memuse_log_count; k++) {
fprintf(fd, "%lld %p %d %d %d %s %zd\n", memuse_log[k].tic, fprintf(fd, "%lld %p %d %d %d %s %zd\n", memuse_log[k].dtic,
memuse_log[k].ptr, memuse_log[k].rank, memuse_log[k].step, memuse_log[k].ptr, memuse_log[k].rank, memuse_log[k].step,
memuse_log[k].allocated, memuse_log[k].label, memuse_log[k].size); memuse_log[k].allocated, memuse_log[k].label, memuse_log[k].size);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment