Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

Jimmy Yuan
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/516729a8-84b0-4407-ac25-c3d85061ceb1%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

ลําใย พรมมีเดช


เมื่อ วันอังคารที่ 7 มกราคม ค.ศ. 2020 23 นาฬิกา 13 นาที 53 วินาที UTC+7, Jimmy Yuan เขียนว่า:
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/bab24000-b7f6-4917-ab49-95690e6de20d%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

Florian Mayer
In reply to this post by Jimmy Yuan
Thanks for getting in touch. We do not support profiling across forks.

What you can do is start the profile only after the process has forked (we do support enabling profiling after a process has started – the resulting data will not include allocations that were made before the profile was started).

You can also profile the process from startup, then when you see the "Detected post-fork child situation, stopping profiling" message, start a second profile for the new process.

Hope this helps,
Florian

On Tuesday, January 7, 2020 at 4:13:53 PM UTC, Jimmy Yuan wrote:
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/c7913ba7-82e2-4159-8ca6-b1b6a61ee74e%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

Jimmy Yuan
Thanks for you response. The problem is I don't known where is code fork called, maybe in some third party plugins. After fork the new process stoped soon(ps -A | grep new_pid got nothing). And the parent process(pid_at_creation_) is keep running, but the profd_client has called ShutdownLazy.

On Thursday, January 9, 2020 at 1:05:14 AM UTC+8, Florian Mayer wrote:
Thanks for getting in touch. We do not support profiling across forks.

What you can do is start the profile only after the process has forked (we do support enabling profiling after a process has started – the resulting data will not include allocations that were made before the profile was started).

You can also profile the process from startup, then when you see the "Detected post-fork child situation, stopping profiling" message, start a second profile for the new process.

Hope this helps,
Florian

On Tuesday, January 7, 2020 at 4:13:53 PM UTC, Jimmy Yuan wrote:
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/f486358e-1b80-4aec-9111-1c64d9cef120%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

Florian Mayer
This should not impact the parent process, we only stop the profiling session in the child. 

Are you not able to get the profile for the parent either? Could you provide more detailed information on what you are attempting to do, what you expect to happen and what happens instead?

Thank you,
Florian

On Thursday, January 9, 2020 at 8:32:57 PM UTC, Jimmy Yuan wrote:
Thanks for you response. The problem is I don't known where is code fork called, maybe in some third party plugins. After fork the new process stoped soon(ps -A | grep new_pid got nothing). And the parent process(pid_at_creation_) is keep running, but the profd_client has called ShutdownLazy.

On Thursday, January 9, 2020 at 1:05:14 AM UTC+8, Florian Mayer wrote:
Thanks for getting in touch. We do not support profiling across forks.

What you can do is start the profile only after the process has forked (we do support enabling profiling after a process has started – the resulting data will not include allocations that were made before the profile was started).

You can also profile the process from startup, then when you see the "Detected post-fork child situation, stopping profiling" message, start a second profile for the new process.

Hope this helps,
Florian

On Tuesday, January 7, 2020 at 4:13:53 PM UTC, Jimmy Yuan wrote:
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/5f10d305-c67c-48f9-901f-9ef581e9594e%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

Jimmy Yuan
I want to make a tool sum a .so library's memory usage.

Here is my practice.

start.sh
adb shell am force-stop com.foo.bar
adb shell monkey -p com.foo.bar -c android.intent.category.LAUNCHER 1
adb shell perfetto -c - --txt --detach=session1 \
    -o /data/misc/perfetto-traces/trace \
<<EOF

buffers: {
    size_kb: 100352
    fill_policy: RING_BUFFER
}
buffers: {
    size_kb: 2048
    fill_policy: RING_BUFFER
}

data_sources: {
    config {
        name: "android.heapprofd"
        target_buffer: 0
        heapprofd_config {
            sampling_interval_bytes: 4096
            process_cmdline: "com.foo.bar"
            shmem_size_bytes: 67108864
        }
    }
}

flush_period_ms: 3000
write_into_file: true

EOF


stop.sh
adb shell perfetto --attach=session1 --stop

run start.sh
wait app start to login
run stop.sh

adb pull /data/misc/perfetto-traces/trace trace

Open trace from Perfetto UI, Heap Profile only show one track point at start.
I find "Detected post-fork child situation, stopping profiling" from logcat.
I hack the return code to return true and replaced heapprofd_client.so I compiled.
Open trace from Perfetto UI, Heap Profile show track points as I wish.

On Friday, January 10, 2020 at 11:15:45 PM UTC+8, Florian Mayer wrote:
This should not impact the parent process, we only stop the profiling session in the child. 

