New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 894714 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocking:
issue 705169



Sign in to add a comment

Figure out a nice way to implement safer enum histograms in Java

Project Member Reported by dcheng@chromium.org, Oct 12

Issue description

Awhile back, I changed the enum histograms in two ways:

1. Allow UMA_HISTOGRAM_ENUMERATION to autodeduce the boundary value from Enumerator::kMaxValue.
2. Enabled clang enforcement that kMaxValue is correctly defined.

What I didn't realize is that Java also can record histograms:

https://cs.chromium.org/chromium/src/base/android/java/src/org/chromium/base/metrics/RecordHistogram.java?rcl=fb7986d88b0b8f174020916003d6939d2d928b83&l=81

At first, I was just going to use reflection to figure out the max value, to prove such a thing is even viable. Unfortunately, since Java enums have a cost, we've chosen to just use ints with enumerated annotations (?). 

We should try to figure out something for Java, because the current Java way is not very compatible with the kMaxValue definitions in C++ now. I'm not really a Java expert, so any thoughts from Java experts would be great.
 
Blocking: 705169

Sign in to add a comment