When the my_var variable equals
4, the process stops the eighth time it executes the
$count function. After the process stops, TotalView reevaluates the expression. If
my_var equals 5, the process stops again after the process executes the
$count function ten more times.
The TotalView internal counter is a static variable, which means that TotalView remembers its value every time it executes the eval point. Suppose you create an eval point within a loop that executes 120 times and the eval point contains
$count 100. Also assume that the loop is within a subroutine. As expected, TotalView stops execution the 100th time the eval point executes. When you resume execution, the remaining 20 iterations occur.
The next time the subroutine executes, TotalView stops execution after 80 iterations because it will have counted the 20 iterations from the last time the subroutine executed.
There is good reason for this behavior. Suppose you have a function that is called from lots of different places from within your program. Because TotalView remembers every time a statement executes, you could, for example, stop execution every 100 times the function is called. In other words, while
$count is most often used within loops, you can use it outside of them as well.