Skip to content

Commit 49a89db

Browse files
committed
address the reviewer's comment, except for the html output
1 parent 38f138a commit 49a89db

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

internal/report/table_defs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,9 +1906,9 @@ func codePathFrequencyTableValues(outputs map[string]script.ScriptOutput) []Fiel
19061906
func kernelLockAnalysisTableValues(outputs map[string]script.ScriptOutput) []Field {
19071907
fields := []Field{
19081908
{Name: "Hotspot without Callstack", Values: []string{sectionValueFromOutput(outputs, "perf_hotspot_no_children")}},
1909-
{Name: "Hotspot with Callstack", Values: []string{sectionValueFromOutput(outputs, "perf_hotspot_callgraph")}},
1909+
{Name: "Hotspot with Callstack", Values: []string{sectionValueFromOutput(outputs, "perf_hotspot_callgraph")}},
19101910
{Name: "Cache2Cache without Callstack", Values: []string{sectionValueFromOutput(outputs, "perf_c2c_no_children")}},
1911-
{Name: "Cache2Cache with CallStack", Values: []string{sectionValueFromOutput(outputs, "perf_c2c_callgraph")}},
1911+
{Name: "Cache2Cache with CallStack", Values: []string{sectionValueFromOutput(outputs, "perf_c2c_callgraph")}},
19121912
{Name: "Lock Contention", Values: []string{sectionValueFromOutput(outputs, "perf_lock_contention")}},
19131913
}
19141914
return fields

internal/script/script_defs.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,17 +976,21 @@ duration=%d
976976
perf record -F $frequency -a -g --call-graph dwarf -W -d --phys-data --sample-cpu -e cycles:pp,instructions:pp,cpu/mem-loads,ldlat=30/P,cpu/mem-stores/P -o perf_hotspot.data -- sleep $duration &
977977
PERF_HOTSPOT_PID=$!
978978
979-
# collect c2c
980-
# perf c2c record -F $frequency -a -g --call-graph dwarf -o perf_c2c.data -- sleep $duration &
981-
# PERF_C2C_PID=$!
979+
# check the availability perf lock -b option
980+
perf lock contention -a -bv --max-stack 20 2>/dev/null -- sleep 0
981+
PERF_LOCK_CONTENTION_BPF=$?
982982
983983
# collect lock
984-
perf lock contention -a -bv --max-stack 20 2>perf_lock_contention.txt -- sleep $duration &
985-
PERF_LOCK_PID=$!
984+
if [ ${PERF_LOCK_CONTENTION_BPF} -eq 0 ]; then
985+
perf lock contention -a -bv --max-stack 20 2>perf_lock_contention.txt -- sleep $duration &
986+
PERF_LOCK_PID=$!
987+
fi
986988
987989
wait ${PERF_HOTSPOT_PID}
988-
# wait ${PERF_C2C_PID}
989-
wait ${PERF_LOCK_PID}
990+
991+
if [ ${PERF_LOCK_CONTENTION_BPF} -eq 0 ]; then
992+
wait ${PERF_LOCK_PID}
993+
fi
990994
991995
# restore perf_event_paranoid and kptr_restrict
992996
echo "$PERF_EVENT_PARANOID" > /proc/sys/kernel/perf_event_paranoid

0 commit comments

Comments
 (0)