I'm trying to debug a program that uses STM. The ThreadScope readings is pointing out a very high CPU activity as you can see here:
So I'm trying to find out if this is happening due to a transaction that frequently aborts. The first thing that I thought was using something like this to test:
atomically $ do
someWork
...
`orElse` do
unsafeIOToSTM $ traceEventIO "transaction aborted!"
retry
But I'm not sure if this is correct or if this is the best approach to debugging in an STM scenario. Any ideas?