sketchucation logo sketchucation
    • Login
    šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    A script to Analyse the loading of scripts?

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 778 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JClementsJ Offline
      JClements
      last edited by

      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

      John | Illustrator | Beaverton, Oregon

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • JClementsJ Offline
          JClements
          last edited by

          Thanks, for the quick reply.

          John | Illustrator | Beaverton, Oregon

          1 Reply Last reply Reply Quote 0
          • A Offline
            azuby
            last edited by

            @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

            *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

            Bad English? PM me, correct me. :smile:**

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement