Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
746 stars 54 forks source link

tests: java java_async_profiler_cpu_mode fail on aarch64 #723

Open pfilipko1 opened 1 year ago

pfilipko1 commented 1 year ago

test:

FAILED tests/test_java.py::test_java_async_profiler_cpu_mode[True] - AssertionError: function 'do_syscall_64_[k]' missing in collapsed data!

Output (collapsed data too long to include):

application_pid = 76225, assert_collapsed = functools.partial(<function assert_function_in_collapsed at 0xffffa34a0ee0>, 'Fibonacci.main'), profiler_state = <gprofiler.profiler_state.ProfilerState object at 0xffffa3310af0>                                                                                                                                                                                                                                                                                                                                @pytest.mark.parametrize("in_container", [True])                                                                                                                                                                                                                             def test_java_async_profiler_cpu_mode(                                                                                                                                                                                                                                           application_pid: int,
        assert_collapsed: AssertInCollapsed,
        profiler_state: ProfilerState,                                                                                                                                                                                                                                           ) -> None:
        """                                                                                                                                                                                                                                                                          Run Java in a container and enable async-profiler in CPU mode, make sure we get kernel stacks.
        """
        with make_java_profiler(
            profiler_state,
            frequency=999,
            # this ensures auto selection picks CPU by default, if possible.                                                                                                                                                                                                             java_async_profiler_mode="auto",
        ) as profiler:
            process_collapsed = snapshot_pid_collapsed(profiler, application_pid)
            assert_collapsed(process_collapsed)
>           assert_function_in_collapsed("do_syscall_64_[k]", process_collapsed)  # ensure kernels stacks exist

tests/test_java.py:163:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
function_name = 'do_syscall_64_[k]'
collapsed = Counter({'java;Fibonacci.main([Ljava/lang/String|)V_[j];Fibonacci.fibonacci(I)J_[j];Fibonacci.fibonacci(I)J_[j];Fibona...;ovl_dir_open?[overlay]_[k];ovl_path_open?[overlay]_[k];dentry_open_[k];do_dentry_open_[k];file_ra_state_init_[k]': 1})                 
    def assert_function_in_collapsed(function_name: str, collapsed: StackToSampleCount) -> None:
        print(f"collapsed: {collapsed}")
>       assert is_function_in_collapsed(function_name, collapsed), f"function {function_name!r} missing in collapsed data!"
E       AssertionError: function 'do_syscall_64_[k]' missing in collapsed data!

tests/utils.py:171: AssertionError
Jongy commented 1 year ago

This means the kernel profiling failed (no kernel symbols), or just the function name is different in ARM. We need to see how the raw profile looks like and perhaps choose another kernel function name to search for.