Files
linux/tools/perf/tests/shell/lib/setup_python.sh
Ian Rogers 270e3f076b perf python: Add LiveSession helper
Add LiveSession class in tools/perf/python/perf_live.py to support
live event collection using perf.evlist and perf.parse_events,
avoiding the need to fork a separate perf record process.

Signed-off-by: Ian Rogers <irogers@google.com>
Assisted-by: Gemini:gemini-3.1-pro-preview
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alice Rogers <alice.mei.rogers@gmail.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2026-06-30 10:17:19 -07:00

30 lines
834 B
Bash

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
if [ "x$PYTHON" = "x" ]
then
python3 --version >/dev/null 2>&1 && PYTHON=python3
fi
if [ "x$PYTHON" = "x" ]
then
python --version >/dev/null 2>&1 && PYTHON=python
fi
if [ "x$PYTHON" = "x" ]
then
echo Skipping test, python not detected please set environment variable PYTHON.
exit 2
fi
# Set PYTHONPATH to find the in-tree built perf.so first, avoiding system-wide perf.so
if [ -n "$PERF_EXEC_PATH" ] && [ -d "$PERF_EXEC_PATH/python" ]; then
PYTHONPATH_DIR="$PERF_EXEC_PATH/python"
elif [ -d "$(dirname "$0")/../../python" ]; then
PYTHONPATH_DIR="$(dirname "$0")/../../python"
elif [ -d "$(dirname "$0")/../python" ]; then
PYTHONPATH_DIR="$(dirname "$0")/../python"
fi
if [ -n "$PYTHONPATH_DIR" ]; then
export PYTHONPATH="$PYTHONPATH_DIR${PYTHONPATH:+:$PYTHONPATH}"
fi