Core Types

These types are used across the main Amphimixis modules and are the primary targets for cross-references from function and method signatures.

The common module that is used in most other modules

class Arch(*values)

Bases: StrEnum

Supported architectures

X86 = 'x86'
RISCV = 'riscv'
ARM = 'arm'
class ProfileStats(build_name: str | None = None, executable: str | None = None, executable_run_success: bool | None = None, real_time: str | None = None, user_time: str | None = None, kernel_time: str | None = None, perf_stat: str | None = None, perf_record_name: str | None = None, perf_script_name: str | None = None, perf_archive_name: str | None = None)

Bases: object

Profiling and execution statistics for an executable

Variables:
  • build_name (str | None) – Name of the build.

  • executable (str | None) – Path to the executable file (relative to build dir).

  • executable_run_success (bool | None) – Whether the executable finished successfully.

  • real_time (str | None) – Wall-clock (real) execution time.

  • user_time (str | None) – CPU time spent in user mode.

  • kernel_time (str | None) – CPU time spent in kernel mode.

  • perf_stat (str | None) – Output of perf stat command.

  • perf_record_name (str | None) – Filename of the recorded perf record data.

  • perf_script_name (str | None) – Filename of the processed perf script output.

  • perf_script_name – Filename of the archive gathered using perf archive.

Parameters:
  • build_name (str | None)

  • executable (str | None)

  • executable_run_success (bool | None)

  • real_time (str | None)

  • user_time (str | None)

  • kernel_time (str | None)

  • perf_stat (str | None)

  • perf_record_name (str | None)

  • perf_script_name (str | None)

  • perf_archive_name (str | None)

build_name: str | None = None
executable: str | None = None
executable_run_success: bool | None = None
real_time: str | None = None
user_time: str | None = None
kernel_time: str | None = None
perf_stat: str | None = None
perf_record_name: str | None = None
perf_script_name: str | None = None
perf_archive_name: str | None = None
class MachineAuthenticationInfo(username: str, password: str | None, port: int)

Bases: object

Information about authentication on a remote machine

Variables:
  • username (str) – Username for authentication.

  • password (str | None) – Password for authentication.

Parameters:
  • username (str)

  • password (str | None)

  • port (int)

Password can be set to None if an SSH agent is used.

Variables:

port (int) – Port number for the SSH connection.

Parameters:
  • username (str)

  • password (str | None)

  • port (int)

username: str
password: str | None
port: int
class MachineInfo(arch: Arch, address: str | None, auth: MachineAuthenticationInfo | None)

Bases: object

Information about the machine

Variables:
  • arch (Arch) – Architecture of the machine.

  • address (str | None) – IP address or hostname of the remote machine.

Parameters:

If address is None, the machine is considered to be local.

Variables:

auth (MachineAuthenticationInfo) – Authentication info for the machine.

Parameters:
arch: Arch
address: str | None
auth: MachineAuthenticationInfo | None
class CompilerFlagsAttrs(*values)

Bases: StrEnum

Enumeration for getting access to flags of concrete compiler

C_FLAGS = 'c_flags'
CXX_FLAGS = 'cxx_flags'
CSHARP_FLAGS = 'csharp_flags'
CUDA_FLAGS = 'cuda_flags'
OBJC_FLAGS = 'objc_flags'
OBJCXX_FLAGS = 'objcxx_flags'
FORTRAN_FLAGS = 'fortran_flags'
HIP_FLAGS = 'hip_flags'
ISPC_FLAGS = 'ispc_flags'
SWIFT_FLAGS = 'swift_flags'
ASM_FLAGS = 'asm_flags'
ASM_NASM_FLAGS = 'asm_nasm_flags'
ASM_MARMASM_FLAGS = 'asm_marmasm_flags'
ASM_MASM_FLAGS = 'asm_masm_flags'
ASM_ATT_FLAGS = 'asm_att_flags'
class ToolchainAttrs(*values)

Bases: StrEnum

Constants for getting access to attributes from toolchain dictionary

