Can UMA log negative samples?

24 views
Skip to first unread message

Chris Mumford

unread,
Jan 18, 2017, 2:17:16 PM1/18/17
to Chromium-dev
Can UMA log negative samples? From what I can see only UMA_HISTOGRAM_SPARSE_SLOWLY can log negative values.

Scott Hess

unread,
Jan 18, 2017, 2:34:05 PM1/18/17
to Chris Mumford, Chromium-dev
On Wed, Jan 18, 2017 at 11:17 AM, Chris Mumford <cmum...@chromium.org> wrote:
> Can UMA log negative samples? From what I can see only
> UMA_HISTOGRAM_SPARSE_SLOWLY can log negative values.

Non-sparse logs to buckets in an array, and the array is pushed up (so
you should only use a dense set of small positive integers). Sparse
logs to a hash, so you can log sparse values, but best to not log
~tons of sparse values.

HistogramBase::Sample is int32_t, SampleMap uses a
std::map<Sample,Count>, so I expect things are probably safe-ish on
the client side. But I'd go looking for examples with negative values
on the UMA server before landing anything, just in case.

-scott

Alexei Svitkine

unread,
Jan 18, 2017, 2:39:03 PM1/18/17
to Scott Hess, Chris Mumford, Chromium-dev
Yeah, it's currently not supported except for sparse - which is just meant for enum-like data (e.g. error codes).

One workaround is to define a separate histogram for negative values and log the negate the values logged there.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
    http://groups.google.com/a/chromium.org/group/chromium-dev


Chris Mumford

unread,
Jan 18, 2017, 2:55:37 PM1/18/17
to Chromium-dev, sh...@chromium.org, cmum...@chromium.org
Thx Alexel

Vincent Scheib

unread,
Jan 25, 2017, 1:29:30 AM1/25/17
to cmum...@chromium.org, Chromium-dev, Scott Hess
I wondered/looked for this a bit back as well. I thought a solution would be to have code shift values into the positive integer range [0,whatever], and then in the UMA tool remap them back to the meaningful range.

So, feature request for a units annotation that maps how values are displayed?



On Wed, Jan 18, 2017 at 11:55 AM, Chris Mumford <cmum...@chromium.org> wrote:
Thx Alexel

Alexei Svitkine

unread,
Jan 25, 2017, 11:04:11 AM1/25/17
to sch...@chromium.org, Chris Mumford, Chromium-dev, Scott Hess
I think the data format should already support arbitrary bucket ranges (including negatives).

I think all that's needed is to make the base/metrics Histogram classes support it.


Reply all
Reply to author
Forward
0 new messages