I went down a rabbit hole on this one and came up with a functional solution, but it was such a PITA I never ended up using it. It works tho so if anyone wants to try it out, here's some snippets and a general overview.
the general overview is:
- we make use of openscad's ability to read data from json files
- a background service regularly writes the current time to a json file, that we read and re-read multiple times
- a "time" function writes a log to the console of how long it's been since the prev time and the current time
- during the rendering of the model, before and after each thing we want to time, we call the time function
- as it's rendering, or after it's renered, just look at the console logs and you can see "this bit took 10ms", "that bit took 10s", "that bit took 5 mins" etc.
here's the util functions in my lib