Skip to content

Commit

Permalink
Short circut printk if tracing is not enabled (#4035)
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
Co-authored-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan-Jowett and Alan Jowett authored Nov 22, 2024
1 parent 48f46d0 commit 8fd066b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/execution_context/ebpf_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2321,6 +2321,11 @@ _ebpf_core_trace_printk(_In_reads_(fmt_size) const char* fmt, size_t fmt_size, i
return -1;
}

// If the provider is not enabled, don't bother with the rest.
if (!TraceLoggingProviderEnabled(ebpf_tracelog_provider, EBPF_TRACELOG_LEVEL_INFO, EBPF_TRACELOG_KEYWORD_PRINTK)) {
return 0;
}

// Make a copy of the original format string.
char* output = (char*)ebpf_allocate_with_tag(fmt_size + 1, EBPF_POOL_TAG_CORE);
if (output == NULL) {
Expand Down

0 comments on commit 8fd066b

Please sign in to comment.