Are you not able to get the profile for the parent either? Could you provide more detailed information on what you are attempting to do, what you expect to happen and what happens instead?

Thank you,
Florian

On Thursday, January 9, 2020 at 8:32:57 PM UTC, Jimmy Yuan wrote:
Thanks for you response. The problem is I don't known where is code fork called, maybe in some third party plugins. After fork the new process stoped soon(ps -A | grep new_pid got nothing). And the parent process(pid_at_creation_) is keep running, but the profd_client has called ShutdownLazy.

On Thursday, January 9, 2020 at 1:05:14 AM UTC+8, Florian Mayer wrote:
Thanks for getting in touch. We do not support profiling across forks.

What you can do is start the profile only after the process has forked (we do support enabling profiling after a process has started – the resulting data will not include allocations that were made before the profile was started).

You can also profile the process from startup, then when you see the "Detected post-fork child situation, stopping profiling" message, start a second profile for the new process.

Hope this helps,
Florian

On Tuesday, January 7, 2020 at 4:13:53 PM UTC, Jimmy Yuan wrote:
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/8b891cba-f369-4a5e-ad17-7e2a7589e210%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Some unity games stop profiling at startup, because perfetto::profiling::Client::RecordMalloc return false at PERFETTO_UNLIKELY(getpid() != pid_at_creation_

Florian Mayer
Hello!

The configuration shown should only produce a single dump, at the end of the session.

Also, could you try `perfetto -d` in start.sh, and just `adb shell killall -INT perfetto` in stop.sh?
The use of --attach is not encouraged: https://docs.perfetto.dev/#/detached-mode

> Open trace from Perfetto UI, Heap Profile show track points as I wish.
Can you elaborate what you mean by that? What exactly did you expect?

Cheers,
Florian
PS: As an side, you can remove the 2048 kB buffer, because it is unused in the config below.

On Monday, January 13, 2020 at 3:34:51 PM UTC, Jimmy Yuan wrote:
I want to make a tool sum a .so library's memory usage.

Here is my practice.

start.sh
adb shell am force-stop com.foo.bar
adb shell monkey -p com.foo.bar -c android.intent.category.LAUNCHER 1
adb shell perfetto -c - --txt --detach=session1 \
    -o /data/misc/perfetto-traces/trace \
<<EOF

buffers: {
    size_kb: 100352
    fill_policy: RING_BUFFER
}
buffers: {
    size_kb: 2048
    fill_policy: RING_BUFFER
}

data_sources: {
    config {
        name: "android.heapprofd"
        target_buffer: 0
        heapprofd_config {
            sampling_interval_bytes: 4096
            process_cmdline: "com.foo.bar"
            shmem_size_bytes: 67108864
        }
    }
}

flush_period_ms: 3000
write_into_file: true

EOF


stop.sh
adb shell perfetto --attach=session1 --stop

run start.sh
wait app start to login
run stop.sh

adb pull /data/misc/perfetto-traces/trace trace

Open trace from Perfetto UI, Heap Profile only show one track point at start.
I find "Detected post-fork child situation, stopping profiling" from logcat.
I hack the return code to return true and replaced heapprofd_client.so I compiled.
Open trace from Perfetto UI, Heap Profile show track points as I wish.

On Friday, January 10, 2020 at 11:15:45 PM UTC+8, Florian Mayer wrote:
This should not impact the parent process, we only stop the profiling session in the child. 

Are you not able to get the profile for the parent either? Could you provide more detailed information on what you are attempting to do, what you expect to happen and what happens instead?

Thank you,
Florian

On Thursday, January 9, 2020 at 8:32:57 PM UTC, Jimmy Yuan wrote:
Thanks for you response. The problem is I don't known where is code fork called, maybe in some third party plugins. After fork the new process stoped soon(ps -A | grep new_pid got nothing). And the parent process(pid_at_creation_) is keep running, but the profd_client has called ShutdownLazy.

On Thursday, January 9, 2020 at 1:05:14 AM UTC+8, Florian Mayer wrote:
Thanks for getting in touch. We do not support profiling across forks.

What you can do is start the profile only after the process has forked (we do support enabling profiling after a process has started – the resulting data will not include allocations that were made before the profile was started).

You can also profile the process from startup, then when you see the "Detected post-fork child situation, stopping profiling" message, start a second profile for the new process.

Hope this helps,
Florian

On Tuesday, January 7, 2020 at 4:13:53 PM UTC, Jimmy Yuan wrote:
"Detected post-fork child situation, stopping profiling."
Can't handle this situation?
I comment the return code, everything going on.
Please fix this situation.
Thank you.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/7230a816-93dc-4fb9-85c7-d18db6397e6a%40googlegroups.com.