AR_T = 'ar'
AS_T = 'as'
LD_T = 'ld'
NM_T = 'nm'
OBJCOPY_T = 'objcopy'
OBJDUMP_T = 'objdump'
RANLIB_T = 'ranlib'
READELF_T = 'readelf'
STRIP_T = 'strip'
C_COMPILER = 'c_compiler'
CXX_COMPILER = 'cxx_compiler'
CSHARP_COMPILER = 'csharp_compiler'
CUDA_COMPILER = 'cuda_compiler'
OBJC_COMPILER = 'objc_compiler'
OBJCXX_COMPILER = 'objcxx_compiler'
FORTRAN_COMPILER = 'fortran_compiler'
HIP_COMPILER = 'hip_compiler'
ISPC_COMPILER = 'ispc_compiler'
SWIFT_COMPILER = 'swift_compiler'
ASM_COMPILER = 'asm_compiler'
ASM_NASM_COMPILER = 'asm_nasm_compiler'
ASM_MARMASM_COMPILER = 'asm_marmasm_compiler'
ASM_MASM_COMPILER = 'asm_masm_compiler'
ASM_ATT_COMPILER = 'asm_att_compiler'
class Toolchain(name: str | None = None, sysroot: str | None = None)

Bases: object

Class that generalized idea of toolchain

Parameters:
  • name (str | None)

  • sysroot (str | None)

property name: str | None

Name of toolchain getter

property sysroot: str | None

Sysroot of toolchain getter

get(attr: ToolchainAttrs | CompilerFlagsAttrs) str | None

Getter of toolchain attributes

Parameters:

attr (ToolchainAttrs | CompilerFlagsAttrs)

Return type:

str | None

set(attr: ToolchainAttrs | CompilerFlagsAttrs, new_value: str) None

Setter of toolchain attributes

Parameters:
Return type:

None

property data: dict[str, str]

Return dictionary with all tools

class CompilerFlags

Bases: object

Storing flags of compilers

get(attr: CompilerFlagsAttrs) str | None

Getter of compiler flags

Parameters:

attr (CompilerFlagsAttrs)

Return type:

str | None

set(attr: CompilerFlagsAttrs, new_value: str) None

Setter of compiler flags

Parameters:
Return type:

None

property data: dict[CompilerFlagsAttrs, str]

Return dictionary with all tools

class IUI

Bases: ABC

Interface for User Interface (UI) classes

abstractmethod step() None

Advance the progress counter by one step.

Return type:

None

abstractmethod send_message(sender: str, message: str) None

Send message to user

Parameters:
  • sender (str) – Identifier name of sender module

  • message (str) – Message to user

Return type:

None

abstractmethod send_warning(sender: str, warning: str) None

Send warning to user

Parameters:
  • sender (str) – Identifier name of sender module

  • warning (str) – Warning to user

Return type:

None

send_error(sender: str, err_msg: str) None

Send error message to user

Parameters:
  • sender (str) – Identifier name of sender module

  • error (str) – Error message to user

  • err_msg (str)

Return type:

None

abstractmethod update_message(build_id: str, message: str) None

Update message for specific build

Parameters:
  • build_id (str) – Build identifier

  • message (str) – Message to store

Return type:

None

abstractmethod mark_success(message: str = '', build_id: str = '') None

Mark build as successful.

Parameters:
  • message (str) – Optional message

  • build_id (str) – Build identifier

Return type:

None

abstractmethod mark_failed(error_message: str = '', build_id: str = '') None

Mark build as failed.

Parameters:
  • error_message (str) – Optional error message

  • build_id (str) – Build identifier

Return type:

None

class NullUI

Bases: IUI

A UI implementation that does nothing (used to suppress output)

step() None

Advance the progress counter by one step.

Return type:

None

send_message(sender: str, message: str) None

Send message to user

Parameters:
  • sender (str) – Identifier name of sender module

  • message (str) – Message to user

Return type:

None

send_warning(sender: str, warning: str) None

