Skip to content

Commit

Permalink
Renames global symbol allocator to cpu_profile_allocator. (#717)
Browse files Browse the repository at this point in the history
This makes it easier to understand memory map and memory profile, and easier
to search to codebase for what is using the RAM.
  • Loading branch information
balazsracz authored Jul 9, 2023
1 parent 1e6534c commit b5f378b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/freertos_drivers/common/cpu_profile.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public:
/// How many times did we apply the backtrace hack to work around
/// single-entry backtraces.
unsigned singleLenHack{0};
} allocator;
} cpu_profile_allocator;

/// Linked list entry type for a call-stack backtrace.
struct trace
Expand Down Expand Up @@ -142,7 +142,7 @@ struct trace *add_new_trace(unsigned hash)
{
unsigned total_size =
sizeof(struct trace) + strace_len * sizeof(stacktrace[0]);
struct trace *t = (struct trace *)allocator.alloc(total_size);
struct trace *t = (struct trace *)cpu_profile_allocator.alloc(total_size);
if (!t)
return nullptr;
memcpy(t + 1, stacktrace, strace_len * sizeof(stacktrace[0]));
Expand Down Expand Up @@ -226,14 +226,14 @@ _Unwind_Reason_Code trace_func(struct _Unwind_Context *context, void *arg)
if (strace_len == 1 && saved_lr != _Unwind_GetGR(context, 14))
{
_Unwind_SetGR(context, 14, saved_lr);
allocator.singleLenHack++;
cpu_profile_allocator.singleLenHack++;
return _URC_NO_REASON;
}
return _URC_END_OF_STACK;
}
if (strace_len >= MAX_STRACE - 1)
{
++allocator.limitReached;
++cpu_profile_allocator.limitReached;
return _URC_END_OF_STACK;
}
// stacktrace[strace_len++] = ip;
Expand Down

0 comments on commit b5f378b

Please sign in to comment.