sharing programmer-to-programmer. please enjoy. pages are formatted for landscape tablet, laptop, or monitor.

greek, polymnia-hymnos (many praises)

daily use in production

polymnia, source code analysis

polymnia is a source code analysis, navigation, and critique tool. it collects code, function, file, project, and executable statisticsto proactively locate trouble, navigate code, and track ties between and among file, projects, and libraries.

for polymnia, function statistics are the basis of most categorization and potential trouble identification. other tools critique detailed code style. polymnia is my tool to complement that in my specific environment.

unimportant function ;)

the function to the right is a draft version of the code to produce the report below. that report is uncommon and really only used for debugging. but, its a good display of the statistics gathered in a more explainable way.

the code has been updated (polymnia —vupdate) to the database and is then reported below. no other action. all the analysis just uses the source code and what is on hand.

lots of simple printf, strcmp, a loop, some error checking, too many local variables, and ylog debugging i needed to find an error with the arguments passed to polymnia on the command line.

function location

all functions are tied to their project and source file. also, at the top, polymnia saves the function header, code beginning, and code ending line. i use this information in my development environment to quickly move to any function by assigned “hints”.

summary

statistics are grouped into complexity, integration, and watch-points. there is some overlap and a few duplicates to help.

the 60-ish statistics are then put into a block as shown on line 6. this is placed in the function comments for reference.

seaching and filtering

using polymnia, i can easily find all…

  • dynamic memory management

  • overly long functions

  • use of recursion

  • uses of double pointers in args (potential misuse)

  • linux system access points

  • etc.

all these statistics can be imported to gyges (spreadsheet) for easy filtering and analysis

the complexity stats say…

this is a global function, returns a char, and takes zero arguments (void). no numeric or double pointer arguments.

its about a page long (D in hex is 13 * 5 lines), 10% debugging, and 70% source lines of code

has 2 references to global vars, 11 choices (if’s), one loop, and 1 additional indentation level

one success return and three error returns, no dynamic memory management is used.

the integration stats say…

it is only called once, and that is by a local function (in the same file). no recursion.

calls 8 debugging, 4 global. and 13 c-standard library functions.

no stdin, but the printf’s use stdout. no system or specialty calls.

the watch-point stats say…

uses long-style debugging only, DEBUG_PROG only, the debugging warning is that it is missing a ylog_exit

two of my custom define macros are used, LEN_LABEL and LEN_DESC

no potential function, variable, or define macro masking was found

no unit testing found for this function

cross-file view

polymnia stores these statistics for my 8,800+ functions, plus much more, in a shared binary database on a normal disk. it loads in under a second.

i did this to remove nearly all costs to any incremental analysis, search, query, or report so i could experiment with reckless abandon ;)) my problem now is only finding better-and-better questions, and learning from mistakes.

below is a multi-use report that gets run hundreds of time a day. zero cost means high innovation. here you can see all the functions for a particular file (polymnia_func.c) and their statistics. my development environment also reads this report in real-time.

source code is GPL3 licensed, https://github.com/heatherlyrobert/polymnia

Previous
Previous

guided paced activities with penelope-ypomoni (prd)

Next
Next

reverse-polish notation with terpsikhore-seirenes (prd)