Send warning to user

Parameters:
  • sender (str) – Identifier name of sender module

  • warning (str) – Warning to user

Return type:

None

send_error(sender: str, err_msg: str) None

Send error message to user

Parameters:
  • sender (str) – Identifier name of sender module

  • error (str) – Error message to user

  • err_msg (str)

Return type:

None

update_message(build_id: str, message: str) None

Update message for specific build

Parameters:
  • build_id (str) – Build identifier

  • message (str) – Message to store

Return type:

None

mark_success(message: str = '', build_id: str = '') None

Mark build as successful.

Parameters:
  • message (str) – Optional message

  • build_id (str) – Build identifier

Return type:

None

mark_failed(error_message: str = '', build_id: str = '') None

Mark build as failed.

Parameters:
  • error_message (str) – Optional error message

  • build_id (str) – Build identifier

Return type:

None

class ILowLevelBuildSystem(project: Project, ui: IUI = NullUI())

Bases: ABC

Interface for classes implementing interaction with runner (low-level build-system)

Parameters:
abstractmethod run_building(build: Build) tuple[int, str, str]

Run building via build system

Parameters:

build (Build)

Return type:

tuple[int, str, str]

class IHighLevelBuildSystem(project: Project, runner: ILowLevelBuildSystem, ui: IUI = NullUI())

Bases: ABC

Interface for classes implementing interaction with build system (high-level build-system)

Parameters:
abstractmethod build(build: Build) tuple[int, str, str]

Build via build system

Parameters:

build (Build)

Return type:

tuple[int, str, str]

class DummyRunner

Bases: ILowLevelBuildSystem

Runner that does nothing

run_building(build: Build) tuple[int, str, str]

Run building via build system

Parameters:

build (Build)

Return type:

tuple[int, str, str]

class DummyBuildSystem

Bases: IHighLevelBuildSystem

Build system that does nothing

build(build: Build) tuple[int, str, str]

Build via build system

Parameters:

build (Build)

Return type:

tuple[int, str, str]

class BuildSystem(project: Project, runner: ILowLevelBuildSystem = DummyRunner(), ui: IUI = NullUI())

Bases: object

Common class for build systems

Parameters:
find_relative_path(file_name: str) str

Find first directory that contains ‘file_name’ relative to project root. :param str file_name: Name of file to search relative to project root. :rtype: str :return: Path to directory that contains file relative to project root

Parameters:

file_name (str)

Return type:

str

class Build(build_machine: MachineInfo, run_machine: MachineInfo, build_name: str, executables: list[str], toolchain: Toolchain | None, sysroot: str | None, compiler_flags: CompilerFlags | None, config_flags: None | str, jobs: None | int = None, successfully_built: bool = True)

Bases: object

Class with information about one build of project

Variables:
  • build_machine (MachineInfo) – Information about the machine to build at

  • run_machine (MachineInfo) – Information about the machine to profile at

  • build_name (str) – Unique name of the build

  • toolchain (Toolchain | None) – Toolchain used to building

  • sysroot (str | None) – Path to sysroot or name of sysroot used to building

  • executables (list[str]) – List of relative to build path paths to executables

  • compiler_flags (str) – Compiler flags for the build

  • jobs (None | int) – Number of building jobs

  • successfully_built (bool) – Flag of completness of build

Parameters:
build_machine: MachineInfo
run_machine: MachineInfo
build_name: str
executables: list[str]
toolchain: Toolchain | None
sysroot: str | None
compiler_flags: CompilerFlags | None
config_flags: None | str
jobs: None | int = None
successfully_built: bool = True
class Project(path: str, builds: list[Build] | None = None, build_system: IHighLevelBuildSystem = DummyBuildSystem())

Bases: object

Class with information about project and his builds

Variables:
  • path (str) – Path to project for research.

  • builds (list[Build]) – List of project configurations to be build.

  • build_system (IHighLevelBuildSystem) – High-level build system.

Parameters:
path: str
builds: list[Build]