Skip to content

Commit

Permalink
[Update] - Stack Monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vvaucoul committed Jul 29, 2024
1 parent 87cc64c commit a8dea25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/srcs/stack_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: vvaucoul <vvaucoul@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/29 13:02:42 by vvaucoul #+# #+# */
/* Updated: 2024/07/29 14:15:06 by vvaucoul ### ########.fr */
/* Updated: 2024/07/29 14:31:39 by vvaucoul ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -29,8 +29,8 @@ uint32_t sm_get_stack_usage(void) {
s_top = sm_get_stack_top();
s_size = sm_get_stack_size();

for (uint32_t i = s_base; i < s_top && i < s_base + s_size; i += 4) {
uint32_t *ptr = (uint32_t *)i;
for (uint32_t i = s_base; i < s_top && i < s_base + s_size; i += sizeof(uint32_t)) {
uint32_t *ptr = (uint32_t *)(uintptr_t)i;

if (*ptr == sm_get_stack_marker()) {
break;
Expand All @@ -51,7 +51,7 @@ uint32_t sm_get_stack_usage(void) {
* @return The percentage of stack usage.
*/
uint32_t sm_get_stack_usage_percentage(void) {
uint32_t s_base, s_top, s_size, s_usage;
uint32_t s_size, s_usage;

s_size = sm_get_stack_size();
s_usage = sm_get_stack_usage();
Expand Down

0 comments on commit a8dea25

Please sign in to comment.