python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 """ tdc.py - Linux tc (Traffic Control) unit test driver Copyright (C) 2017 Lucas Bates <lucasb@mojatatu.com> """ import re import os import sys import argparse import importlib import json import subprocess import time import traceback from collections impor...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/tdc.py
""" # SPDX-License-Identifier: GPL-2.0 tdc_config.py - tdc user-specified values Copyright (C) 2017 Lucas Bates <lucasb@mojatatu.com> """ # Dictionary containing all values that can be substituted in executable # commands. NAMES = { # Substitute your own tc path here 'TC': '/sbin/tc', # ...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/tdc_config.py
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/plugins/__init__.py
''' build ebpf program ''' import os import signal from string import Template import subprocess import time from TdcPlugin import TdcPlugin from tdc_config import * class SubPlugin(TdcPlugin): def __init__(self): self.sub_class = 'buildebpf/SubPlugin' self.tap = '' super().__init__() ...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/plugin-lib/buildebpfPlugin.py
import os import signal from string import Template import subprocess import time from TdcPlugin import TdcPlugin from tdc_config import * class SubPlugin(TdcPlugin): def __init__(self): self.sub_class = 'ns/SubPlugin' super().__init__() def pre_suite(self, testcount, testidlist): '''...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/plugin-lib/nsPlugin.py
#!/usr/bin/env python3 import os import signal from string import Template import subprocess import time from TdcPlugin import TdcPlugin from tdc_config import * try: from scapy.all import * except ImportError: print("Unable to import the scapy python module.") print("\nIf not already installed, you may ...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/plugin-lib/scapyPlugin.py
import os import sys from TdcPlugin import TdcPlugin from tdc_config import * class SubPlugin(TdcPlugin): def __init__(self): self.sub_class = 'root/SubPlugin' super().__init__() def pre_suite(self, testcount, testidlist): # run commands before test_runner goes into a test loop ...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py
''' run the command under test, under valgrind and collect memory leak info as a separate test. ''' import os import re import signal from string import Template import subprocess import time from TdcPlugin import TdcPlugin from TdcResults import * from tdc_config import * def vp_extract_num_from_string(num_as_stri...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tc-testing/plugin-lib/valgrindPlugin.py
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) import hashlib import os import socket import struct import sys import unittest import fcntl import select TPM2_ST_NO_SESSIONS = 0x8001 TPM2_ST_SESSIONS = 0x8002 TPM2_CC_FIRST = 0x01FF TPM2_CC_CREATE_PRIMARY = 0x0131 TPM2_CC_DICTIONARY_ATTACK_LOCK_RESET = 0x0139 ...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tpm2/tpm2.py
# SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) from argparse import ArgumentParser from argparse import FileType import os import sys import tpm2 from tpm2 import ProtocolError import unittest import logging import struct class SmokeTest(unittest.TestCase): def setUp(self): self.client = tpm2.Client...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/tpm2/tpm2_tests.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Test that truncation of bprm->buf doesn't cause unexpected execs paths, along # with various other pathological cases. import os, subprocess # Relevant commits # # b5372fe5dc84 ("exec: load_script: Do not exec truncated interpreter path") # 6eb3c3d0a52d ("e...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/exec/binfmt_script.py
#!/usr/bin/env python3 # Copyright (C) 2017 Netronome Systems, Inc. # Copyright (c) 2019 Mellanox Technologies. All rights reserved # # This software is licensed under the GNU General License Version 2, # June 1991 as shown in the file COPYING in the top-level directory of this # source tree. # # THE COPYRIGHT HOLDERS...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/bpf/test_offload.py
# SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2020 SUSE LLC. import collections import functools import json import os import socket import subprocess import unittest # Add the source tree of bpftool and /usr/local/sbin to PATH cur_dir = os.path.dirname(os.path.realpath(__file__)) bpftool_dir = os.path.abspath(...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/bpf/test_bpftool.py
#!/usr/bin/env python3 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # # Copyright (C) 2021 Isovalent, Inc. import argparse import re import os, sys LINUX_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir)) BPFTOOL_DIR = os.getenv('BPFTOOL_DIR', os...
grace-kernel-grace-kernel-6.1.y
tools/testing/selftests/bpf/test_bpftool_synctypes.py
# SPDX-License-Identifier: GPL-2.0 # # Collection of configs for building non-UML kernels and running them on QEMU. # # Copyright (C) 2021, Google LLC. # Author: Brendan Higgins <brendanhiggins@google.com> from dataclasses import dataclass from typing import List @dataclass(frozen=True) class QemuArchParams: linux...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_config.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # A thin wrapper on top of the KUnit Kernel # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <felixguoxiuping@gmail.com> # Author: Brendan Higgins <brendanhiggins@google.com> import argparse import os import re import shlex import sys import time asse...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Utilities for printing and coloring output. # # Copyright (C) 2022, Google LLC. # Author: Daniel Latypov <dlatypov@google.com> import datetime import sys import typing _RESET = '\033[0;0m' class Printer: """Wraps a file object, providing utilities for co...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit_printer.py
# SPDX-License-Identifier: GPL-2.0 # # Parses KTAP test results from a kernel dmesg log and incrementally prints # results with reader-friendly format. Stores and returns test results in a # Test object. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <felixguoxiuping@gmail.com> # Author: Brendan Higgins <brend...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit_parser.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # A collection of tests for tools/testing/kunit/kunit.py # # Copyright (C) 2019, Google LLC. # Author: Brendan Higgins <brendanhiggins@google.com> import unittest from unittest import mock import tempfile, shutil # Handling test_tmpdir import itertools impo...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit_tool_test.py
# SPDX-License-Identifier: GPL-2.0 # # Generates JSON from KUnit results according to # KernelCI spec: https://github.com/kernelci/kernelci-doc/wiki/Test-API # # Copyright (C) 2020, Google LLC. # Author: Heidi Fahim <heidifahim@google.com> from dataclasses import dataclass import json from typing import Any, Dict fro...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit_json.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # This file runs some basic checks to verify kunit works. # It is only of interest if you're making changes to KUnit itself. # # Copyright (C) 2021, Google LLC. # Author: Daniel Latypov <dlatypov@google.com.com> from concurrent import futures import datetime ...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/run_checks.py
# SPDX-License-Identifier: GPL-2.0 # # Runs UML kernel, collects output, and handles errors. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <felixguoxiuping@gmail.com> # Author: Brendan Higgins <brendanhiggins@google.com> import importlib.abc import importlib.util import logging import subprocess import os im...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit_kernel.py
# SPDX-License-Identifier: GPL-2.0 # # Builds a .config from a kunitconfig. # # Copyright (C) 2019, Google LLC. # Author: Felix Guo <felixguoxiuping@gmail.com> # Author: Brendan Higgins <brendanhiggins@google.com> from dataclasses import dataclass import re from typing import Dict, Iterable, List, Set, Tuple CONFIG_I...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/kunit_config.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='x86_64', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='x86_64', kernel_path='arch/x86/boot/bzImage', kernel_command_line='console=ttyS0', extra_qemu_params=[])
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/x86_64.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='i386', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='i386', kernel_path='arch/x86/boot/bzImage', kernel_command_line='console=ttyS0', extra_qemu_params=[])
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/i386.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='sparc', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='sparc', kernel_path='arch/sparc/boot/zImage', kernel_command_line='console=ttyS0 mem=256M', extra_qemu_params=['-m', '256'])...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/sparc.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='arm64', kconfig=''' CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''', qemu_arch='aarch64', kernel_path='arch/arm64/boot/Image.gz', kernel...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/arm64.py
from ..qemu_config import QemuArchParams import os import os.path import sys OPENSBI_FILE = 'opensbi-riscv64-generic-fw_dynamic.bin' OPENSBI_PATH = '/usr/share/qemu/' + OPENSBI_FILE if not os.path.isfile(OPENSBI_PATH): print('\n\nOpenSBI bios was not found in "' + OPENSBI_PATH + '".\n' 'Please ensure that qem...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/riscv.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='arm', kconfig=''' CONFIG_ARCH_VIRT=y CONFIG_SERIAL_AMBA_PL010=y CONFIG_SERIAL_AMBA_PL010_CONSOLE=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y''', qemu_arch='arm', kernel_path='arch/arm/boot/zImage', ...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/arm.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='s390', kconfig=''' CONFIG_EXPERT=y CONFIG_TUNE_ZEC12=y CONFIG_NUMA=y CONFIG_MODULES=y''', qemu_arch='s390x', kernel_path='arch/s390/boot/bzImage', kernel_command_line='console=ttyS0', extra_qemu_params=[ ...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/s390.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='alpha', kconfig=''' CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y''', qemu_arch='alpha', kernel_path='arch/alpha/boot/vmlinux', kernel_command_line='console=ttyS0', extra_qemu_params=[])
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/alpha.py
from ..qemu_config import QemuArchParams QEMU_ARCH = QemuArchParams(linux_arch='powerpc', kconfig=''' CONFIG_PPC64=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_HVC_CONSOLE=y''', qemu_arch='ppc64', kernel_path='vmlinux', kernel_command_line='console=ttyS0', extra_qemu_params=...
grace-kernel-grace-kernel-6.1.y
tools/testing/kunit/qemu_configs/powerpc.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org> # # Automata object: parse an automata in dot file digraph format into a python object # # For further information, see: # Documentation/trace/rv/deterministic_autom...
grace-kernel-grace-kernel-6.1.y
tools/verification/dot2/automata.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org> # # dot2k: transform dot files into a monitor for the Linux kernel. # # For further information, see: # Documentation/trace/rv/da_monitor_synthesis.rst from dot2.do...
grace-kernel-grace-kernel-6.1.y
tools/verification/dot2/dot2k.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org> # # dot2c: parse an automata in dot file digraph format into a C # # This program was written in the development of this paper: # de Oliveira, D. B. and Cucinotta, T....
grace-kernel-grace-kernel-6.1.y
tools/verification/dot2/dot2c.py
#!/usr/bin/env drgn # SPDX-License-Identifier: GPL-2.0+ # # Dump out the number of RCU callbacks outstanding. # # On older kernels having multiple flavors of RCU, this dumps out the # number of callbacks for the most heavily used flavor. # # Usage: sudo drgn rcu-cbs.py # # Copyright (C) 2021 Facebook, Inc. # # Authors:...
grace-kernel-grace-kernel-6.1.y
tools/rcu/rcu-cbs.py
#!/usr/bin/env python3 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) """Convert directories of JSON events to C code.""" import argparse import csv import json import os import sys from typing import (Callable, Dict, Optional, Sequence, Set, Tuple) import collections # Global command line arguments. _args = No...
grace-kernel-grace-kernel-6.1.y
tools/perf/pmu-events/jevents.py
from os import getenv, path from subprocess import Popen, PIPE from re import sub cc = getenv("CC") cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline() src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): cc_output = Popen([cc, opt...
grace-kernel-grace-kernel-6.1.y
tools/perf/util/setup.py
#! /usr/bin/env python # SPDX-License-Identifier: GPL-2.0-only # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com> # import perf def main(context_switch = 0, thread = -1): cpus = perf.cpu_map() threads ...
grace-kernel-grace-kernel-6.1.y
tools/perf/python/twatch.py
#! /usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # -*- python -*- # -*- coding: utf-8 -*- import perf class tracepoint(perf.evsel): def __init__(self, sys, name): config = perf.tracepoint(sys, name) perf.evsel.__init__(self, type = perf.TYPE_TRACEPOINT, ...
grace-kernel-grace-kernel-6.1.y
tools/perf/python/tracepoint.py
# SPDX-License-Identifier: GPL-2.0 from __future__ import print_function import os import sys import glob import optparse import tempfile import logging import shutil try: import configparser except ImportError: import ConfigParser as configparser def data_equal(a, b): # Allow multiple values in assignm...
grace-kernel-grace-kernel-6.1.y
tools/perf/tests/attr.py
#!/usr/bin/python # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) # Basic sanity check of perf JSON output as specified in the man page. import argparse import sys import json ap = argparse.ArgumentParser() ap.add_argument('--no-args', action='store_true') ap.add_argument('--interval', action='store_true') ap.a...
grace-kernel-grace-kernel-6.1.y
tools/perf/tests/shell/lib/perf_json_output_lint.py
# SPDX-License-Identifier: GPL-2.0 # arm-cs-trace-disasm.py: ARM CoreSight Trace Dump With Disassember # # Author: Tor Jeremiassen <tor@ti.com> # Mathieu Poirier <mathieu.poirier@linaro.org> # Leo Yan <leo.yan@linaro.org> # Al Grant <Al.Grant@arm.com> from __future__ import print_function impor...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/arm-cs-trace-disasm.py
# event_analyzing_sample.py: general event handler in python # SPDX-License-Identifier: GPL-2.0 # # Current perf report is already very powerful with the annotation integrated, # and this script is not trying to be as powerful as perf report, but # providing end user/developer a flexible way to analyze the events other...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/event_analyzing_sample.py
# Monitor the system for dropped packets and proudce a report of drop locations and counts # SPDX-License-Identifier: GPL-2.0 from __future__ import print_function import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/net_dropmonitor.py
# export-to-postgresql.py: export perf data to a postgresql database # Copyright (c) 2014, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # Thi...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/export-to-postgresql.py
# system call top # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Periodically displays system-wide system call totals, broken down by # syscall. If a [comm] arg is specified, only syscalls called by # [comm] are displayed. If an [interval] arg is specified,...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/sctop.py
# SPDX-License-Identifier: GPL-2.0+ # # Copyright (C) 2018 Ravi Bangoria, IBM Corporation # # Hypervisor call statisics from __future__ import print_function import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/powerpc-hcalls.py
# mem-phys-addr.py: Resolve physical address samples # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2018, Intel Corporation. from __future__ import division from __future__ import print_function import os import sys import struct import re import bisect import collections sys.path.append(os.environ['PERF_EXEC_...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/mem-phys-addr.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # libxed.py: Python wrapper for libxed.so # Copyright (c) 2014-2021, Intel Corporation. # To use Intel XED, libxed.so must be present. To build and install # libxed.so: # git clone https://github.com/intelxed/mbuild.git mbuild # git clone h...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/libxed.py
# system call counts # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print_function import ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/syscall-counts.py
# futex contention # (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com> # Licensed under the terms of the GNU GPL License version 2 # # Translation of: # # http://sourceware.org/systemtap/wiki/WSFutexContention # # to perf python scripting. # # Measures futex contention from __future__ import print_function import ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/futex-contention.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0 # exported-sql-viewer.py: view data from sql database # Copyright (c) 2014-2018, Intel Corporation. # To use this script you will need to have exported data using either the # export-to-sqlite.py or the export-to-postgresql.py script. Refer to those # scripts f...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/exported-sql-viewer.py
# Display a process of packets and processed time. # SPDX-License-Identifier: GPL-2.0 # It helps us to investigate networking or network device. # # options # tx: show only tx chart # rx: show only rx chart # dev=: show only thing related to specified device # debug: work with debug mode. It shows buffer status. from ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/netdev-times.py
# failed system call counts, by pid # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide failed system call totals, broken down by pid. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/failed-syscalls-by-pid.py
# export-to-sqlite.py: export perf data to a sqlite3 database # Copyright (c) 2017, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This progr...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/export-to-sqlite.py
# Cpu task migration overview toy # # Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com> # # perf script event handlers have been generated by perf script -g python # # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundat...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/sched-migration.py
# system call counts, by pid # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. from __future__ import print_function ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/syscall-counts-by-pid.py
# flamegraph.py - create flame graphs from perf samples # SPDX-License-Identifier: GPL-2.0 # # Usage: # # perf record -a -g -F 99 sleep 60 # perf script report flamegraph # # Combined: # # perf script flamegraph -a -F 99 sleep 60 # # Written by Andreas Gerstmayr <agerstmayr@redhat.com> # Flame Graphs invent...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/flamegraph.py
# SPDX-License-Identifier: GPL-2.0 from __future__ import print_function data = {} times = [] threads = [] cpus = [] def get_key(time, event, cpu, thread): return "%d-%s-%d-%d" % (time, event, cpu, thread) def store_key(time, cpu, thread): if (time not in times): times.append(time) if (...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/stat-cpi.py
# perf script event handlers, generated by perf script -g python # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/check-perf-trace.py
# report time spent in compaction # Licensed under the terms of the GNU GPL License version 2 # testing: # 'echo 1 > /proc/sys/vm/compact_memory' to force compaction of all zones import os import sys import re import signal signal.signal(signal.SIGPIPE, signal.SIG_DFL) usage = "usage: perf script report compaction-...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/compaction-times.py
# stackcollapse.py - format perf samples with one line per distinct call stack # SPDX-License-Identifier: GPL-2.0 # # This script's output has two space-separated fields. The first is a semicolon # separated stack including the program name (from the "comm" field) and the # function names from the call stack. The sec...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/stackcollapse.py
# SPDX-License-Identifier: GPL-2.0 # intel-pt-events.py: Print Intel PT Events including Power Events and PTWRITE # Copyright (c) 2017-2021, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/intel-pt-events.py
# Util.py - Python extension for perf script, miscellaneous utility code # # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com> # # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. from __future__ import print_func...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
# Core.py - Python extension for perf script, core functions # # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com> # # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. from collections import defaultdict def aut...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
# EventClass.py # SPDX-License-Identifier: GPL-2.0 # # This is a library defining some events types classes, which could # be used by other scripts to analyzing the perf samples. # # Currently there are just a few classes defined for examples, # PerfEvent is the base class for all perf event sample, PebsEvent # is a HW...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py
# SchedGui.py - Python extension for perf script, basic GUI code for # traces drawing and overview. # # Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com> # # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. ...
grace-kernel-grace-kernel-6.1.y
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py
# SPDX-License-Identifier: GPL-2.0+ import os, csv, glob class CSVCollection(dict): delimiter=';' quotechar='"' source_column_name = 'Sources / Destinations' """ This class is a dictionary representation of the collection of sheets that exist in a given .ODS file. """ def __init__(self, pattern, skip...
grace-kernel-grace-kernel-6.1.y
drivers/comedi/drivers/ni_routing/tools/csv_collection.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ # This is simply to aide in creating the entries in the order of the value of # the device-global NI signal/terminal constants defined in comedi.h import comedi_h import os, sys, re from csv_collection import CSVCollection def c_to_o(filename, prefix='\t\t\t...
grace-kernel-grace-kernel-6.1.y
drivers/comedi/drivers/ni_routing/tools/convert_csv_to_c.py
# SPDX-License-Identifier: GPL-2.0+ """ This file helps to extract string names of NI signals as included in comedi.h between NI_NAMES_BASE and NI_NAMES_BASE+NI_NUM_NAMES. """ # This is simply to aide in creating the entries in the order of the value of # the device-global NI signal/terminal constants defined in comed...
grace-kernel-grace-kernel-6.1.y
drivers/comedi/drivers/ni_routing/tools/ni_names.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ from os import path import os, csv from itertools import chain from csv_collection import CSVCollection from ni_names import value_to_name import ni_values CSV_DIR = 'csv' def iter_src_values(D): return D.items() def iter_src(D): for dest in D: yie...
grace-kernel-grace-kernel-6.1.y
drivers/comedi/drivers/ni_routing/tools/convert_py_to_csv.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ from os import path import os, csv from csv_collection import CSVCollection from ni_names import value_to_name CSV_DIR = 'csv' def to_csv(): try: os.makedirs(CSV_DIR) except: pass csv_fname = path.join(CSV_DIR, 'blank_route_table.csv') fie...
grace-kernel-grace-kernel-6.1.y
drivers/comedi/drivers/ni_routing/tools/make_blank_csv.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # # Usage: unwcheck.py FILE # # This script checks the unwind info of each function in file FILE # and verifies that the sum of the region-lengths matches the total # length of the function. # # Based on a shell/awk script originally written by Harish Patil, # w...
grace-kernel-grace-kernel-6.1.y
arch/ia64/scripts/unwcheck.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 """generate_rust_analyzer - Generates the `rust-project.json` file for `rust-analyzer`. """ import argparse import json import logging import pathlib import sys def generate_crates(srctree, objtree, sysroot_src): # Generate the configuration list. cfg ...
grace-kernel-grace-kernel-6.1.y
scripts/generate_rust_analyzer.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2018-2019 Netronome Systems, Inc. # Copyright (C) 2021 Isovalent, Inc. # In case user attempts to run with Python 2. from __future__ import print_function import argparse import re import sys, os import subprocess helpersDocStart = 'Sta...
grace-kernel-grace-kernel-6.1.y
scripts/bpf_doc.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only """Find Kconfig symbols that are referenced but not defined.""" # (c) 2014-2017 Valentin Rothberg <valentinrothberg@gmail.com> # (c) 2014 Stefan Hengelein <stefan.hengelein@fau.de> # import argparse import difflib import os import re import signal impor...
grace-kernel-grace-kernel-6.1.y
scripts/checkkconfigsymbols.py
#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 # Copyright Thomas Gleixner <tglx@linutronix.de> from argparse import ArgumentParser from ply import lex, yacc import locale import traceback import fnmatch import sys import git import re import os class ParserException(Exception): def __init__(self, tok,...
grace-kernel-grace-kernel-6.1.y
scripts/spdxcheck.py
#!/usr/bin/env python # SPDX-License-Identifier: GPL-2.0-only """ Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com> This script parses a trace provided by the function tracer in kernel/trace/trace_functions.c The resulted trace is processed into a tree to produce a more human view of the call stack by drawi...
grace-kernel-grace-kernel-6.1.y
scripts/tracing/draw_functrace.py
# # gdb helper commands and functions for Linux kernel debugging # # loader module # # Copyright (c) Siemens AG, 2012, 2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/vmlinux-gdb.py
# # gdb helper commands and functions for Linux kernel debugging # # list tools # # Copyright (c) Thiebaud Weksteen, 2015 # # Authors: # Thiebaud Weksteen <thiebaud@weksteen.fr> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import utils list_head = utils.CachedType("st...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/lists.py
# # gdb helper commands and functions for Linux kernel debugging # # task & thread tools # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import utils task_type = utils.CachedType(...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/tasks.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright 2019 Google LLC. import gdb import zlib from linux import utils class LxConfigDump(gdb.Command): """Output kernel config to the filename specified as the command argument. Equivalent to 'zcat /proc/config.gz > config.txt' on a running target""" ...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/config.py
# # gdb helper commands and functions for Linux kernel debugging # # kernel log buffer dump # # Copyright (c) Siemens AG, 2011, 2012 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb import sys from linux import utils printk_info_typ...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/dmesg.py
# # gdb helper commands and functions for Linux kernel debugging # # Kernel proc information reader # # Copyright (c) 2016 Linaro Ltd # # Authors: # Kieran Bingham <kieran.bingham@linaro.org> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import constants from linux impor...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/proc.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright 2019 Google LLC. import gdb from linux import utils rb_root_type = utils.CachedType("struct rb_root") rb_node_type = utils.CachedType("struct rb_node") def rb_first(root): if root.type == rb_root_type.get_type(): node = root.address.cast(rb_root_type.get...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/rbtree.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (c) NXP 2019 import gdb from linux.utils import CachedType from linux.utils import container_of from linux.lists import list_for_each_entry device_private_type = CachedType('struct device_private') device_type = CachedType('struct device') subsys_private_type = Cach...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/device.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (c) NXP 2019 import gdb import sys from linux import utils, lists, constants clk_core_type = utils.CachedType("struct clk_core") def clk_core_for_each_child(hlist_head): return lists.hlist_for_each_entry(hlist_head, clk_core_type.get_type().pointer()...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/clk.py
# # gdb helper commands and functions for Linux kernel debugging # # per-cpu tools # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import tasks, utils task_type = utils.CachedType...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/cpus.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright 2019 Google LLC. import binascii import gdb from linux import constants from linux import cpus from linux import rbtree from linux import utils timerqueue_node_type = utils.CachedType("struct timerqueue_node").get_type() hrtimer_type = utils.CachedType("struct hrtimer...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/timerlist.py
# nothing to do for the initialization of this package
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/__init__.py
# # gdb helper commands and functions for Linux kernel debugging # # load kernel and module symbols # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb import os import re from linux import module...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/symbols.py
# # gdb helper commands and functions for Linux kernel debugging # # common utilities # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb class CachedType: def __init__(self, name): s...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/utils.py
# # gdb helper commands and functions for Linux kernel debugging # # module tools # # Copyright (c) Siemens AG, 2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import cpus, utils, lists module_type = utils.CachedTy...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/modules.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (c) NXP 2019 import gdb import sys from linux.utils import CachedType, gdb_eval_or_none from linux.lists import list_for_each_entry generic_pm_domain_type = CachedType('struct generic_pm_domain') pm_domain_data_type = CachedType('struct pm_domain_data') device_link_ty...
grace-kernel-grace-kernel-6.1.y
scripts/gdb/linux/genpd.py
# SPDX-License-Identifier: GPL-2.0 # # Copyright (C) 2018 Masahiro Yamada <yamada.masahiro@socionext.com> # """ Kconfig unit testing framework. This provides fixture functions commonly used from test files. """ import os import pytest import shutil import subprocess import tempfile CONF_PATH = os.path.abspath(os.pa...
grace-kernel-grace-kernel-6.1.y
scripts/kconfig/tests/conftest.py
# SPDX-License-Identifier: GPL-2.0 """ Do not affect user-assigned choice value by another choice. Handling of state flags for choices is complecated. In old days, the defconfig result of a choice could be affected by another choice if those choices interact by 'depends on', 'select', etc. Related Linux commit: fbe9...
grace-kernel-grace-kernel-6.1.y
scripts/kconfig/tests/inter_choice/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Create submenu for symbols that depend on the preceding one. If a symbols has dependency on the preceding symbol, the menu entry should become the submenu of the preceding one, and displayed with deeper indentation. """ def test(conf): assert conf.oldaskconfig() == 0 as...
grace-kernel-grace-kernel-6.1.y
scripts/kconfig/tests/auto_submenu/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Escape sequence tests. """ def test(conf): assert conf.oldaskconfig() == 0 assert conf.stderr_matches('expected_stderr')
grace-kernel-grace-kernel-6.1.y
scripts/kconfig/tests/preprocess/escape/__init__.py
# SPDX-License-Identifier: GPL-2.0 """ Variable and user-defined function tests. """ def test(conf): assert conf.oldaskconfig() == 0 assert conf.stderr_matches('expected_stderr')
grace-kernel-grace-kernel-6.1.y
scripts/kconfig/tests/preprocess/variable/__init__.py