FlameGraph
FlameGraph copied to clipboard
Exlude perf command column in FlameGraph
I want to create a FlameGraph based on a perf record of a GraalVM native executable. With GraalVM native executable, perf add the name of the thread to the perf report command column, this leads to un-usable FlameGraph as the frames are not merged.
I generate the perf record with perf record -F 99 -p PID sleep 10. Using DWARF symbols leads to the same issue.
Here are the first line of such a perf record:
# Overhead Command Shared Object Symbol >
# ........ ............... .................................... .......................................................................................................................................>
#
1.44% ntloop-thread-2 [kernel.kallsyms] [k] acpi_pm_read
0.91% ecutor-thread-3 [kernel.kallsyms] [k] acpi_pm_read
0.89% ecutor-thread-5 [kernel.kallsyms] [k] available_idle_cpu
0.89% ecutor-thread-4 bookmark-service-1.0-SNAPSHOT-runner [.] ConcurrentHashMap_get_11876bdf828aa0caf5754f7b9d3d5ee38ba37e5e
0.80% ecutor-thread-4 libpthread-2.31.so [.] __pthread_mutex_unlock
0.80% ntloop-thread-7 [kernel.kallsyms] [k] acpi_pm_read
0.76% ecutor-thread-4 [kernel.kallsyms] [k] acpi_pm_read
0.75% ecutor-thread-1 [kernel.kallsyms] [k] acpi_pm_read
0.73% ntloop-thread-4 [kernel.kallsyms] [k] do_syscall_64
0.72% ntloop-thread-1 [kernel.kallsyms] [k] acpi_pm_read
0.71% ecutor-thread-5 [kernel.kallsyms] [k] acpi_pm_read
0.70% ntloop-thread-3 [kernel.kallsyms] [k] acpi_pm_read
0.67% ecutor-thread-2 [kernel.kallsyms] [k] acpi_pm_read
0.66% ntloop-thread-5 [kernel.kallsyms] [k] acpi_pm_read
0.64% ecutor-thread-3 bookmark-service-1.0-SNAPSHOT-runner [.] ArraycopySnippets_doArraycopy_043961c4b8a78c521bb6ac0bcc8243e2da5fd903
0.61% ecutor-thread-1 bookmark-service-1.0-SNAPSHOT-runner [.] EnhancedQueueExecutor$PoolThreadNode_park_2242a925ee072f4927601112a1d252fa4b9f4e5f
0.57% ecutor-thread-6 bookmark-service-1.0-SNAPSHOT-runner [.] ContextImpl_getEventLoop_a48ceb79cef1cc171a564acaeacaba0bcb647a3d
0.56% ecutor-thread-3 bookmark-service-1.0-SNAPSHOT-runner [.] MultiThreadedMonitorSupport_getOrCreateMonitor_2ecf5995a7a109dacede518d33424ec5ebddfde6
0.54% ecutor-thread-1 libpthread-2.31.so [.] __libc_write
I don't know if it's a bug on perf, but as the command is different for each thread, the stack are not merged by the FlameGraph tools.
Is there a way to not take the command into accound when creating a FlameGraph ? Should I pre-process the perf record to update the column to the same value ?