Global references done internally by Cache
Using the method
When from a class I execute a method of another class, Cache is internally accessing globals (I suppose to get the code of the called method). I would like to not count those accesses done by Cache.
I've a method (Statistics) that counts the number of references done by another method (A). I would like to know how many of those references has been done by my class "Random" but I don't care if Cache needs to access some globals in order to be able to execute this class.
Set ref = ##class(%SYSTEM.Process).GlobalReferences()
Write "references Increment ", (##class(%SYSTEM.Process).GlobalReferences() - ref)
Set ^a = 1
Given those classes already compiled I follow the next steps:
- Compile Random class.
- Execute "Do ##class(Stats).Statistics()" -> Got "references Increment 4" -> BAD RESULT
- Execute again "Do ##class(Stats).Statistics()" -> Got "references Increment 1" -> GOOD RESULT
As you can see, in the second execution the reference count is what it's expected.