The current DynamoRIO client is not thread-safe because it uses global variables (e.g. stack_index) and because the counters are not thread private and not atomically updated. For these reasons, multithreaded workloads almost always cause either crashes or nonesense output from optiwise count. At the very least we should avoid crashing by e.g. only sampling the main thread to address the bug, but ideally as an enhancement we should fully support multithreaded workloads.