-
Notifications
You must be signed in to change notification settings - Fork 474
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
dump: Handle cycles in graphviz #1978
Open
deepseafishy
wants to merge
6
commits into
namhyung:master
Choose a base branch
from
deepseafishy:daon
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c5f0903
utils: Identify graph entry nodes to skip
deepseafishy 8d47c7f
utils: Transfer skipped node's nr_calls
deepseafishy 7e089cd
dump: Skip nodes during graphviz dump
deepseafishy 4ebd361
utils: Check NULL during recursive source search
deepseafishy 905bfa5
utils: Check NULL during nr_calls node search
deepseafishy fd235ae
utils: Check NULL during skip node determination
deepseafishy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,12 @@ static int add_graph_entry(struct uftrace_task_graph *tg, char *name, size_t nod | |
{ | ||
struct uftrace_graph_node *node = NULL; | ||
struct uftrace_graph_node *curr = tg->node; | ||
struct uftrace_graph_node *search_curr = NULL; | ||
struct uftrace_graph_node *recursive_src = NULL; | ||
struct uftrace_graph_node *add_calls_tgt = NULL; | ||
struct uftrace_fstack *fstack; | ||
static uint32_t next_id = 1; | ||
static bool skip = false; | ||
|
||
if (tg->lost) | ||
return 1; /* ignore kernel functions after LOST */ | ||
|
@@ -77,6 +81,18 @@ static int add_graph_entry(struct uftrace_task_graph *tg, char *name, size_t nod | |
if (curr == NULL || fstack == NULL) | ||
return -1; | ||
|
||
if (name) { | ||
if (curr && curr->name && curr->parent && curr->parent->name) { | ||
skip = !strcmp(name, curr->name) && !strcmp(name, curr->parent->name); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for curly brackets on a single line statement. |
||
|
||
search_curr = curr; | ||
while (search_curr && search_curr->name && !strcmp(name, search_curr->name)) { | ||
recursive_src = search_curr; | ||
search_curr = search_curr->parent; | ||
} | ||
} | ||
|
||
list_for_each_entry(node, &curr->head, list) { | ||
if (name && !strcmp(name, node->name)) | ||
break; | ||
|
@@ -91,6 +107,7 @@ static int add_graph_entry(struct uftrace_task_graph *tg, char *name, size_t nod | |
node->id = next_id++; | ||
node->addr = fstack->addr; | ||
node->name = xstrdup(name ?: "none"); | ||
node->skip = skip; | ||
INIT_LIST_HEAD(&node->head); | ||
|
||
node->parent = curr; | ||
|
@@ -128,6 +145,13 @@ static int add_graph_entry(struct uftrace_task_graph *tg, char *name, size_t nod | |
|
||
out: | ||
node->nr_calls++; | ||
if (skip && recursive_src) { | ||
list_for_each_entry(add_calls_tgt, &recursive_src->head, list) { | ||
if (name && !strcmp(name, add_calls_tgt->name)) | ||
break; | ||
} | ||
add_calls_tgt->nr_calls++; | ||
} | ||
tg->node = node; | ||
|
||
if (entry_cb) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not sure if it needs to be 'static'.