Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: yield periodically while dumping logs #2411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sys/log/full/src/log_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include "tinycbor/compilersupport_p.h"
#include "log_cbor_reader/log_cbor_reader.h"

/* Global counter to yield so that watchdog is serviced in idle task */
int g_log_dump_count;

static int
shell_log_dump_entry(struct log *log, struct log_offset *log_offset,
const struct log_entry_hdr *ueh, const void *dptr, uint16_t len)
Expand Down Expand Up @@ -93,6 +96,11 @@ shell_log_dump_entry(struct log *log, struct log_offset *log_offset,
}

console_write("\n", 1);
if ((++g_log_dump_count) == 100) {
g_log_dump_count = 0;
/* Sleep for 5 ticks, to yield */
os_time_delay(5);
}
return 0;
}

Expand Down