Use Executors.newSingleThreadScheduledExecutor instead of Thread.sleep for Java Sampler
Categories
(Core :: Gecko Profiler, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: m_kato, Assigned: m_kato)
References
Details
Attachments
(1 file)
Actually, we use Thread.sleep
to get next sampling duration. But as long as old comment, this sampling min duration is 10ms (see https://searchfox.org/mozilla-central/rev/ad6234148892bc29bf08d736604ac71925138040/tools/profiler/core/platform.cpp#4192).
When I test Executors.newSingleThreadScheduledExecutor
on old device (10 year's old Galaxy Nexus) instead of Thread.sleep
, it can change to 1-2ms.
So we should use ScheduledExecutorService
instead.
Comment 1•5 years ago
|
||
Hey Nazim, I think this is relevant to the other bug that aims to put the interval back a 1ms. It would make sense to tackle both bugs together. What do you think?
Yeah, that's a good idea! We can land both of them together.
Makoto, it looks assigned to you. Do you mind if I take this one, if you are not working on it already?
Assignee | ||
Comment 3•5 years ago
|
||
(In reply to Nazım Can Altınova [:canova][:canaltinova on phabricator] from comment #2)
Yeah, that's a good idea! We can land both of them together.
Makoto, it looks assigned to you. Do you mind if I take this one, if you are not working on it already?
I already have a patch, so it will be ready for review soon.
Assignee | ||
Comment 4•5 years ago
|
||
Comment 5•5 years ago
|
||
Hey makoto, try run seems green! Do you think you can push your patch for review?
Assignee | ||
Comment 6•5 years ago
|
||
Actually, we use Thread.sleep
to get next sampling duration. But as long as
old comment, this sampling min duration is 10ms. But when I test
Executors.newSingleThreadScheduledExecutor
on old device (10 year's old
Galaxy Nexus) instead of Thread.sleep, it can use 2ms sampling duration.
So we should use ScheduledExecutorService instead.
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 8•5 years ago
|
||
bugherder |
Description
•