WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
172800
[JSC][MIPS] SamplingProfiler::timerLoop() sleeps for 4000+ seconds
https://bugs.webkit.org/show_bug.cgi?id=172800
Summary
[JSC][MIPS] SamplingProfiler::timerLoop() sleeps for 4000+ seconds
Guillaume Emont
Reported
2017-06-01 03:35:31 PDT
When running stress/sampling-profiler-basic.js, the value of randomFluctuation in SamplingProfiler::timerLoop() can get pretty large, meaning the sampling profiler does not sample much. This causes a bunch of sampling-profiler tests in stress/ to fail.
Attachments
Patch
(2.06 KB, patch)
2017-06-01 10:14 PDT
,
Guillaume Emont
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Guillaume Emont
Comment 1
2017-06-01 03:36:11 PDT
It looks like changing the cast from uint64_t to int64_t solves the issue, but I'm not sure it is the correct approach.
Saam Barati
Comment 2
2017-06-01 09:24:35 PDT
(In reply to Guillaume Emont from
comment #1
)
> It looks like changing the cast from uint64_t to int64_t solves the issue, > but I'm not sure it is the correct approach.
Interesting! uint64_t to int64_t where? Also, what do you mean by "pretty large"?
Guillaume Emont
Comment 3
2017-06-01 09:52:51 PDT
(In reply to Saam Barati from
comment #2
)
> (In reply to Guillaume Emont from
comment #1
) > > It looks like changing the cast from uint64_t to int64_t solves the issue, > > but I'm not sure it is the correct approach. > > Interesting! > > uint64_t to int64_t where? Also, what do you mean by "pretty large"?
Sorry, I could have been more precise. I mean to change: std::chrono::microseconds randomFluctuation = std::chrono::microseconds(static_cast<uint64_t>(randomSignedNumber * static_cast<double>(m_timingInterval.count()) * 0.20l)); into:
Guillaume Emont
Comment 4
2017-06-01 09:54:37 PDT
(In reply to Saam Barati from
comment #2
)
> (In reply to Guillaume Emont from
comment #1
) > > It looks like changing the cast from uint64_t to int64_t solves the issue, > > but I'm not sure it is the correct approach. > > Interesting! > > uint64_t to int64_t where? Also, what do you mean by "pretty large"?
Sorry, I could have been more precise. I meant to change: std::chrono::microseconds randomFluctuation = std::chrono::microseconds(static_cast<uint64_t>(randomSignedNumber * static_cast<double>(m_timingInterval.count()) * 0.20l)); into: std::chrono::microseconds randomFluctuation = std::chrono::microseconds(static_cast<int64_t>(randomSignedNumber * static_cast<double>(m_timingInterval.count()) * 0.20l)); Alternatively, we could put an abs() inside the static_cast<uint64_t>(), depending on what the original intent is.
Guillaume Emont
Comment 5
2017-06-01 10:00:51 PDT
And by pretty large, I mean that sleep afterwards was of more than 4000 seconds (so I guess the value was somewhere close to 2^32?). If that matters, I can run a new debugging session to see the exact number I get. My guess is that the static_cast from a negative double to an uint64_t is undefined, at least it looks like my compiler (gcc 6.2.0 targeting mipsel) treats it as such.
Saam Barati
Comment 6
2017-06-01 10:01:26 PDT
Yup, the code in ToT clearly looks wrong. We're looking for a +- random range, but we clearly cast to unsigned.
Saam Barati
Comment 7
2017-06-01 10:02:59 PDT
Your proposed change looks right to me.
Guillaume Emont
Comment 8
2017-06-01 10:05:15 PDT
(In reply to Saam Barati from
comment #7
)
> Your proposed change looks right to me.
Ok, patch upcoming!
Guillaume Emont
Comment 9
2017-06-01 10:14:10 PDT
Created
attachment 311715
[details]
Patch Patch fixing the issue.
Saam Barati
Comment 10
2017-06-01 10:15:06 PDT
Comment on
attachment 311715
[details]
Patch r=me
WebKit Commit Bot
Comment 11
2017-06-01 10:42:26 PDT
Comment on
attachment 311715
[details]
Patch Clearing flags on attachment: 311715 Committed
r217663
: <
http://trac.webkit.org/changeset/217663
>
WebKit Commit Bot
Comment 12
2017-06-01 10:42:28 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug