mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1677868 - Rename "Java Main Thread" to "AndroidUI (Java)" in the profiler. r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D97378
This commit is contained in:
parent
4ac4b1acab
commit
a121e8f0c7
@ -21,7 +21,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
|
||||
// Bug 1618560: Currently we only profile the Java Main Thread. Ideally we should
|
||||
// Bug 1618560: Currently we only profile the Android UI thread. Ideally we should
|
||||
// be able to profile multiple threads.
|
||||
public class GeckoJavaSampler {
|
||||
private static final String LOGTAG = "GeckoJavaSampler";
|
||||
|
@ -2723,11 +2723,11 @@ static void CollectJavaThreadProfileData(ProfileBuffer& aProfileBuffer) {
|
||||
// if we can customize it
|
||||
|
||||
// Pass the samples
|
||||
// FIXME(bug 1618560): We are currently only profiling the Java main thread.
|
||||
// FIXME(bug 1618560): We are currently only profiling the Android UI thread.
|
||||
constexpr int threadId = 0;
|
||||
int sampleId = 0;
|
||||
while (true) {
|
||||
// Gets the data from the java main thread only.
|
||||
// Gets the data from the Android UI thread only.
|
||||
double sampleTime = java::GeckoJavaSampler::GetSampleTime(sampleId);
|
||||
if (sampleTime == 0.0) {
|
||||
break;
|
||||
@ -2754,7 +2754,7 @@ static void CollectJavaThreadProfileData(ProfileBuffer& aProfileBuffer) {
|
||||
|
||||
// Pass the markers now
|
||||
while (true) {
|
||||
// Gets the data from the java main thread only.
|
||||
// Gets the data from the Android UI thread only.
|
||||
java::GeckoJavaSampler::Marker::LocalRef marker =
|
||||
java::GeckoJavaSampler::PollNextMarker();
|
||||
if (!marker) {
|
||||
@ -2889,10 +2889,16 @@ static void locked_profiler_stream_json_for_this_process(
|
||||
ProfileBuffer javaBuffer(bufferManager);
|
||||
CollectJavaThreadProfileData(javaBuffer);
|
||||
|
||||
// Thread id of java Main thread is 0, if we support profiling of other
|
||||
// java thread, we have to get thread id and name via JNI.
|
||||
// Set the thread id of the Android UI thread to be 0.
|
||||
// We are profiling the Android UI thread twice: Both from the C++ side
|
||||
// (as a regular C++ profiled thread with the name "AndroidUI"), and from
|
||||
// the Java side. The thread's actual ID is mozilla::jni::GetUIThreadId(),
|
||||
// but since we're using that ID for the C++ side, we need to pick another
|
||||
// tid that doesn't conflict with it for the Java side. So we just use 0.
|
||||
// Once we add support for profiling of other java threads, we'll have to
|
||||
// get their thread id and name via JNI.
|
||||
RefPtr<ThreadInfo> threadInfo = new ThreadInfo(
|
||||
"Java Main Thread", 0, false, CorePS::ProcessStartTime());
|
||||
"AndroidUI (JVM)", 0, false, CorePS::ProcessStartTime());
|
||||
ProfiledThreadData profiledThreadData(threadInfo, nullptr);
|
||||
profiledThreadData.StreamJSON(
|
||||
javaBuffer, nullptr, aWriter, CorePS::ProcessName(aLock),
|
||||
|
Loading…
Reference in New Issue
Block a user