Use thread local storage to store instruction count.