Select a block of code (e.g. "My SubVI.vi" in the screenshot below) and then choose "Wrap in Benchmarking Structure". The result would be to wrap the block of code in a flat sequence structure with Millisecond Timers in the first/last frames to calculate the execution time.
I needed this a couple of days ago for several things, so I already did some work.
The attached (8.6) does the core of the work (i.e. it does the wrapping and the calculation), but still needs a lot of work like cleanup, adding subVIs, documentation, moving the code which is hidden by the sequence (probably by using the Make Space method), magic numbers removal, etc. I'm currently not working on it, so anyone else who wants to can.
I think this code also demonstrates another need - we need a set of utility VIs for handling placement code (e.g. things like "take an array of refs and return the top and bottom points" or "take the desired middle point and return the desired top point based on the object's size". I'm sure some people already have code which does some of the work.
Very nice work, Yair!
Yes, I agree that there are going to be a lot of reuable utilities for handling placement code. I wonder if what you're looking for is already in Gavin Burnell's Scripting Tools library.
It doesn't seem to be in that library. I only saw a couple of places where it does its own placement code and in those places it has specific code.
Yes, that's the kind of thing I was talking about, although it would take time to generate a full list of the desired VIs.
P.S. I'm not sure, but I think I would just coerce everything (including the size) to I32. The mixing of I16, I32 and U32 in positioning code always annoyed me and this would hopefully minimize the amount of coercion (and especially data loss) we will see on calling diagrams. I'm not sure whether the better behavior with negative sizes would be to coerce them to 0 or to throw an error, but maybe we should do both and add an "Ignore Errors" input to the VIs.
I realized today that you can do this with the timed sequence, so there's no need for scripting really.
genius idea! I came online looking for a right-click option to wrap my code with a performance measurement structure, and came out with the flat timed sequence!