Log error instead of DCHECK in absence of high resolution ticks clock.

Turns out this path is used in the wild for logs and counters.

We may eventually want to split TimedHistograms based on low resolution
clocks to avoid polluting metrics but for now just make it a warning
to raise awereness when debugging in such an environment.

R=hpayer@chromium.org

Bug: chromium:809016
Change-Id: I5f2dd511d5fce730256979d58212468f08a2d680
Reviewed-on: https://chromium-review.googlesource.com/904045
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51130}
This commit is contained in:
Gabriel Charette 2018-02-06 12:09:24 +01:00 committed by Commit Bot
parent 5eca0acc0a
commit f7758dfa02

View File

@ -459,7 +459,16 @@ struct timeval Time::ToTimeval() const {
// static
TimeTicks TimeTicks::HighResolutionNow() {
DCHECK(TimeTicks::IsHighResolution());
static bool verified_high_resolution_available = false;
if (!verified_high_resolution_available) {
if (!TimeTicks::IsHighResolution()) {
OS::PrintError(
"\n\n"
"WARNING: High-resolution TimeTicks are not available on this system."
"\n\n");
}
verified_high_resolution_available = true;
}
return TimeTicks::Now();
}