-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Trace deadline violations #457
Conversation
WalkthroughThe changes add tracing points in various files to enhance monitoring of reactions within the system. Specifically, Changes
Sequence Diagram(s)sequenceDiagram
participant Environment
participant Reaction
participant Monitor
Environment->>+Reaction: Invoke deadline violation handler
Reaction->>+Monitor: tracepoint_reaction_starts(reaction, deadline)
Reaction-->>-Monitor: tracepoint_reaction_ends(reaction, deadline)
Reaction-->>-Environment: Return from handler
sequenceDiagram
participant ScheduleFunc as schedule_output_reactions
participant Monitor
ScheduleFunc->>+Monitor: tracepoint_reaction_starts(downstream_to_execute_now, deadline)
ScheduleFunc-->>-Monitor: tracepoint_reaction_ends(downstream_to_execute_now, deadline)
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, but why does this remove the lf_check_deadline
API function? This doesn't seem backwards compatible, or is it?
Ah, I forgot that this was a user-facing API and mistook it for dead code. I'll fix that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Should we get this merged?
OK. I don't think it strictly needs to be merged, but I think that merging it probably will not break things for anyone (unless they are depending on very specific properties of the tracing output) and will make observability a little simpler to maintain. Let's merge this if we can easily do so. If/when we merge this, I would recommend doing a squash to keep the version history clean. This branch was a little messy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- core/reactor.c (1 hunks)
- core/reactor_common.c (2 hunks)
- core/threaded/reactor_threaded.c (2 hunks)
- include/core/tracepoint.h (2 hunks)
Additional comments not posted (5)
core/reactor.c (1)
167-175
: Ensure consistent usage of tracepoints.The tracepoints
tracepoint_reaction_starts
andtracepoint_reaction_ends
are correctly placed around the deadline violation handler. Ensure that similar tracepoints are used consistently in other parts of the code where reactions are invoked.Verification successful
Tracepoints are used consistently around reaction handlers.
The tracepoints
tracepoint_reaction_starts
andtracepoint_reaction_ends
are consistently placed around reaction handlers incore/reactor.c
,core/reactor_common.c
, andcore/threaded/reactor_threaded.c
.
core/reactor.c
core/reactor_common.c
core/threaded/reactor_threaded.c
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the consistent usage of tracepoints in the codebase. # Test: Search for the usage of tracepoint_reaction_starts and tracepoint_reaction_ends. rg --type c $'tracepoint_reaction_starts' rg --type c $'tracepoint_reaction_ends'Length of output: 1337
Script:
#!/bin/bash # Extract surrounding lines of the tracepoint usage in core/reactor.c rg --type c -A 3 -B 3 'tracepoint_reaction_starts' core/reactor.c rg --type c -A 3 -B 3 'tracepoint_reaction_ends' core/reactor.c # Extract surrounding lines of the tracepoint usage in core/reactor_common.c rg --type c -A 3 -B 3 'tracepoint_reaction_starts' core/reactor_common.c rg --type c -A 3 -B 3 'tracepoint_reaction_ends' core/reactor_common.c # Extract surrounding lines of the tracepoint usage in core/threaded/reactor_threaded.c rg --type c -A 3 -B 3 'tracepoint_reaction_starts' core/threaded/reactor_threaded.c rg --type c -A 3 -B 3 'tracepoint_reaction_ends' core/threaded/reactor_threaded.cLength of output: 2811
include/core/tracepoint.h (1)
116-117
: Verify the correctness of the added parameter.The
reaction->deadline
parameter has been added to thetracepoint_reaction_ends
macro. Ensure that this parameter is correctly used in thecall_tracepoint
function.Verification successful
The added parameter
reaction->deadline
is correctly passed and used in thecall_tracepoint
function.The
reaction->deadline
parameter in thetracepoint_reaction_ends
macro corresponds to theextra_delay
parameter in thecall_tracepoint
function, which is correctly used to set theextra_delay
field in the trace record.
call_tracepoint
function incore/tracepoint.c
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the added parameter in the call_tracepoint function. # Test: Search for the call_tracepoint function definition and verify the usage of the reaction->deadline parameter. rg --type c $'void call_tracepoint'Length of output: 278
Script:
#!/bin/bash # Description: Verify the usage of the reaction->deadline parameter in the call_tracepoint function implementation. # Search for the implementation of the call_tracepoint function and display its content. rg --type c --context 10 'void call_tracepoint' core/tracepoint.cLength of output: 865
Script:
#!/bin/bash # Description: Retrieve the complete implementation of the call_tracepoint function to verify the usage of the extra_delay parameter. # Get the complete implementation of the call_tracepoint function. rg --type c --context 50 'void call_tracepoint' core/tracepoint.cLength of output: 4436
core/reactor_common.c (1)
Line range hint
827-836
: Ensure consistent usage of tracepoints.The tracepoints
tracepoint_reaction_starts
andtracepoint_reaction_ends
are correctly placed around the deadline violation handler. Ensure that similar tracepoints are used consistently in other parts of the code where reactions are invoked.Verification successful
The tracepoints
tracepoint_reaction_starts
andtracepoint_reaction_ends
are used in multiple files, which suggests an effort to maintain consistency. The next step is to verify that these tracepoints are correctly placed around reaction invocations in each of these files.
Tracepoints are used consistently and correctly.
The tracepoints
tracepoint_reaction_starts
andtracepoint_reaction_ends
are consistently placed around reaction invocations and deadline violation handlers in the filescore/reactor.c
,core/reactor_common.c
, andcore/threaded/reactor_threaded.c
.
core/reactor.c
: Lines around tracepoints are consistent with reaction invocations.core/reactor_common.c
: Lines around tracepoints are consistent with reaction invocations.core/threaded/reactor_threaded.c
: Lines around tracepoints are consistent with reaction invocations.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the consistent usage of tracepoints in the codebase. # Test: Search for the usage of tracepoint_reaction_starts and tracepoint_reaction_ends. rg --type c $'tracepoint_reaction_starts' rg --type c $'tracepoint_reaction_ends'Length of output: 1337
Script:
#!/bin/bash # Description: Verify the placement of tracepoints around reaction invocations. # Extract lines around tracepoint_reaction_starts and tracepoint_reaction_ends in core/reactor.c rg --type c -A 5 -B 5 'tracepoint_reaction_starts' core/reactor.c rg --type c -A 5 -B 5 'tracepoint_reaction_ends' core/reactor.c # Extract lines around tracepoint_reaction_starts and tracepoint_reaction_ends in core/reactor_common.c rg --type c -A 5 -B 5 'tracepoint_reaction_starts' core/reactor_common.c rg --type c -A 5 -B 5 'tracepoint_reaction_ends' core/reactor_common.c # Extract lines around tracepoint_reaction_starts and tracepoint_reaction_ends in core/threaded/reactor_threaded.c rg --type c -A 5 -B 5 'tracepoint_reaction_starts' core/threaded/reactor_threaded.c rg --type c -A 5 -B 5 'tracepoint_reaction_ends' core/threaded/reactor_threaded.cLength of output: 4261
core/threaded/reactor_threaded.c (2)
732-732
: Add a newline before the tracepoint for better readability.Adding a newline before the tracepoint improves readability and separates the logical blocks of code.
+ tracepoint_reaction_starts(env, reaction, worker_number);
Line range hint
732-743
: Ensure tracepoints are correctly placed around the deadline violation handler.The tracepoints should accurately mark the start and end of the deadline violation handler execution. Verify that these tracepoints are correctly placed and that the
reaction->deadline_violation_handler
is correctly invoked between them.
call_tracepoint(reaction_starts, reaction->self, env->current_tag, worker, worker, reaction->number, NULL, NULL, \ | ||
reaction->deadline) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Discrepancy in tracepoint_reaction_starts
macro
The reaction->deadline
parameter has been added to the tracepoint_reaction_starts
macro, but it is not used in the call_tracepoint
function. This discrepancy could lead to potential issues or unused parameters.
tracepoint_reaction_starts
macro includesreaction->deadline
.call_tracepoint
function signature does not include a corresponding parameter forreaction->deadline
.
Please ensure that the reaction->deadline
parameter is correctly integrated into the call_tracepoint
function or remove it from the macro if it is unnecessary.
Analysis chain
Verify the correctness of the added parameter.
The reaction->deadline
parameter has been added to the tracepoint_reaction_starts
macro. Ensure that this parameter is correctly used in the call_tracepoint
function.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the correctness of the added parameter in the call_tracepoint function.
# Test: Search for the call_tracepoint function definition and verify the usage of the reaction->deadline parameter.
rg --type c $'void call_tracepoint'
Length of output: 278
Script:
#!/bin/bash
# Extract the full definition of the call_tracepoint function from both files.
ast-grep --lang c --pattern $'void call_tracepoint($_, $_, $_, $_, $_, $_, $$$) { $$$ }' --json
Length of output: 99
Script:
#!/bin/bash
# Extract the lines surrounding the call_tracepoint function definition to inspect its parameters and body.
rg --context 10 'void call_tracepoint' include/core/tracepoint.h core/tracepoint.c
Length of output: 3131
* Record reaction start/end when calling violation handler * Update tracepoint macro * Do not delete check_deadline API function * Format --------- Co-authored-by: Christian Menard <Christian.Menard@tu-dresden.de>
This allows deadline violations to be traced using a format that is similar to regular reaction executions. I am not sure if we want to mainline it, but we could do so backwards-compatibly.
This branch is based on
initialize-master-thread-id-windows
, which would need to be merged first.Summary by CodeRabbit
New Features
Improvements