[metrics] Make metrics atomic

ART metrics need to be able to be updated by multiple threads. We make
this safe by making each metric value atomic.

Note that this may be a scalability bottleneck if some metrics become
heavily contended. If that turns out to be the case, we can explore
other strategies, such as thread-local copies of contended metrics.

Bug: 170149255
Test: m test-art-host-gtest-art_libartbase_tests
Change-Id: I5857a0184e5715aa67cc551e5ee238552a374143
1 file changed