Viir
(Michael Rätzel)
November 26, 2017, 8:17am
2
WindowsExplorer:
It seems the measurement is only refreshed every 3-4 seconds. Is there a way to speed up grabbing a new measurement when needed? It processes in about 250ms on my computer.
I’ve seen the Sanderling.InvalidateMeasurement() and Sanderling.WaitForMeasurement() functions, but I don’t understand their use.
Yes, you can do this with Sanderling.InvalidateMeasurement()
.
If you write a loop which just calls this function and then reads from Sanderling.MemoryMeasurement, then you will see several new measurements per second in the API Explorer.
The code would look like this:
while(true)
{
Sanderling.InvalidateMeasurement();
Host.Log(Sanderling.MemoryMeasurement.Value?.EnumerateReferencedUIElementTransitive());
}
I found a post with some more background on InvalidateMeasurement
:
The question: when should I use InvalidateMeasurement and when shouldn’t?
You should only use InvalidateMeasurement when you want to make sure that a following call to “MemoryMeasurement” or “MemoryMeasurementParsed” does not return a Measurement which has been started before your call to InvalidateMeasurement.
Not every call to one of the MemoryMeasurement properties results in a new measurement, instead a measurement which has been taken previously can be returned.
When you send an input …