Closed Bug 1442746 Opened 7 years ago Closed 7 years ago

Use clock_gettime on BSDs too in Telemetry ?

Categories

(Toolkit :: Telemetry, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox-esr52 --- unaffected
firefox58 --- unaffected
firefox59 --- unaffected
firefox60 --- fixed

People

(Reporter: gaston, Assigned: gaston)

References

Details

(Keywords: regression)

Attachments

(2 files, 2 obsolete files)

Since 9 days m-c fails to build on OpenBSD (with ldd, & disable-webkit) for: error: undefined symbol: std::__1::chrono::system_clock::now() 145:56.71 >>> referenced by Telemetry.cpp:1656 (/build/buildslave-amd64/mozilla-central-amd64/build/toolkit/components/telemetry/Telemetry.cpp:1656) 145:56.71 >>> ../components/telemetry/Telemetry.o:((anonymous namespace)::TelemetryImpl::MsSystemNow(double*)) This code was added in bug 1352961 a long while ago but was only built/enabled recently, as 994a684a7564c2735d98d6910a78d079a68f0b25 was green (cf http://buildbot.rhaalovely.net/nine/#/builders/3/builds/51) but turned red with 169b1ba48437d5ddc0a4a1828177770b598f7c05 (cf http://buildbot.rhaalovely.net/nine/#/builders/3/builds/52) My wild guess would be using the clock_gettime #ifdef on BSDs too would fix it. Will try that locally.
Jan, rings a bell ?
Wouldnt it make more sense to use clock_gettime() ?
Attached patch use clock gettime on unix (obsolete) — Splinter Review
My take would be to replace XP_LINUX by XP_UNIX, works fine here.
Assignee: nobody → landry
Attachment #8955900 - Flags: review?(chutten)
Comment on attachment 8955900 [details] [diff] [review] use clock gettime on unix Did OS X finally implement clock_gettime()? I mean, it's in POSIX and OS X is a certified UNIX... http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
(In reply to Landry Breuil (:gaston) from comment #3) > Wouldnt it make more sense to use clock_gettime() ? No. According to bug 1352961 comment 24 it's only an issue for --enable-stdcxx-compat. I'm more puzzled why msSystemNow isn't steady_clock or CLOCK_MONOTONIC. Existing consumers mainly measure delay but clock drifts, DST changes, etc. will add noise to the data.
(In reply to Jan Beich from comment #6) > (In reply to Landry Breuil (:gaston) from comment #3) > > Wouldnt it make more sense to use clock_gettime() ? > > No. According to bug 1352961 comment 24 it's only an issue for > --enable-stdcxx-compat. > > I'm more puzzled why msSystemNow isn't steady_clock or CLOCK_MONOTONIC. > Existing consumers mainly measure delay but clock drifts, DST changes, etc. > will add noise to the data. Well then disregard my patch - as long as it's fixed one way or the other... i'll test yours.
(In reply to Jan Beich from comment #6) > (In reply to Landry Breuil (:gaston) from comment #3) > > Wouldnt it make more sense to use clock_gettime() ? > > No. According to bug 1352961 comment 24 it's only an issue for > --enable-stdcxx-compat. > > I'm more puzzled why msSystemNow isn't steady_clock or CLOCK_MONOTONIC. > Existing consumers mainly measure delay but clock drifts, DST changes, etc. > will add noise to the data. Are steady_clock/CLOCK_MONOTONIC usable across process boundaries? To my recollection, the reason gabor had to use a client clock was because the monotonic ones were tied to process uptime. (Though my recollection is fuzzy. I was only r? because the code was augmenting Telemetry)
Comment on attachment 8955900 [details] [diff] [review] use clock gettime on unix Review of attachment 8955900 [details] [diff] [review]: ----------------------------------------------------------------- Could you quantify the impact (if any) you expect when OSX switches to using clock_gettime? (a clean try run would also help assuage my initial fears)
Attachment #8955900 - Flags: review?(chutten)
Comment on attachment 8955679 [details] Bug 1442746 - Explicitly mark <chrono> as system header. Does this actually fix the problems noted in bug 1352961 comment 24? Oh, wait, I see, we don't use <chrono> on Linux because of the problems there. Can we just make the *BSDs use the Linux code path...?
Attachment #8955679 - Flags: review?(core-build-config-reviews)
(In reply to Chris H-C :chutten from comment #8) > Are steady_clock/CLOCK_MONOTONIC usable across process boundaries? To my > recollection, the reason gabor had to use a client clock was because the > monotonic ones were tied to process uptime. (Though my recollection is > fuzzy. I was only r? because the code was augmenting Telemetry) steady_clock is tied to system uptime (i.e., CLOCK_MONOTONIC), not process uptime (i.e., CLOCK_PROCESS_CPUTIME_ID). Bug 1352961 comment 3 doesn't go into details why monotonic Epoch may change. For one, network and cold reboots are such boundaries but why would Firefox send IPC messages across them. Maybe "usability" wasn't about de facto but rather "guarantee" from the standard (C++11 or POSIX) "an unspecified point in the past" outlives all processes. (In reply to Nathan Froyd [:froydnj] from comment #10) > Does this actually fix the problems noted in bug 1352961 comment 24? --enable-stdcxx-compat makes no sense for from-source builds downstream. On libc++ platforms like FreeBSD, OpenBSD or OS X libstdc++ hacks are nop. IIUC, libc++ only supports C++11 ABI while -std=c++98 uses C++11 surrogates (e.g., nullptr, decltype). > Can we just make the *BSDs use the Linux code path...? Like #if defined(XP_UNIX) && !defined(XP_MACOSX) ?
(In reply to Jan Beich from comment #11) > (In reply to Nathan Froyd [:froydnj] from comment #10) > > Can we just make the *BSDs use the Linux code path...? > > Like #if defined(XP_UNIX) && !defined(XP_MACOSX) ? Or #if defined(HAVE_CLOCK_MONOTONIC), perhaps.
(In reply to Nathan Froyd [:froydnj] from comment #12) > (In reply to Jan Beich from comment #11) > > (In reply to Nathan Froyd [:froydnj] from comment #10) > > > Can we just make the *BSDs use the Linux code path...? > > > > Like #if defined(XP_UNIX) && !defined(XP_MACOSX) ? > > Or #if defined(HAVE_CLOCK_MONOTONIC), perhaps. But the code uses CLOCK_REALTIME, not CLOCK_MONOTONIC.
(In reply to Jan Beich from comment #13) > (In reply to Nathan Froyd [:froydnj] from comment #12) > > (In reply to Jan Beich from comment #11) > > > (In reply to Nathan Froyd [:froydnj] from comment #10) > > > > Can we just make the *BSDs use the Linux code path...? > > > > > > Like #if defined(XP_UNIX) && !defined(XP_MACOSX) ? > > > > Or #if defined(HAVE_CLOCK_MONOTONIC), perhaps. > > But the code uses CLOCK_REALTIME, not CLOCK_MONOTONIC. ...that doesn't make a lot of sense to me, but OK.
so... in the end, which way should it be fixed ? m-c is busted on bsds for various bugs, and it would be nice to entangle all of them to have a clean state for the 60 cycle.
I will r+ a change that expands from XP_LINUX to (XP_UNIX && !XP_DARWIN) (see https://wiki.mozilla.org/Platform/Platform-specific_build_defines for a helpful chart)
i dont think i have try access anymore (or dont really remember how to run it, it's been a while) but this patch should be tested on linux/osx ::)
Attachment #8955900 - Attachment is obsolete: true
Attachment #8957316 - Flags: review?(chutten)
Comment on attachment 8957316 [details] [diff] [review] use clock_gettime on unix (but not osx) Review of attachment 8957316 [details] [diff] [review]: ----------------------------------------------------------------- Whitespace nits. I'll throw this up on try in a minute. ::: toolkit/components/telemetry/Telemetry.cpp @@ +7,5 @@ > #include <algorithm> > > #include <prio.h> > #include <prproces.h> > +#if defined(XP_UNIX) && ! defined (XP_DARWIN) There shouldn't be whitespace between ! and defined, and defined and (. See https://searchfox.org/mozilla-central/rev/588d8120aa11738657da93e09a03378bcd1ba8ec/js/src/ds/MemoryProtectionExceptionHandler.cpp#14 @@ +1646,5 @@ > > NS_IMETHODIMP > TelemetryImpl::MsSystemNow(double* aResult) > { > +#if defined(XP_UNIX) && ! defined (XP_DARWIN) ditto
Attachment #8957316 - Flags: review?(chutten)
Well, seems all green to me.
whitespaces fixed
Attachment #8957316 - Attachment is obsolete: true
Attachment #8957453 - Flags: review?(chutten)
Comment on attachment 8957453 [details] [diff] [review] use clock_gettime on unix (but not osx) Review of attachment 8957453 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. Would you like me to mark this for checkin, or shall I leave it to you?
Attachment #8957453 - Flags: review?(chutten) → review+
I'm not well-versed in autoland, so i'll let the sherrifs land it :)
Keywords: checkin-needed
Status: NEW → ASSIGNED
Priority: -- → P1
Pushed by dluca@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/865c06c8aae7 use clock_gettime on all unices but osx, not only linux - fixes build on BSD. r=chutten
Keywords: checkin-needed
TEST-UNEXPECTED-ERROR | /builds/worker/checkouts/gecko/toolkit/components/telemetry/parse_scalars.py:62:86 | statement ends with a semicolon (E703) TEST-UNEXPECTED-ERROR | /builds/worker/checkouts/gecko/toolkit/components/telemetry/parse_scalars.py:69:100 | line too long (107 > 99 characters) (E501) TEST-UNEXPECTED-ERROR | /builds/worker/checkouts/gecko/toolkit/components/telemetry/parse_scalars.py:75:100 | line too long (108 > 99 characters) (E501) Sorry, but that makes absolutely no sense to me. You want to backout 13163586e52b from Bug 1426461.
Flags: needinfo?(landry)
(In reply to Landry Breuil (:gaston) from comment #26) > Sorry, but that makes absolutely no sense to me. You want to backout > 13163586e52b from Bug 1426461. Clearly it makes some sense, otherwise you wouldn't have suggestions on what else to backout! ;)
Pushed by dluca@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/4ffe013db751 use clock_gettime on all unices but osx, not only linux - fixes build on BSD. r=chutten
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Attachment #8957453 - Flags: checkin+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: