-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat(HIS): add AP_CG_CYCLE his metric #67
base: wip/his-metrics
Are you sure you want to change the base?
Conversation
for file in files.files: | ||
if file.endswith(".c"): |
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.
This can't be right. Since you check one file at a time, this will only detect functions that directly recurse on themselves, or maybe that recurse through some other function that is in the same source file. Also you don't considered static inline
functions that can be defined in header files.
This check is defined by HIS metrics as for checking for "Call graph recursions". Therefore, the case when one function A calls a function B defined in a different source files, that itself calls function A, must be detected.
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.
This is a good observation. However, after some testing the cflow
tool can observe the following recursions for this example https://github.com/bao-project/bao-his-tests/tree/main/src/ap_ag_cycle :
$ cflow -l -Isrc/ap_ag_cycle/inc src/ap_ag_cycle/ap_ag_cycle1.c src/ap_ag_cycle/ap_ag_cycle2.c --no-cpp
{ 0} main() <int main (void) at src/ap_ag_cycle/ap_ag_cycle1.c:65>:
{ 1} funcA() <void funcA (int val) at src/ap_ag_cycle/ap_ag_cycle1.c:10> (R):
{ 2} printf()
{ 2} funcA() <void funcA (int val) at src/ap_ag_cycle/ap_ag_cycle1.c:10> (recursive: see 2)
{ 1} funcB() <void funcB (int *val) at src/ap_ag_cycle/ap_ag_cycle1.c:29> (R):
{ 2} printf()
{ 2} funcC() <void funcC (void) at src/ap_ag_cycle/ap_ag_cycle1.c:42> (R):
{ 3} printf()
{ 3} funcD() <void funcD (void) at src/ap_ag_cycle/ap_ag_cycle1.c:47> (R):
{ 4} printf()
{ 4} funcB() <void funcB (int *val) at src/ap_ag_cycle/ap_ag_cycle1.c:29> (recursive: see 5)
{ 1} funcE() <void funcE (int *val) at src/ap_ag_cycle/ap_ag_cycle1.c:52>:
{ 2} printf()
{ 2} funcF()
The (R)
notation marks functions that recursively call themselves. However, as I see from the output that detecting the case that you described (>function A calls a function B defined in a different source files, that itself calls function A) can't be detected. I still didn't found another alternatives for a tool to this particular case. I would keep looking.
d4d12b3
to
4ed930a
Compare
2dfd24b
to
cfdca74
Compare
be420a9
to
c3679fc
Compare
c1452fe
to
4a2edbb
Compare
Signed-off-by: Afonso Santos <afomms@gmail.com>
Signed-off-by: Afonso Santos <afomms@gmail.com>
Signed-off-by: Afonso Santos <afomms@gmail.com>
Signed-off-by: Afonso Santos <afomms@gmail.com>
Signed-off-by: Afonso Santos <afomms@gmail.com>
cfdca74
to
240d0c0
Compare
This PR introduces the feature of checking if there is any recursive function on the source files.
The existence of recursive functions is forbidden on HIS metrics.
For this check is used the
cflow
tool.Checklist: