A script to Analyse the loading of scripts?
-
Is there some way a script could analyse scripts as they are being loaded when SU opens to produce some "useful" statistics?
For instance: what is being loaded (the script's filename), how long each takes, and the relative time for each compared to the total time. Then display and/or print the results.
Regards, John
-
A Ruby script could easily enough report what scripts are loaded and the path each came from.
For the other stats - like how often it's run, how long it takes, etc., would require a hook of some sort, either by the script registering itself (which would require every script to be modified to do so - yuk), or some other mechanism.
Right now, the only "thing" what could easily gather this info is SketchUp itself, since SketchUp invokes the scripts and gets control when the script ends. It could gather elapsed time and processor time, and even subtract its own processor time for those calls in which Ruby called SketchUp to do stuff.
This would be good accounting info to have. I would suggest adding it as a feature request.
Todd
-
Thanks, for the quick reply.
-
@Todd
You forgot the scripts programmed as extensions. Their stub is loaded every time Sketchup starts, but the rest is loaded depending on the checkbox status in Preferences dialog. And this status can't be reached with Ruby.But it would be possible to overwrite the methods "load" and "require' to get to know which files get loaded. You only need to make sure the overwriting is in the script loaded first from Sketchup.
azuby
Advertisement