https://github.com/tnmurphy/gmake-experimental/tree/feature/jprint

I've added the the hash table stats for files and the string cache and so
on. At this point I think I have done almost everything that
--print-database did. There's probably something missing but most of it is
there.

One now gets stuff like this:
    "strcachestats": {
      "buffers": {
        "count": 3,
        "full": 2,
        "total_strings": 1272,
        "total_size": 23214,
        "average_size": 18
      },
  ....
      "hashtable": {
        "fill": 1272,
        "size": 8192,
        "load_percent": 16,
        "rehash": 0,
        "lookups": 17653,
        "collisions": 827,
        "collision_percent": 5
      }

I haven't got a good set of test makefiles - I'm just using make's own
makefile.  This means that some features are not getting tried out properly.

I've got a python module with classes that match the json so one can write
programs to traverse the data. I'm not happy with it yet so I haven't
included it. In theory one could use this to start doing "useful" things -
whatever your imagination comes up with.   I keep thinking along the lines
of being able to read in an old makefile and write out some new makefile
using a strategy I prefer or even converting a makefile to some alternate
build system.

Other uses could be to get at the line number and filename information to
help one index variables or targets in a large makefile - perhaps in some
editor.

The stats also might help some people to see why they're getting poor
performance - if they're using really large makefiles perhaps.

Anyhow we'll see.

Best regards,

Tim Murphy

On Fri, 24 Oct 2025 at 19:16, Tim Murphy <[email protected]> wrote:

> https://github.com/tnmurphy/gmake-experimental/tree/feature/jprint
>
> On Fri, 24 Oct 2025 at 12:30, Tim Murphy <[email protected]> wrote:
>
>>
>> What's still not done:
>> Directories are not dumped in json - this is a bit of a pain but I will
>> get to it when I'm desperate and there's absolutely nothing easy or fun
>> left to do :-).
>>
>> OK, Directories now get dumped as json like so:
>    "directories": {
>       "RCS": {
>         "status": "stat_fail"
>       },
>       "src": {
>         "status": "ok",
>         "device": 2100,
>         "inode": 32708350,
>         "files": 109,
>         "impossibilities": 3
>       },
>       "": {
>         "files": 299,
>         "impossibilities": 87,
>         "directories": 7
>       }
>     },
>
> The last one is fake. I don't like this much but it contains the stats
> about how many files and directories were found and is incorrect here
> becuase I've shortened the example.
>
> So the vpath info is next and then the string cache stats. After that I'm
> not sure there's anything left. It will then be time to write some
> utilities that can use all this stuff.
>
> Best regards,
>
> Tim Murphy
>

Reply via email to