Measuring "time to compute" on a calculated field (which trigger?)
One of the best things about FileMaker is flexibility. In fact, there are a lot of times when the 'correct' answer isn't clear, and that's where additional performance data can help.
I have a simple layout with a text field A, and a calculated value B. Sometimes this calculation takes 30-45 seconds (per record) to complete. I would like to measure the time that it actually takes (down to the millisecond), so I can compare different methods and how they perform against each other. The obvious goal here is to try and optimize each field and function, and I'm testing native FileMaker Pro vs. FileMaker customer functions vs. ExecuteSQL functions.
This "timer" would ideally record a start value when the contents of field A are changed/saved, and would then record a stop value when field B has been fully populated and the cursor becomes available to the user again (the instant that the mouse cursor changes from 'wait' to 'ready'). I am open to any method that works, whether it is based on scripts, custom functions, and/or global variables.
I have successfully created a script trigger to record the start time, in milliseconds, using the function Get(CurrentTimeUTCMilliseconds). I can either store that value in a global variable, or I can write that value to a field in the same record that was being edited; either method is fine for me.
My confusion is how to determine the "finish time". I've tried to create triggers based on various field-level events, but none of them seems to be accurate (no clear way to determine when the calculated field has finished recalculation).
Has anyone else solved this problem, and if so, would you mind sharing your method here?