Showing preview only (972K chars total). Download the full file or copy to clipboard to get everything.
Repository: Syllo/nvtop
Branch: master
Commit: 76890233d759
Files: 97
Total size: 933.4 KB
Directory structure:
gitextract_spmzcg02/
├── .clang-format
├── .github/
│ └── workflows/
│ └── compile.yml
├── .gitignore
├── AppImage/
│ ├── README.md
│ └── make_appimage.sh
├── CMakeLists.txt
├── COPYING
├── Dockerfile
├── README.markdown
├── cmake/
│ ├── cmake_uninstall.cmake.in
│ ├── compile-flags-helpers.cmake
│ ├── modules/
│ │ ├── FindASan.cmake
│ │ ├── FindCurses.cmake
│ │ ├── FindLibdrm.cmake
│ │ ├── FindMSan.cmake
│ │ ├── FindSanitizers.cmake
│ │ ├── FindSystemd.cmake
│ │ ├── FindTSan.cmake
│ │ ├── FindUBSan.cmake
│ │ ├── FindUDev.cmake
│ │ ├── asan-wrapper
│ │ └── sanitize-helpers.cmake
│ └── optimization_flags.cmake
├── desktop/
│ ├── nvtop.desktop
│ └── nvtop.metainfo.xml.in
├── include/
│ ├── ascend/
│ │ └── dcmi_interface_api.h
│ ├── ini.h
│ ├── libdrm/
│ │ └── xe_drm.h
│ ├── list.h
│ ├── nvtop/
│ │ ├── common.h
│ │ ├── device_discovery.h
│ │ ├── extract_gpuinfo.h
│ │ ├── extract_gpuinfo_common.h
│ │ ├── extract_processinfo_fdinfo.h
│ │ ├── get_process_info.h
│ │ ├── info_messages.h
│ │ ├── interface.h
│ │ ├── interface_common.h
│ │ ├── interface_internal_common.h
│ │ ├── interface_layout_selection.h
│ │ ├── interface_options.h
│ │ ├── interface_ring_buffer.h
│ │ ├── interface_setup_win.h
│ │ ├── plot.h
│ │ ├── time.h
│ │ └── version.h.in
│ └── uthash.h
├── manpage/
│ └── nvtop.in
├── snap/
│ └── snapcraft.yaml
├── src/
│ ├── CMakeLists.txt
│ ├── amdgpu_ids.h
│ ├── device_discovery_linux.c
│ ├── extract_gcuinfo_enflame.c
│ ├── extract_gpuinfo.c
│ ├── extract_gpuinfo_amdgpu.c
│ ├── extract_gpuinfo_amdgpu_utils.c
│ ├── extract_gpuinfo_apple.m
│ ├── extract_gpuinfo_ascend.c
│ ├── extract_gpuinfo_intel.c
│ ├── extract_gpuinfo_intel.h
│ ├── extract_gpuinfo_intel_i915.c
│ ├── extract_gpuinfo_intel_xe.c
│ ├── extract_gpuinfo_mali_common.c
│ ├── extract_gpuinfo_metax.c
│ ├── extract_gpuinfo_msm.c
│ ├── extract_gpuinfo_msm_utils.c
│ ├── extract_gpuinfo_nvidia.c
│ ├── extract_gpuinfo_panfrost.c
│ ├── extract_gpuinfo_panfrost_utils.c
│ ├── extract_gpuinfo_panthor.c
│ ├── extract_gpuinfo_panthor_utils.c
│ ├── extract_gpuinfo_tpu.c
│ ├── extract_gpuinfo_v3d.c
│ ├── extract_gpuinfo_v3d_utils.c
│ ├── extract_npuinfo_rockchip.c
│ ├── extract_processinfo_fdinfo.c
│ ├── extract_processinfo_mac.c
│ ├── get_process_info_linux.c
│ ├── get_process_info_mac.c
│ ├── info_messages_linux.c
│ ├── info_messages_mac.c
│ ├── ini.c
│ ├── interface.c
│ ├── interface_layout_selection.c
│ ├── interface_options.c
│ ├── interface_ring_buffer.c
│ ├── interface_setup_win.c
│ ├── mali_common.h
│ ├── nvtop.c
│ ├── panfrost_drm.h
│ ├── panfrost_utils.h
│ ├── panthor_drm.h
│ ├── panthor_utils.h
│ ├── plot.c
│ └── time.c
└── tests/
├── CMakeLists.txt
└── interfaceTests.cpp
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-format
================================================
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
================================================
FILE: .github/workflows/compile.yml
================================================
name: Compile Ubuntu
on:
- push
- pull_request
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04, ubuntu-22.04]
env:
BUILD_DIR: build
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y libncurses5-dev libncursesw5-dev libdrm-dev libsystemd-dev
- name: Configure CMake
run: cmake -S . -B $BUILD_DIR
- name: Build
run: cmake --build $BUILD_DIR
- name: Install
run: DESTDIR="$PWD/build/install" cmake --build $BUILD_DIR --target install
- name: Upload
uses: actions/upload-artifact@v4
with:
name: nvtop ${{ matrix.os }}
path: ${{ env.BUILD_DIR }}/install
================================================
FILE: .gitignore
================================================
*.o
*ctags
build/
cmake-build*/
.vscode
.idea
================================================
FILE: AppImage/README.md
================================================
# Build the AppImage
```bash
podman pull ubuntu:18.04
podman run --interactive --tty --rm --volume $PWD:/nvtop ubuntu:24.04
cd nvtop
./AppImage/make_appimage.sh
```
================================================
FILE: AppImage/make_appimage.sh
================================================
#!/usr/bin/env bash
export ARCH="$(uname -m)"
export APPIMAGE_EXTRACT_AND_RUN=1
APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage"
install_deps() {
apt-get update
apt-get install -y gcc g++ cmake libncurses5-dev libncursesw5-dev libdrm-dev \
wget file libudev-dev ninja-build cmake file desktop-file-utils
}
configure_nvtop() {
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \
-DUSE_LIBUDEV_OVER_LIBSYSTEMD=ON -DCMAKE_INSTALL_PREFIX=/usr
}
build_nvtop() {
cmake --build build
}
install_nvtop_AppDir() {
DESTDIR=$PWD/AppDir cmake --build build --target install
}
bundle_dependencies() {
mkdir -p AppDir/usr/lib
ldd AppDir/usr/bin/nvtop | awk -F"[> ]" '{print $4}' \
| xargs -I {} cp -vf {} AppDir/usr/lib
cp -v /lib64/ld-linux-x86-64.so.2 AppDir
}
configure_appdir() {
cat >> AppDir/AppRun <<- 'EOF'
#!/bin/sh
HERE="$(readlink -f "$(dirname "$0")")"
exec "$HERE/ld-linux-x86-64.so.2" \
--library-path "$HERE/usr/lib" "$HERE"/usr/bin/nvtop "$@"
EOF
chmod u+x AppDir/AppRun
ln -s usr/share/applications/nvtop.desktop AppDir
ln -s usr/share/icons/nvtop.svg AppDir
ln -s usr/share/icons/nvtop.svg AppDir/.DirIcon
}
get_appimagetool() {
wget -q "$APPIMAGETOOL" -O ./appimagetool
chmod u+x ./appimagetool
}
create_AppImage() {
install_deps
configure_nvtop
build_nvtop
install_nvtop_AppDir
bundle_dependencies
configure_appdir
get_appimagetool
export VERSION="$(./AppDir/AppRun --version | awk '{print $NF}')"
./appimagetool -n AppDir
}
create_AppImage
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.18)
#///////////////////////////////////////////////////////////////////#
# PROJECT #
#///////////////////////////////////////////////////////////////////#
project(nvtop VERSION 3.3.2
LANGUAGES C CXX)
set(default_build_type "Release")
# Default build type
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#///////////////////////////////////////////////////////////////////#
# DEPENDENCIES #
#///////////////////////////////////////////////////////////////////#
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CURSES_NEED_NCURSES TRUE)
# Try to find ncurses with unicode support first
set(CURSES_NEED_WIDE TRUE)
find_package(Curses QUIET)
if (NOT CURSE_FOUND)
# Fallback to regular ncurses library, which may also support unicode!
set(CURSES_NEED_WIDE FALSE)
find_package(Curses REQUIRED)
endif()
add_library(ncurses INTERFACE IMPORTED)
set_property(TARGET ncurses PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${CURSES_INCLUDE_DIRS})
set_property(TARGET ncurses PROPERTY
INTERFACE_LINK_LIBRARIES ${CURSES_LIBRARIES})
add_compile_definitions(NCURSES_ENABLE_STDBOOL_H=1)
#///////////////////////////////////////////////////////////////////#
# COMPILATION OPTIONS #
#///////////////////////////////////////////////////////////////////#
# Use full RPATH on build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# Do not build with install RPATH
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# Set the RPATH when install
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Only set RPATH if the installation directory is not a system directory
LIST(FIND
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
else()
set(CMAKE_INSTALL_RPATH "")
endif()
if(APPLE)
set(APPLE_SUPPORT_DEFAULT ON)
set(NVIDIA_SUPPORT_DEFAULT OFF)
set(AMDGPU_SUPPORT_DEFAULT OFF)
set(INTEL_SUPPORT_DEFAULT OFF)
set(MSM_SUPPORT_DEFAULT OFF)
set(PANFROST_SUPPORT_DEFAULT OFF)
set(PANTHOR_SUPPORT_DEFAULT OFF)
set(ASCEND_SUPPORT_DEFAULT OFF)
set(METAX_SUPPORT_DEFAULT OFF)
elseif(ASCEND_SUPPORT)
set(APPLE_SUPPORT_DEFAULT OFF)
set(NVIDIA_SUPPORT_DEFAULT OFF)
set(AMDGPU_SUPPORT_DEFAULT OFF)
set(INTEL_SUPPORT_DEFAULT OFF)
set(MSM_SUPPORT_DEFAULT OFF)
set(PANFROST_SUPPORT_DEFAULT OFF)
set(PANTHOR_SUPPORT_DEFAULT OFF)
set(ASCEND_SUPPORT_DEFAULT ON)
set(METAX_SUPPORT_DEFAULT OFF)
else()
set(APPLE_SUPPORT_DEFAULT OFF)
set(NVIDIA_SUPPORT_DEFAULT ON)
set(AMDGPU_SUPPORT_DEFAULT ON)
set(INTEL_SUPPORT_DEFAULT ON)
set(V3D_SUPPORT_DEFAULT ON)
set(MSM_SUPPORT_DEFAULT ON)
set(PANFROST_SUPPORT_DEFAULT ON)
set(PANTHOR_SUPPORT_DEFAULT ON)
set(ASCEND_SUPPORT_DEFAULT OFF)
set(METAX_SUPPORT_DEFAULT ON)
endif()
# TPU and Enflame GCU support is only available on Linux
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Check for libtpuinfo.so to set the default for TPU support
find_library(LIBTPUINFO
NAMES libtpuinfo.so
PATHS /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64
HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 lib lib64
)
if (NOT LIBTPUINFO)
set(TPU_SUPPORT_DEFAULT OFF)
else()
set(TPU_SUPPORT_DEFAULT ON)
endif()
set(ENFLAME_SUPPORT_DEFAULT ON)
else()
set(TPU_SUPPORT_DEFAULT OFF)
set(ENFLAME_SUPPORT_DEFAULT OFF)
endif()
# Rockchip support is only available on Linux on arm
# Enable Rockchip support only on ARM Linux
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64"))
set(ROCKCHIP_SUPPORT_DEFAULT ON)
else()
set(ROCKCHIP_SUPPORT_DEFAULT OFF)
endif()
option(NVIDIA_SUPPORT "Build support for NVIDIA GPUs through libnvml" ${NVIDIA_SUPPORT_DEFAULT})
option(AMDGPU_SUPPORT "Build support for AMD GPUs through amdgpu driver" ${AMDGPU_SUPPORT_DEFAULT})
option(INTEL_SUPPORT "Build support for Intel GPUs through i915 or xe driver" ${INTEL_SUPPORT_DEFAULT})
option(MSM_SUPPORT "Build support for Adreno GPUs through msm driver" ${MSM_SUPPORT_DEFAULT})
option(APPLE_SUPPORT "Build support for Apple GPUs through Metal" ${APPLE_SUPPORT_DEFAULT})
option(PANFROST_SUPPORT "Build support for Mali GPUs through panfrost driver" ${PANFROST_SUPPORT_DEFAULT})
option(PANTHOR_SUPPORT "Build support for Mali GPUs through panthor driver" ${PANTHOR_SUPPORT_DEFAULT})
option(ASCEND_SUPPORT "Build support for Ascend NPUs through Ascend DCMI" ${ASCEND_SUPPORT_DEFAULT})
option(V3D_SUPPORT "Build support for Raspberrypi through v3d" ${V3D_SUPPORT_DEFAULT})
option(TPU_SUPPORT "Build support for Google TPUs through GRPC" ${TPU_SUPPORT_DEFAULT})
option(ROCKCHIP_SUPPORT "Enable support for Rockchip NPU" ${ROCKCHIP_SUPPORT_DEFAULT})
option(METAX_SUPPORT "Build support for MetaX GPUs through libmxsml" ${METAX_SUPPORT_DEFAULT})
option(ENFLAME_SUPPORT "Build support for Enflame GCUs through libefml" ${ENFLAME_SUPPORT_DEFAULT})
add_subdirectory(src)
#///////////////////////////////////////////////////////////////////#
# INSTALL #
#///////////////////////////////////////////////////////////////////#
string(TIMESTAMP TODAY_MANPAGE "%B %Y")
string(TIMESTAMP TODAY_ISO_8601 "%Y-%m-%d")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/manpage/nvtop.in"
"${CMAKE_CURRENT_BINARY_DIR}/manpage/nvtop"
IMMEDIATE @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/desktop/nvtop.metainfo.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/desktop/io.github.syllo.nvtop.metainfo.xml"
IMMEDIATE @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/manpage/nvtop"
DESTINATION share/man/man1/
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
RENAME nvtop.1)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/desktop/nvtop.svg"
DESTINATION share/icons/hicolor/scalable/apps
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/desktop/nvtop.desktop"
DESTINATION share/applications
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/desktop/io.github.syllo.nvtop.metainfo.xml"
DESTINATION share/metainfo
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
#///////////////////////////////////////////////////////////////////#
# TESTING #
#///////////////////////////////////////////////////////////////////#
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
option(BUILD_TESTING "Build tests" OFF)
endif()
include(CTest)
add_subdirectory(tests)
================================================
FILE: COPYING
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
================================================
FILE: Dockerfile
================================================
# BUILD: docker build . -t nvtop
# or use other image with: --build-arg IMAGE=nvcr.io/nvidia/cudagl:11.4.2-base-ubuntu20.04
# or nvidia/driver:418.87.01-ubuntu18.04, nvcr.io/nvidia/cudagl:11.4.2-base-ubuntu20.04
# USE: docker run --rm -it --gpus all --pid host nvtop
ARG IMAGE=nvidia/opengl:1.2-glvnd-runtime-ubuntu20.04
FROM ${IMAGE} as builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -yq build-essential wget libncurses5-dev libncursesw5-dev libssl-dev \
pkg-config libdrm-dev libgtest-dev libudev-dev python3-venv
# Get a recent-enough CMake
RUN python3 -m venv /.venv && \
. /.venv/bin/activate && \
pip install --upgrade pip && \
pip install cmake
COPY . /nvtop
WORKDIR /nvtop
RUN mkdir -p /nvtop/build && \
cd /nvtop/build && \
. /.venv/bin/activate && \
cmake .. && \
make -j && \
make install
# Stage 2
FROM ${IMAGE}
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && apt-get install -yq libncurses5 libncursesw5 libdrm-amdgpu1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/nvtop /usr/local/bin/nvtop
COPY --from=builder /usr/local/share/man/man1/nvtop.1 /usr/local/share/man/man1/nvtop.1
ENV LANG=C.UTF-8
ENTRYPOINT [ "/usr/local/bin/nvtop" ]
================================================
FILE: README.markdown
================================================
NVTOP
=====
What is NVTOP?
--------------
NVTOP stands for Neat Videocard TOP, a (h)top like task monitor for GPUs and
accelerators. It can handle multiple GPUs and print information about them in a
htop-familiar way.
Currently supported vendors are AMD (Linux amdgpu driver), Apple (limited M1 &
M2 support), Huawei (Ascend), Intel (Linux i915/Xe drivers), NVIDIA (Linux
proprietary divers), Qualcomm Adreno (Linux MSM driver), Broadcom VideoCore (Linux v3d driver),
Rockchip, MetaX (MXSML driver), Enflame (Linux EFML driver).
Because a picture is worth a thousand words:

Table of Contents
-----------------
- [NVTOP Options and Interactive Commands](#nvtop-options-and-interactive-commands)
- [Interactive Setup Window](#interactive-setup-window)
- [Saving Preferences](#saving-preferences)
- [NVTOP Manual and Command line Options](#nvtop-manual-and-command-line-options)
- [GPU Support](#gpu-support)
- [AMD](#amd)
- [Intel](#intel)
- [NVIDIA](#nvidia)
- [Adreno](#adreno)
- [Apple](#apple)
- [Ascend](#ascend) (only tested on 910B)
- [VideoCore](#videocore)
- [Rockchip](#rockchip)
- [MetaX](#metax)
- [Enflame](#enflame)
- [Build](#build)
- [Distribution Specific Installation Process](#distribution-specific-installation-process)
- [Ubuntu / Debian](#ubuntu--debian)
- [Ubuntu Impish (21.10) / Debian buster (stable) and more recent (stable)](#ubuntu-impish-2110-debian-buster-stable-and-more-recent)
- [Fedora / Red Hat / CentOS](#fedora--red-hat--centos)
- [OpenSUSE](#opensuse)
- [Arch Linux](#arch-linux)
- [Gentoo](#gentoo)
- [AppImage](#appimage)
- [Snap](#snap)
- [Conda-forge](#conda-forge)
- [Docker](#docker)
- [NVTOP Build](#nvtop-build)
- [Troubleshoot](#troubleshoot)
- [License](#license)
NVTOP Options and Interactive Commands
--------------------------------------
### Interactive Setup Window
NVTOP has a builtin setup utility that provides a way to specialize the interface to your needs.
Simply press ``F2`` and select the options that are the best for you.

### Saving Preferences
You can save the preferences set in the setup window by pressing ``F12``.
The preferences will be loaded the next time you run ``nvtop``.
### NVTOP Manual and Command line Options
NVTOP comes with a manpage!
```bash
man nvtop
```
For quick command line arguments help
```bash
nvtop -h
nvtop --help
```
GPU Support
-----------
### AMD
NVTOP supports AMD GPUs using the `amdgpu` driver through the exposed DRM and
sysfs interface.
AMD introduced the fdinfo interface in kernel 5.14 ([browse kernel
source](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c?h=linux-5.14.y)).
Hence, you will need a kernel with a version greater or equal to 5.14 to see the
processes using AMD GPUs.
Support for recent GPUs are regularly mainlined into the linux kernel, so please
use a recent-enough kernel for your GPU.
### Intel
NVTOP supports Intel GPUs using the `i915` or `xe` linux driver.
Intel introduced the fdinfo interface in kernel 5.19 ([browse kernel
source](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpu/drm/i915/i915_drm_client.c?h=linux-5.19.y)).
Hence, you will need a kernel with a version greater or equal to 5.19 to see the
processes using Intel GPUs.
Intel requires CAP_PERFMON or CAP_SYS_ADMIN capabilities to access the total memory usage,
you can run `sudo setcap cap_perfmon=ep nvtop` to grant the necessary permissions or run nvtop as root.
### NVIDIA
The *NVML library* does not support some of the queries for GPUs coming before the
Kepler microarchitecture. Anything starting at GeForce 600, GeForce 800M and
successor should work fine. For more information about supported GPUs please
take a look at the [NVML documentation](http://docs.nvidia.com/deploy/nvml-api/nvml-api-reference.html#nvml-api-reference).
### Adreno
NVTOP supports Adreno GPUs using the `msm` linux driver.
msm introduced the fdinfo interface in kernel 6.0 ([browse kernel
source](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpu/drm/msm/msm_drv.c?h=linux-6.0.y)).
Hence, you will need a kernel with a version greater or equal to 6.0 to see the
processes using Adreno GPUs.
### Apple
NVTOP includes some initial support for Apple using Metal. This is only supported when building for Apple, and when building for Apple only this vendor is supported.
**APPLE SUPPORT STATUS**
- Apple support is still being worked on. Some bugs and limitations may apply.
### Ascend
NVTOP supports Ascend (testing on Altas 800 (910B)) by DCMI API (version 6.0.0).
Currently, the DCMI only supports limited APIs, missing PCIe generation, tx/rx throughput info, max power draw etc.
### VideoCore
NVTOP supports VideoCore (testing on raspberrypi 4B).
Supports GPU frequency, temperature, utilization, per-process utilization, GPU memory usage, and H264 decoding utilization.
On non-raspberry pi os, you need to use the `linux-rpi 6.12.y` kernel and above, and ensure the presence of the `/dev/vcio` device.
### Rockchip
NVTOP supports Rockchip (testing on orangepi 5 plus).
Supports NPU frequency, temperature, utilization.
### MetaX
NVTOP supports MetaX (testing on MXC500) by MXSML LIBRARY.
For more information about GPUs please take a look at the [METAX documentation](https://developer.metax-tech.com/doc/index)
### Enflame
NVTOP supports Enflame GCUs (testing on Enflame S60, Enflame L300 and Enflame L600) by EFML LIBRARY
GCU, which refers to General Compute Unit, is a type of accelerator card that is used to perform general-purpose computing tasks just like GPGPU.
Build
-----
Several libraries are required in order for NVTOP to display GPU info:
* The *ncurses* library driving the user interface.
* This makes the screen look beautiful.
* For NVIDIA: the *NVIDIA Management Library* (*NVML*) which comes with the GPU driver.
* This queries the GPU for info.
* For AMD: the libdrm library used to query AMD GPUs through the kernel driver.
* For METAX: the *MetaX System Management Library* (*MXSML*) which comes with the GPU driver.
* This queries the GPU for info.
* For Enflame: the *Enflame Management Library* (*EFML*) which comes with the GCU driver.
## Distribution Specific Installation Process
### Ubuntu / Debian
If your distribution provides the snap utility, follow the [snap installation process](#snap) to obtain an up-to-date version of `nvtop`.
A standalone application is available as [AppImage](#appimage).
#### Ubuntu Focal (20.04), Debian buster (stable) and more recent
```bash
sudo apt install nvtop
```
#### Ubuntu PPA
A [PPA supporting Ubuntu 20.04 and newer](https://launchpad.net/~quentiumyt/+archive/ubuntu/nvtop) is provided by
[Quentin Lienhardt](https://github.com/QuentiumYT) that offers an up-to-date version of `nvtop`, enabled for NVIDIA, AMD and Intel.
```bash
sudo add-apt-repository ppa:quentiumyt/nvtop
sudo apt install nvtop
```
#### Older
- AMD and Intel Dependencies
```bash
sudo apt install libdrm-dev libsystemd-dev
# Ubuntu 18.04
sudo apt install libudev-dev
```
- NVIDIA Dependency
- NVIDIA drivers (see [Ubuntu Wiki](https://help.ubuntu.com/community/BinaryDriverHowto/Nvidia) or [Ubuntu PPA](https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa) or [Debian Wiki](https://wiki.debian.org/NvidiaGraphicsDrivers#NVIDIA_Proprietary_Driver))
- NVTOP Dependencies
- CMake, ncurses and Git
```bash
sudo apt install cmake libncurses5-dev libncursesw5-dev git
```
- NVTOP
- Follow the [NVTOP Build](#nvtop-build)
### Fedora / Red Hat / CentOS
A standalone application is available as [AppImage](#appimage).
#### Fedora 36 and newer
- ```bash
sudo dnf install nvtop
```
#### Red Hat Enterprise Linux 8 and 9
- ```bash
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %{rhel}).noarch.rpm
sudo dnf install nvtop
```
#### CentOS Stream, Rocky Linux, AlmaLinux
- ```bash
sudo dnf install -y epel-release
sudo dnf install nvtop
```
#### Build process for Fedora / Red Hat / CentOS:
- AMD and Intel Dependencies
```bash
sudo dnf install libdrm-devel systemd-devel
```
- NVIDIA Dependency
- NVIDIA drivers, **CUDA required for nvml libraries** (see [RPM Fusion](https://rpmfusion.org/Howto/NVIDIA))
- NVTOP Dependencies
- CMake, ncurses, C++ and Git
```bash
sudo dnf install cmake ncurses-devel git gcc-c++
```
- NVTOP
- Follow the [NVTOP Build](#nvtop-build)
### OpenSUSE
A standalone application is available as an [AppImage](#appimage).
Build process for OpenSUSE:
- AMD Dependency
```bash
sudo zypper install libdrm-devel
```
- NVIDIA Dependency
- NVIDIA drivers (see [SUSE Support Database](https://en.opensuse.org/SDB:NVIDIA_drivers))
- NVTOP Dependencies
- CMake, ncurses and Git
```bash
sudo zypper install cmake ncurses-devel git
```
- NVTOP
- Follow the [NVTOP Build](#nvtop-build)
### Arch Linux
- ```bash
sudo pacman -S nvtop
```
### Gentoo
- ```bash
sudo emerge -av nvtop
```
### AppImage
An AppImage is a standalone application. Just download the AppImage, make it executable and run it!
- Go to the [release page](https://github.com/Syllo/nvtop/releases/latest) and download `nvtop-x86_64.AppImage`
- ```bash
# Go to the download location ** The path may differ on your system **
cd $HOME/Downloads
# Make the AppImage executable
chmod u+x nvtop-x86_64.AppImage
# Enjoy nvtop
./nvtop-x86_64.AppImage
```
If you are curious how that works, please visit the [AppImage website](https://appimage.org/).
### Snap
- ```bash
snap install nvtop
# Add the capability to kill processes inside nvtop
snap connect nvtop:process-control
# Add the capability to inspect GPU information (fan, PCIe, power, etc)
snap connect nvtop:hardware-observe
# AMDGPU process list support (read /proc/<pid>)
snap connect nvtop:system-observe
# Temporary workaround to get per-process GPU usage (read /proc/<pid>/fdinfo)
snap connect nvtop:kubernetes-support
```
Notice: The connect commands allow
### Conda-forge
A [conda-forge feedstock for `nvtop`](https://github.com/conda-forge/nvtop-feedstock) is available.
#### conda / mamba / miniforge
```bash
conda install --channel conda-forge nvtop
```
#### pixi
```bash
pixi global install nvtop
```
### Docker
- NVIDIA drivers (same as above)
- [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) (See [Container Toolkit Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker))
- ```bash
git clone https://github.com/Syllo/nvtop.git && cd nvtop
sudo docker build --tag nvtop .
sudo docker run -it --rm --runtime=nvidia --gpus=all --pid=host nvtop
```
## NVTOP Build
```bash
git clone https://github.com/Syllo/nvtop.git
mkdir -p nvtop/build && cd nvtop/build
cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON
make
# Install globally on the system
sudo make install
# Alternatively, install without privileges at a location of your choosing
# cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON -DINTEL_SUPPORT=ON -DCMAKE_INSTALL_PREFIX=/path/to/your/dir
# make
# make install
```
If you use **conda** as environment manager and encounter an error while building NVTOP, try `conda deactivate` before invoking `cmake`.
The build system supports multiple build types (e.g. -DCMAKE_BUILD_TYPE=RelWithDebInfo):
* Release: Binary without debug info
* RelWithDebInfo: Binary with debug info
* Debug: Compile with warning flags and address/undefined sanitizers enabled (for development purposes)
Troubleshoot
------------
- The plot looks bad:
- Verify that you installed the wide character version of the ncurses library (libncurses**w**5-dev for Debian / Ubuntu), clean the build directory and restart the build process.
- **Putty**: Tell putty not to lie about its capabilities (`$TERM`) by setting the field ``Terminal-type string`` to ``putty`` in the menu
``Connection > Data > Terminal Details``.
License
-------
NVTOP is licensed under the GPLv3 license or any later version.
You will find a copy of the license inside the COPYING file of the repository or
at the GNU website <[www.gnu.org/licenses/](http://www.gnu.org/licenses/)>.
================================================
FILE: cmake/cmake_uninstall.cmake.in
================================================
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR
"Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS
"File
$ENV{DESTDIR}${file}
does not
exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
================================================
FILE: cmake/compile-flags-helpers.cmake
================================================
include(CheckLinkerFlag)
function(add_compiler_option_to_target_type TARGET BUILDTYPE VISIBILITY OPTIONS)
include(CheckCCompilerFlag)
list(APPEND OPTIONS ${ARGN})
foreach(COMPILE_OPTION IN LISTS OPTIONS)
string(REPLACE "=" "-" COMPILE_OPTION_NAME "${COMPILE_OPTION}")
check_c_compiler_flag(${COMPILE_OPTION} "compiler_has${COMPILE_OPTION_NAME}")
if (${compiler_has${COMPILE_OPTION_NAME}})
target_compile_options(${TARGET} ${VISIBILITY}
$<$<CONFIG:${BUILDTYPE}>:${COMPILE_OPTION}>)
endif()
endforeach()
endfunction()
function(add_compiler_option_to_all_but_target_type TARGET BUILDTYPE VISIBILITY OPTIONS)
include(CheckCCompilerFlag)
list(APPEND OPTIONS ${ARGN})
foreach(COMPILE_OPTION IN LISTS OPTIONS)
string(REPLACE "=" "-" COMPILE_OPTION_NAME "${COMPILE_OPTION}")
check_c_compiler_flag(${COMPILE_OPTION} "compiler_has${COMPILE_OPTION_NAME}")
if (${compiler_has${COMPILE_OPTION_NAME}})
target_compile_options(${TARGET} ${VISIBILITY}
$<$<NOT:$<CONFIG:${BUILDTYPE}>>:${COMPILE_OPTION}>)
endif()
endforeach()
endfunction()
function(add_linker_option_to_target_type TARGET BUILDTYPE VISIBILITY OPTIONS)
include(CheckCCompilerFlag)
list(APPEND OPTIONS ${ARGN})
foreach(LINK_OPTION IN LISTS OPTIONS)
string(REPLACE "," "_" LINK_OPTION_NAME "${LINK_OPTION}")
check_linker_flag(C "${LINK_OPTION}" "linker_has${LINK_OPTION_NAME}")
if (${linker_has${LINK_OPTION_NAME}})
target_link_libraries(${TARGET} ${VISIBILITY}
$<$<CONFIG:${BUILDTYPE}>:${LINK_OPTION}>)
endif()
endforeach()
endfunction()
function(add_linker_option_to_all_but_target_type TARGET BUILDTYPE VISIBILITY OPTIONS)
include(CheckCCompilerFlag)
list(APPEND OPTIONS ${ARGN})
foreach(LINK_OPTION IN LISTS OPTIONS)
string(REPLACE "," "_" LINK_OPTION_NAME "${LINK_OPTION}")
check_linker_flag(C "${LINK_OPTION}" "linker_has${LINK_OPTION_NAME}")
if (${linker_has${LINK_OPTION_NAME}})
target_link_libraries(${TARGET} ${VISIBILITY}
$<$<NOT:$<CONFIG:${BUILDTYPE}>>:${LINK_OPTION}>)
endif()
endforeach()
endfunction()
function(add_sanitizers_to_target TARGET BUILDTYPE VISIBILITY SANITIZERS)
list(APPEND SANITIZERS ${ARGN})
foreach(SAN IN LISTS SANITIZERS)
set(CMAKE_REQUIRED_FLAGS "-fsanitize=${SAN}")
check_c_compiler_flag("-fsanitize=${SAN}" "sanitizer-${SAN}-available")
unset(CMAKE_REQUIRED_FLAGS)
if (${sanitizer-${SAN}-available})
list(APPEND AVAILABLE_SANITIZERS ${SAN})
endif()
endforeach()
foreach(SAN IN LISTS AVAILABLE_SANITIZERS)
target_compile_options(${TARGET} ${VISIBILITY} $<$<CONFIG:${BUILDTYPE}>:-fsanitize=${SAN}>)
target_link_libraries(${TARGET} ${VISIBILITY} $<$<CONFIG:${BUILDTYPE}>:-fsanitize=${SAN}>)
endforeach()
endfunction()
================================================
FILE: cmake/modules/FindASan.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)
set(FLAG_CANDIDATES
# Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
"-g -fsanitize=address -fno-omit-frame-pointer"
"-g -fsanitize=address"
# Older deprecated flag for ASan
"-g -faddress-sanitizer"
)
if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
message(FATAL_ERROR "AddressSanitizer is not compatible with "
"ThreadSanitizer or MemorySanitizer.")
endif ()
include(sanitize-helpers)
if (SANITIZE_ADDRESS)
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer"
"ASan")
find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
mark_as_advanced(ASan_WRAPPER)
endif ()
function (add_sanitize_address TARGET)
if (NOT SANITIZE_ADDRESS)
return()
endif ()
sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
endfunction ()
================================================
FILE: cmake/modules/FindCurses.cmake
================================================
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCurses
----------
Find the curses or ncurses include file and library.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``CURSES_FOUND``
True if Curses is found.
``CURSES_INCLUDE_DIRS``
The include directories needed to use Curses.
``CURSES_LIBRARIES``
The libraries needed to use Curses.
``CURSES_CFLAGS``
Parameters which ought be given to C/C++ compilers when using Curses.
``CURSES_HAVE_CURSES_H``
True if curses.h is available.
``CURSES_HAVE_NCURSES_H``
True if ncurses.h is available.
``CURSES_HAVE_NCURSES_NCURSES_H``
True if ``ncurses/ncurses.h`` is available.
``CURSES_HAVE_NCURSES_CURSES_H``
True if ``ncurses/curses.h`` is available.
Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the
``find_package(Curses)`` call if NCurses functionality is required.
Set ``CURSES_NEED_WIDE`` to ``TRUE`` before the
``find_package(Curses)`` call if unicode functionality is required.
Backward Compatibility
^^^^^^^^^^^^^^^^^^^^^^
The following variable are provided for backward compatibility:
``CURSES_INCLUDE_DIR``
Path to Curses include. Use ``CURSES_INCLUDE_DIRS`` instead.
``CURSES_LIBRARY``
Path to Curses library. Use ``CURSES_LIBRARIES`` instead.
#]=======================================================================]
include(CheckLibraryExists)
# we don't know anything about cursesw, so only ncurses
# may be ncursesw
if(NOT CURSES_NEED_WIDE)
set(NCURSES_LIBRARY_NAME "ncurses")
else()
set(NCURSES_LIBRARY_NAME "ncursesw")
# Also, if we are searching for wide curses - we are actually searching
# for ncurses, we don't know about any other unicode version.
set(CURSES_NEED_NCURSES TRUE)
endif()
find_library(CURSES_CURSES_LIBRARY NAMES curses)
find_library(CURSES_NCURSES_LIBRARY NAMES "${NCURSES_LIBRARY_NAME}" )
set(CURSES_USE_NCURSES FALSE)
if(CURSES_NCURSES_LIBRARY AND ((NOT CURSES_CURSES_LIBRARY) OR CURSES_NEED_NCURSES))
set(CURSES_USE_NCURSES TRUE)
endif()
# http://cygwin.com/ml/cygwin-announce/2010-01/msg00002.html
# cygwin ncurses stopped providing curses.h symlinks see above
# message. Cygwin is an ncurses package, so force ncurses on
# cygwin if the curses.h is missing
if(CYGWIN)
if (CURSES_NEED_WIDE)
if(NOT EXISTS /usr/include/ncursesw/curses.h)
set(CURSES_USE_NCURSES TRUE)
endif()
else()
if(NOT EXISTS /usr/include/curses.h)
set(CURSES_USE_NCURSES TRUE)
endif()
endif()
endif()
# Not sure the logic is correct here.
# If NCurses is required, use the function wsyncup() to check if the library
# has NCurses functionality (at least this is where it breaks on NetBSD).
# If wsyncup is in curses, use this one.
# If not, try to find ncurses and check if this has the symbol.
# Once the ncurses library is found, search the ncurses.h header first, but
# some web pages also say that even with ncurses there is not always a ncurses.h:
# http://osdir.com/ml/gnome.apps.mc.devel/2002-06/msg00029.html
# So at first try ncurses.h, if not found, try to find curses.h under the same
# prefix as the library was found, if still not found, try curses.h with the
# default search paths.
if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES)
include(CMakePushCheckState)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
if(CURSES_NCURSES_LIBRARY AND NOT CURSES_CURSES_HAS_WSYNCUP)
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
wsyncup "" CURSES_NCURSES_HAS_WSYNCUP)
if( CURSES_NCURSES_HAS_WSYNCUP)
set(CURSES_USE_NCURSES TRUE)
endif()
endif()
cmake_pop_check_state()
endif()
if(CURSES_USE_NCURSES)
get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
# Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility.
if(CURSES_NCURSES_INCLUDE_PATH)
if (CURSES_NEED_WIDE)
find_path(CURSES_INCLUDE_PATH
NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h
PATHS ${CURSES_NCURSES_INCLUDE_PATH}
NO_DEFAULT_PATH
)
else()
find_path(CURSES_INCLUDE_PATH
NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
PATHS ${CURSES_NCURSES_INCLUDE_PATH}
NO_DEFAULT_PATH
)
endif()
endif()
if (CURSES_NEED_WIDE)
set(CURSES_TINFO_LIBRARY_NAME tinfow)
find_path(CURSES_INCLUDE_PATH
NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h
HINTS "${_cursesParentDir}/include"
)
else()
set(CURSES_TINFO_LIBRARY_NAME tinfo)
find_path(CURSES_INCLUDE_PATH
NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
HINTS "${_cursesParentDir}/include"
)
endif()
# Previous versions of FindCurses provided these values.
if(NOT DEFINED CURSES_LIBRARY)
set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
endif()
CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
cbreak "" CURSES_NCURSES_HAS_CBREAK)
if(NOT CURSES_NCURSES_HAS_CBREAK)
find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}")
find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" )
endif()
else()
get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
#We can't find anything with CURSES_NEED_WIDE because we know
#only about ncursesw unicode curses version
if(NOT CURSES_NEED_WIDE)
find_path(CURSES_INCLUDE_PATH
NAMES curses.h
HINTS "${_cursesParentDir}/include"
)
endif()
# Previous versions of FindCurses provided these values.
if(NOT DEFINED CURSES_CURSES_H_PATH)
set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}")
endif()
if(NOT DEFINED CURSES_LIBRARY)
set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}")
endif()
endif()
# Report whether each possible header name exists in the include directory.
if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
if(CURSES_NEED_WIDE)
if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h")
set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/ncurses.h")
endif()
elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
endif()
if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
endif()
endif()
if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
if(CURSES_NEED_WIDE)
if(EXISTS "${CURSES_INCLUDE_PATH}/ncursesw/curses.h")
set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncursesw/curses.h")
endif()
elseif(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
endif()
if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
endif()
endif()
if(NOT CURSES_NEED_WIDE)
#ncursesw can't be found for this paths
if(NOT DEFINED CURSES_HAVE_NCURSES_H)
if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h")
set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h")
else()
set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND")
endif()
endif()
if(NOT DEFINED CURSES_HAVE_CURSES_H)
if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h")
set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h")
else()
set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND")
endif()
endif()
endif()
find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
find_library(CURSES_FORM_LIBRARY form )
# Previous versions of FindCurses provided these values.
if(NOT DEFINED FORM_LIBRARY)
set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
endif()
# Need to provide the *_LIBRARIES
set(CURSES_LIBRARIES ${CURSES_LIBRARY})
if(CURSES_EXTRA_LIBRARY)
set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY})
endif()
if(CURSES_FORM_LIBRARY)
set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
endif()
# Provide the *_INCLUDE_DIRS and *_CFLAGS results.
set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(NCURSES QUIET ${NCURSES_LIBRARY_NAME})
set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER})
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG
CURSES_LIBRARY CURSES_INCLUDE_PATH)
mark_as_advanced(
CURSES_INCLUDE_PATH
CURSES_CURSES_LIBRARY
CURSES_NCURSES_LIBRARY
CURSES_EXTRA_LIBRARY
CURSES_FORM_LIBRARY
)
================================================
FILE: cmake/modules/FindLibdrm.cmake
================================================
#.rst:
# FindLibdrm
# -------
#
# Try to find libdrm on a Unix system.
#
# This will define the following variables:
#
# ``Libdrm_FOUND``
# True if (the requested version of) libdrm is available
# ``Libdrm_VERSION``
# The version of libdrm
# ``Libdrm_LIBRARIES``
# This can be passed to target_link_libraries() instead of the ``Libdrm::Libdrm``
# target
# ``Libdrm_INCLUDE_DIRS``
# This should be passed to target_include_directories() if the target is not
# used for linking
# ``Libdrm_DEFINITIONS``
# This should be passed to target_compile_options() if the target is not
# used for linking
#
# If ``Libdrm_FOUND`` is TRUE, it will also define the following imported target:
#
# ``Libdrm::Libdrm``
# The libdrm library
#
# In general we recommend using the imported target, as it is easier to use.
# Bear in mind, however, that if the target is in the link interface of an
# exported library, it must be made available by the package config file.
#=============================================================================
# SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kde.org>
# SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
#
# SPDX-License-Identifier: BSD-3-Clause
#=============================================================================
if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "CMake 2.8.12 is required by FindLibdrm.cmake")
endif()
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use FindLibdrm.cmake")
endif()
if(NOT WIN32)
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PKG_Libdrm QUIET libdrm)
set(Libdrm_DEFINITIONS ${PKG_Libdrm_CFLAGS_OTHER})
set(Libdrm_VERSION ${PKG_Libdrm_VERSION})
find_path(Libdrm_INCLUDE_DIR
NAMES
xf86drm.h
HINTS
${PKG_Libdrm_INCLUDE_DIRS}
)
find_library(Libdrm_LIBRARY
NAMES
drm
HINTS
${PKG_Libdrm_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libdrm
FOUND_VAR
Libdrm_FOUND
REQUIRED_VARS
Libdrm_LIBRARY
Libdrm_INCLUDE_DIR
VERSION_VAR
Libdrm_VERSION
)
if(Libdrm_FOUND AND NOT TARGET Libdrm::Libdrm)
add_library(Libdrm::Libdrm UNKNOWN IMPORTED)
set_target_properties(Libdrm::Libdrm PROPERTIES
IMPORTED_LOCATION "${Libdrm_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${Libdrm_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}"
INTERFACE_INCLUDE_DIRECTORIES "${Libdrm_INCLUDE_DIR}/libdrm"
)
endif()
mark_as_advanced(Libdrm_LIBRARY Libdrm_INCLUDE_DIR)
# compatibility variables
set(Libdrm_LIBRARIES ${Libdrm_LIBRARY})
set(Libdrm_INCLUDE_DIRS ${Libdrm_INCLUDE_DIR} "${Libdrm_INCLUDE_DIR}/libdrm")
set(Libdrm_VERSION_STRING ${Libdrm_VERSION})
else()
message(STATUS "FindLibdrm.cmake cannot find libdrm on Windows systems.")
set(Libdrm_FOUND FALSE)
endif()
include(FeatureSummary)
set_package_properties(Libdrm PROPERTIES
URL "https://wiki.freedesktop.org/dri/"
DESCRIPTION "Userspace interface to kernel DRM services"
)
================================================
FILE: cmake/modules/FindMSan.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)
set(FLAG_CANDIDATES
"-g -fsanitize=memory"
)
include(sanitize-helpers)
if (SANITIZE_MEMORY)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
"MemorySanitizer is supported for Linux systems only.")
set(SANITIZE_MEMORY Off CACHE BOOL
"Enable MemorySanitizer for sanitized targets." FORCE)
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
"MemorySanitizer is supported for 64bit systems only.")
set(SANITIZE_MEMORY Off CACHE BOOL
"Enable MemorySanitizer for sanitized targets." FORCE)
else ()
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
"MSan")
endif ()
endif ()
function (add_sanitize_memory TARGET)
if (NOT SANITIZE_MEMORY)
return()
endif ()
sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
endfunction ()
================================================
FILE: cmake/modules/FindSanitizers.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# If any of the used compiler is a GNU compiler, add a second option to static
# link against the sanitizers.
option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off)
set(FIND_QUIETLY_FLAG "")
if (DEFINED Sanitizers_FIND_QUIETLY)
set(FIND_QUIETLY_FLAG "QUIET")
endif ()
find_package(ASan ${FIND_QUIETLY_FLAG})
find_package(TSan ${FIND_QUIETLY_FLAG})
find_package(MSan ${FIND_QUIETLY_FLAG})
find_package(UBSan ${FIND_QUIETLY_FLAG})
function(sanitizer_add_blacklist_file FILE)
if(NOT IS_ABSOLUTE ${FILE})
set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
endif()
get_filename_component(FILE "${FILE}" REALPATH)
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}"
"SanitizerBlacklist" "SanBlist")
endfunction()
function(add_sanitizers ...)
# If no sanitizer is enabled, return immediately.
if (NOT (SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR
SANITIZE_UNDEFINED))
return()
endif ()
foreach (TARGET ${ARGV})
# Check if this target will be compiled by exactly one compiler. Other-
# wise sanitizers can't be used and a warning should be printed once.
get_target_property(TARGET_TYPE ${TARGET} TYPE)
if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
"because it is an interface library and cannot be "
"compiled directly.")
return()
endif ()
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
if (NUM_COMPILERS GREATER 1)
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
"because it will be compiled by incompatible compilers. "
"Target will be compiled without sanitizers.")
return()
# If the target is compiled by no or no known compiler, give a warning.
elseif (NUM_COMPILERS EQUAL 0)
message(WARNING "Sanitizers for target ${TARGET} may not be"
" usable, because it uses no or an unknown compiler. "
"This is a false warning for targets using only "
"object lib(s) as input.")
endif ()
# Add sanitizers for target.
add_sanitize_address(${TARGET})
add_sanitize_thread(${TARGET})
add_sanitize_memory(${TARGET})
add_sanitize_undefined(${TARGET})
endforeach ()
endfunction(add_sanitizers)
================================================
FILE: cmake/modules/FindSystemd.cmake
================================================
#
# - Find systemd libraries
#
# SYSTEMD_INCLUDE_DIRS - where to find systemd/sd-journal.h, etc.
# SYSTEMD_LIBRARIES - List of libraries when using libsystemd.
# SYSTEMD_FOUND - True if libsystemd is found.
# A "systemd" target is created when found
pkg_search_module(PC_SYSTEMD QUIET libsystemd)
find_path(SYSTEMD_INCLUDE_DIR
NAMES
systemd/sd-device.h
HINTS
${PC_SYSTEMD_INCLUDE_DIRS}
)
find_library(SYSTEMD_LIBRARY
NAMES
systemd
HINTS
${PC_SYSTEMD_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Systemd
REQUIRED_VARS SYSTEMD_LIBRARY SYSTEMD_INCLUDE_DIR
VERSION_VAR PC_SYSTEMD_VERSION)
if(SYSTEMD_FOUND)
set(SYSTEMD_LIBRARIES ${SYSTEMD_LIBRARY})
set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIR})
add_library(systemd INTERFACE IMPORTED GLOBAL)
target_include_directories(systemd INTERFACE ${SYSTEMD_INCLUDE_DIRS})
set_target_properties(systemd PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${SYSTEMD_INCLUDE_DIRS})
target_link_libraries(systemd INTERFACE ${SYSTEMD_LIBRARIES})
else()
set(SYSTEMD_LIBRARIES)
set(SYSTEMD_INCLUDE_DIRS)
endif()
mark_as_advanced(SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS)
================================================
FILE: cmake/modules/FindTSan.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off)
set(FLAG_CANDIDATES
"-g -fsanitize=thread"
)
# ThreadSanitizer is not compatible with MemorySanitizer.
if (SANITIZE_THREAD AND SANITIZE_MEMORY)
message(FATAL_ERROR "ThreadSanitizer is not compatible with "
"MemorySanitizer.")
endif ()
include(sanitize-helpers)
if (SANITIZE_THREAD)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
"ThreadSanitizer is supported for Linux systems and macOS only.")
set(SANITIZE_THREAD Off CACHE BOOL
"Enable ThreadSanitizer for sanitized targets." FORCE)
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
"ThreadSanitizer is supported for 64bit systems only.")
set(SANITIZE_THREAD Off CACHE BOOL
"Enable ThreadSanitizer for sanitized targets." FORCE)
else ()
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer"
"TSan")
endif ()
endif ()
function (add_sanitize_thread TARGET)
if (NOT SANITIZE_THREAD)
return()
endif ()
sanitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan")
endfunction ()
================================================
FILE: cmake/modules/FindUBSan.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
option(SANITIZE_UNDEFINED
"Enable UndefinedBehaviorSanitizer for sanitized targets." Off)
set(FLAG_CANDIDATES
"-g -fsanitize=undefined"
)
include(sanitize-helpers)
if (SANITIZE_UNDEFINED)
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}"
"UndefinedBehaviorSanitizer" "UBSan")
endif ()
function (add_sanitize_undefined TARGET)
if (NOT SANITIZE_UNDEFINED)
return()
endif ()
sanitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan")
endfunction ()
================================================
FILE: cmake/modules/FindUDev.cmake
================================================
# Configure libudev environment
#
# UDEV_FOUND - system has a libudev
# UDEV_INCLUDE_DIR - where to find header files
# UDEV_LIBRARIES - the libraries to link against udev
# UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API
# An "udev" target is created when found
#
# Adapted from a version of Petr Vanek
# copyright (c) 2011 Petr Vanek <petr@scribus.info>
# copyright (c) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>
#
# Redistribution and use of this file is allowed according to the terms of the BSD license.
#
pkg_search_module(PC_UDEV QUIET libudev)
find_path(UDEV_INCLUDE_DIR
NAMES
libudev.h
HINTS
${PC_UDEV_INCLUDE_DIRS}
)
find_library(UDEV_LIBRARY
NAMES udev
HINTS
${PC_UDEV_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UDev
REQUIRED_VARS UDEV_LIBRARY UDEV_INCLUDE_DIR
VERSION_VAR PC_UDEV_VERSION)
if(UDEV_FOUND)
if(PC_UDEV_VERSION GREATER_EQUAL "143")
set(UDEV_STABLE TRUE)
else()
set(UDEV_STABLE FALSE)
endif()
set(UDEV_LIBRARIES ${UDEV_LIBRARY})
set(UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
message(STATUS "Libudev stable: ${UDEV_STABLE}")
add_library(udev INTERFACE IMPORTED GLOBAL)
set_target_properties(udev PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${UDEV_INCLUDE_DIRS})
target_link_libraries(udev INTERFACE ${UDEV_LIBRARIES})
else()
set(UDEV_LIBRARIES)
set(UDEV_INCLUDE_DIRS)
endif()
mark_as_advanced(UDEV_LIBRARIES UDEV_INCLUDE_DIRS)
================================================
FILE: cmake/modules/asan-wrapper
================================================
#!/bin/sh
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This script is a wrapper for AddressSanitizer. In some special cases you need
# to preload AddressSanitizer to avoid error messages - e.g. if you're
# preloading another library to your application. At the moment this script will
# only do something, if we're running on a Linux platform. OSX might not be
# affected.
# Exit immediately, if platform is not Linux.
if [ "$(uname)" != "Linux" ]
then
exec $@
fi
# Get the used libasan of the application ($1). If a libasan was found, it will
# be prepended to LD_PRELOAD.
libasan=$(ldd $1 | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
if [ -n "$libasan" ]
then
if [ -n "$LD_PRELOAD" ]
then
export LD_PRELOAD="$libasan:$LD_PRELOAD"
else
export LD_PRELOAD="$libasan"
fi
fi
# Execute the application.
exec $@
================================================
FILE: cmake/modules/sanitize-helpers.cmake
================================================
# The MIT License (MIT)
#
# Copyright (c)
# 2013 Matthew Arsenault
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Helper function to get the language of a source file.
function (sanitizer_lang_of_source FILE RETURN_VAR)
get_filename_component(LONGEST_EXT "${FILE}" EXT)
# If extension is empty return. This can happen for extensionless headers
if("${LONGEST_EXT}" STREQUAL "")
set(${RETURN_VAR} "" PARENT_SCOPE)
return()
endif()
# Get shortest extension as some files can have dot in their names
string(REGEX REPLACE "^.*(\\.[^.]+)$" "\\1" FILE_EXT ${LONGEST_EXT})
string(TOLOWER "${FILE_EXT}" FILE_EXT)
string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach (LANG ${ENABLED_LANGUAGES})
list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
if (NOT ${TEMP} EQUAL -1)
set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
return()
endif ()
endforeach()
set(${RETURN_VAR} "" PARENT_SCOPE)
endfunction ()
# Helper function to get compilers used by a target.
function (sanitizer_target_compilers TARGET RETURN_VAR)
# Check if all sources for target use the same compiler. If a target uses
# e.g. C and Fortran mixed and uses different compilers (e.g. clang and
# gfortran) this can trigger huge problems, because different compilers may
# use different implementations for sanitizers.
set(BUFFER "")
get_target_property(TSOURCES ${TARGET} SOURCES)
foreach (FILE ${TSOURCES})
# If expression was found, FILE is a generator-expression for an object
# library. Object libraries will be ignored.
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
if ("${_file}" STREQUAL "")
sanitizer_lang_of_source(${FILE} LANG)
if (LANG)
list(APPEND BUFFER ${CMAKE_${LANG}_COMPILER_ID})
endif ()
endif ()
endforeach ()
list(REMOVE_DUPLICATES BUFFER)
set(${RETURN_VAR} "${BUFFER}" PARENT_SCOPE)
endfunction ()
# Helper function to check compiler flags for language compiler.
function (sanitizer_check_compiler_flag FLAG LANG VARIABLE)
if (${LANG} STREQUAL "C")
include(CheckCCompilerFlag)
check_c_compiler_flag("${FLAG}" ${VARIABLE})
elseif (${LANG} STREQUAL "CXX")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("${FLAG}" ${VARIABLE})
elseif (${LANG} STREQUAL "Fortran")
# CheckFortranCompilerFlag was introduced in CMake 3.x. To be compatible
# with older Cmake versions, we will check if this module is present
# before we use it. Otherwise we will define Fortran coverage support as
# not available.
include(CheckFortranCompilerFlag OPTIONAL RESULT_VARIABLE INCLUDED)
if (INCLUDED)
check_fortran_compiler_flag("${FLAG}" ${VARIABLE})
elseif (NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VARIABLE}")
message(STATUS "Performing Test ${VARIABLE}"
" - Failed (Check not supported)")
endif ()
endif()
endfunction ()
# Helper function to test compiler flags.
function (sanitizer_check_compiler_flags FLAG_CANDIDATES NAME PREFIX)
set(CMAKE_REQUIRED_QUIET ${${PREFIX}_FIND_QUIETLY})
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach (LANG ${ENABLED_LANGUAGES})
# Sanitizer flags are not dependent on language, but the used compiler.
# So instead of searching flags foreach language, search flags foreach
# compiler used.
set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
if (NOT DEFINED ${PREFIX}_${COMPILER}_FLAGS)
foreach (FLAG ${FLAG_CANDIDATES})
if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Try ${COMPILER} ${NAME} flag = [${FLAG}]")
endif()
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
unset(${PREFIX}_FLAG_DETECTED CACHE)
sanitizer_check_compiler_flag("${FLAG}" ${LANG}
${PREFIX}_FLAG_DETECTED)
if (${PREFIX}_FLAG_DETECTED)
# If compiler is a GNU compiler, search for static flag, if
# SANITIZE_LINK_STATIC is enabled.
if (SANITIZE_LINK_STATIC AND (${COMPILER} STREQUAL "GNU"))
string(TOLOWER ${PREFIX} PREFIX_lower)
sanitizer_check_compiler_flag(
"-static-lib${PREFIX_lower}" ${LANG}
${PREFIX}_STATIC_FLAG_DETECTED)
if (${PREFIX}_STATIC_FLAG_DETECTED)
set(FLAG "-static-lib${PREFIX_lower} ${FLAG}")
endif ()
endif ()
set(${PREFIX}_${COMPILER}_FLAGS "${FLAG}" CACHE STRING
"${NAME} flags for ${COMPILER} compiler.")
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
break()
endif ()
endforeach ()
if (NOT ${PREFIX}_FLAG_DETECTED)
set(${PREFIX}_${COMPILER}_FLAGS "" CACHE STRING
"${NAME} flags for ${COMPILER} compiler.")
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
message(WARNING "${NAME} is not available for ${COMPILER} "
"compiler. Targets using this compiler will be "
"compiled without ${NAME}.")
endif ()
endif ()
endforeach ()
endfunction ()
# Helper to assign sanitizer flags for TARGET.
function (sanitizer_add_flags TARGET NAME PREFIX)
# Get list of compilers used by target and check, if sanitizer is available
# for this target. Other compiler checks like check for conflicting
# compilers will be done in add_sanitizers function.
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
if ("${${PREFIX}_${TARGET_COMPILER}_FLAGS}" STREQUAL "")
return()
endif()
# Set compile- and link-flags for target.
set_property(TARGET ${TARGET} APPEND_STRING
PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
set_property(TARGET ${TARGET} APPEND_STRING
PROPERTY COMPILE_FLAGS " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
set_property(TARGET ${TARGET} APPEND_STRING
PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
endfunction ()
================================================
FILE: cmake/optimization_flags.cmake
================================================
set(ADDITIONAL_DEBUG_COMPILE_OPTIONS
"-Wall"
#"-Wpedantic"
"-Wextra"
"-Waddress"
"-Waggressive-loop-optimizations"
#"-Wcast-qual"
#"-Wcast-align"
"-Wbad-function-cast"
"-Wmissing-declarations"
"-Wmissing-parameter-type"
"-Wmissing-prototypes"
"-Wnested-externs"
"-Wold-style-declaration"
"-Wold-style-definition"
"-Wstrict-prototypes"
"-Wpointer-sign"
"-Wdouble-promotion"
"-Wuninitialized"
"-Winit-self"
"-Wstrict-aliasing"
"-Wsuggest-attribute=const"
"-Wtrampolines"
"-Wfloat-equal"
"-Wshadow"
"-Wunsafe-loop-optimizations"
"-Wfloat-conversion"
"-Wlogical-op"
"-Wnormalized"
"-Wdisabled-optimization"
"-Whsa"
#"-Wconversion"
"-Wunused-result"
"-Werror=implicit-function-declaration"
#"-Wpadded"
"-Wformat"
"-Wformat-security"
CACHE INTERNAL "String"
)
set(ADDITIONAL_RELEASE_LINK_OPTIONS
"-Wl,-z,relro")
================================================
FILE: desktop/nvtop.desktop
================================================
[Desktop Entry]
Name=nvtop
GenericName=GPU Process Monitor
Type=Application
Terminal=true
Exec=nvtop
Icon=nvtop
Categories=System;Monitor;
X-AppImage-Integrate=false
================================================
FILE: desktop/nvtop.metainfo.xml.in
================================================
<?xml version="1.0" encoding="UTF-8"?>
<component type="console-application">
<id>io.github.syllo.nvtop</id>
<name>nvtop</name>
<summary>GPU process monitor for AMD, Intel and NVIDIA</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<developer_name>Maxime Schmitt</developer_name>
<description>
<p>Nvtop stands for Neat Videocard TOP, a (h)top like task monitor for AMD, Intel and NVIDIA GPUs. It can handle multiple GPUs and print information about them in a htop familiar way.</p>
</description>
<launchable type="desktop-id">nvtop.desktop</launchable>
<icon type="cached">nvtop.svg</icon>
<categories>
<category>System</category>
<category>Monitor</category>
</categories>
<url type="homepage">https://github.com/Syllo/nvtop</url>
<screenshots>
<screenshot type="default">
<caption>The nvtop interface</caption>
<image>https://raw.githubusercontent.com/Syllo/nvtop/master/screenshot/NVTOP_ex1.png</image>
</screenshot>
<screenshot>
<caption>The nvtop option screen</caption>
<image>https://raw.githubusercontent.com/Syllo/nvtop/master/screenshot/Nvtop-config.png</image>
</screenshot>
</screenshots>
<provides>
<binary>nvtop</binary>
</provides>
<releases>
<release version="@nvtop_VERSION_MAJOR@.@nvtop_VERSION_MINOR@.@nvtop_VERSION_PATCH@" date="@TODAY_ISO_8601@"></release>
</releases>
</component>
================================================
FILE: include/ascend/dcmi_interface_api.h
================================================
/* Copyright(C) 2021-2023. Huawei Technologies Co.,Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __DCMI_INTERFACE_API_H__
#define __DCMI_INTERFACE_API_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */
#ifdef __linux__
#define DCMIDLLEXPORT
#else
#define DCMIDLLEXPORT _declspec(dllexport)
#endif
#define MAX_CARD_NUM 64
#define MAX_CHIP_NAME_LEN 32 // Maximum length of chip name
#define TEMPLATE_NAME_LEN 32
#define DIE_ID_COUNT 5 // Number of die ID characters
#define DCMI_UTILIZATION_RATE_DDR 1
#define DCMI_UTILIZATION_RATE_AICORE 2
#define DCMI_UTILIZATION_RATE_AICPU 3
#define DCMI_UTILIZATION_RATE_CTRLCPU 4
#define DCMI_UTILIZATION_RATE_DDR_BANDWIDTH 5
#define DCMI_UTILIZATION_RATE_HBM 6
#define DCMI_UTILIZATION_RATE_HBM_BANDWIDTH 10
#define DCMI_UTILIZATION_RATE_VECTORCORE 12
/*----------------------------------------------*
* Structure description *
*----------------------------------------------*/
struct dcmi_chip_info {
unsigned char chip_type[MAX_CHIP_NAME_LEN];
unsigned char chip_name[MAX_CHIP_NAME_LEN];
unsigned char chip_ver[MAX_CHIP_NAME_LEN];
unsigned int aicore_cnt;
};
struct dcmi_pcie_info_all {
unsigned int venderid;
unsigned int subvenderid;
unsigned int deviceid;
unsigned int subdeviceid;
int domain;
unsigned int bdf_busid;
unsigned int bdf_deviceid;
unsigned int bdf_funcid;
unsigned char reserve[32]; /* the size of dcmi_pcie_info_all is 64 */
};
struct dcmi_die_id {
unsigned int soc_die[DIE_ID_COUNT];
};
struct dcmi_hbm_info {
unsigned long long memory_size;
unsigned int freq;
unsigned long long memory_usage;
int temp;
unsigned int bandwith_util_rate;
};
struct dcmi_get_memory_info_stru {
unsigned long long memory_size; /* unit:MB */
unsigned long long memory_available; /* free + hugepages_free * hugepagesize */
unsigned int freq;
unsigned long hugepagesize; /* unit:KB */
unsigned long hugepages_total;
unsigned long hugepages_free;
unsigned int utilize; /* ddr memory info usages */
unsigned char reserve[60]; /* the size of dcmi_memory_info is 96 */
};
enum dcmi_ip_addr_type {
DCMI_IPADDR_TYPE_V4 = 0, /** IPv4 */
DCMI_IPADDR_TYPE_V6 = 1, /** IPv6 */
DCMI_IPADDR_TYPE_ANY = 2 /** IPv4+IPv6 ("dual-stack") */
};
struct dcmi_ip_addr {
union {
unsigned char ip6[16];
unsigned char ip4[4];
} u_addr;
enum dcmi_ip_addr_type ip_type;
};
enum dcmi_unit_type {
NPU_TYPE = 0,
MCU_TYPE = 1,
CPU_TYPE = 2,
INVALID_TYPE = 0xFF
};
enum dcmi_rdfx_detect_result {
DCMI_RDFX_DETECT_OK = 0,
DCMI_RDFX_DETECT_SOCK_FAIL = 1,
DCMI_RDFX_DETECT_RECV_TIMEOUT = 2,
DCMI_RDFX_DETECT_UNREACH = 3,
DCMI_RDFX_DETECT_TIME_EXCEEDED = 4,
DCMI_RDFX_DETECT_FAULT = 5,
DCMI_RDFX_DETECT_INIT = 6,
DCMI_RDFX_DETECT_THREAD_ERR = 7,
DCMI_RDFX_DETECT_IP_SET = 8,
DCMI_RDFX_DETECT_MAX = 0xFF
};
enum dcmi_port_type {
DCMI_VNIC_PORT = 0,
DCMI_ROCE_PORT = 1,
DCMI_INVALID_PORT
};
enum dcmi_main_cmd {
DCMI_MAIN_CMD_DVPP = 0,
DCMI_MAIN_CMD_ISP,
DCMI_MAIN_CMD_TS_GROUP_NUM,
DCMI_MAIN_CMD_CAN,
DCMI_MAIN_CMD_UART,
DCMI_MAIN_CMD_UPGRADE,
DCMI_MAIN_CMD_TEMP = 50,
DCMI_MAIN_CMD_SVM = 51,
DCMI_MAIN_CMD_VDEV_MNG,
DCMI_MAIN_CMD_DEVICE_SHARE = 0x8001,
DCMI_MAIN_CMD_MAX
};
enum dcmi_freq_type {
DCMI_FREQ_DDR = 1,
DCMI_FREQ_CTRLCPU = 2,
DCMI_FREQ_HBM = 6,
DCMI_FREQ_AICORE_CURRENT_ = 7,
DCMI_FREQ_AICORE_MAX = 9,
DCMI_FREQ_VECTORCORE_CURRENT = 12
};
enum dcmi_reset_channel {
OUTBAND_CHANNEL = 0, // out-of-band reset
INBAND_CHANNEL // in-band reset
};
enum dcmi_boot_status {
DCMI_BOOT_STATUS_UNINIT = 0, // not init
DCMI_BOOT_STATUS_BIOS, // BIOS starting
DCMI_BOOT_STATUS_OS, // OS starting
DCMI_BOOT_STATUS_FINISH // started
};
enum dcmi_event_type {
DCMI_DMS_FAULT_EVENT = 0,
};
enum dcmi_die_type {
NDIE,
VDIE
};
#define DCMI_VDEV_RES_NAME_LEN 16
#define DCMI_VDEV_SIZE 20
#define DCMI_VDEV_FOR_RESERVE 32
#define DCMI_SOC_SPLIT_MAX 32
#define DCMI_MAX_EVENT_NAME_LENGTH 256
#define DCMI_MAX_EVENT_DATA_LENGTH 32
#define DCMI_EVENT_FILTER_FLAG_EVENT_ID (1UL << 0)
#define DCMI_EVENT_FILTER_FLAG_SERVERITY (1UL << 1)
#define DCMI_EVENT_FILTER_FLAG_NODE_TYPE (1UL << 2)
#define DCMI_MAX_EVENT_RESV_LENGTH 32
struct dcmi_base_resource {
unsigned long long token;
unsigned long long token_max;
unsigned long long task_timeout;
unsigned int vfg_id;
unsigned char vip_mode;
unsigned char reserved[DCMI_VDEV_FOR_RESERVE - 1]; /* bytes aligned */
};
/* total types of computing resource */
struct dcmi_computing_resource {
/* accelator resource */
float aic;
float aiv;
unsigned short dsa;
unsigned short rtsq;
unsigned short acsq;
unsigned short cdqm;
unsigned short c_core;
unsigned short ffts;
unsigned short sdma;
unsigned short pcie_dma;
/* memory resource, MB as unit */
unsigned long long memory_size;
/* id resource */
unsigned int event_id;
unsigned int notify_id;
unsigned int stream_id;
unsigned int model_id;
/* cpu resource */
unsigned short topic_schedule_aicpu;
unsigned short host_ctrl_cpu;
unsigned short host_aicpu;
unsigned short device_aicpu;
unsigned short topic_ctrl_cpu_slot;
/* vnpu resource */
unsigned int vdev_aicore_utilization;
unsigned long long vdev_memory_total;
unsigned long long vdev_memory_free;
unsigned char reserved[DCMI_VDEV_FOR_RESERVE-DCMI_VDEV_SIZE];
};
struct dcmi_media_resource {
/* dvpp resource */
float jpegd;
float jpege;
float vpc;
float vdec;
float pngd;
float venc;
unsigned char reserved[DCMI_VDEV_FOR_RESERVE];
};
struct dcmi_create_vdev_out {
unsigned int vdev_id;
unsigned int pcie_bus;
unsigned int pcie_device;
unsigned int pcie_func;
unsigned int vfg_id;
unsigned char reserved[DCMI_VDEV_FOR_RESERVE];
};
struct dcmi_create_vdev_res_stru {
unsigned int vdev_id;
unsigned int vfg_id;
char template_name[TEMPLATE_NAME_LEN];
unsigned char reserved[64];
};
struct dcmi_vdev_query_info {
char name[DCMI_VDEV_RES_NAME_LEN];
unsigned int status;
unsigned int is_container_used;
unsigned int vfid;
unsigned int vfg_id;
unsigned long long container_id;
struct dcmi_base_resource base;
struct dcmi_computing_resource computing;
struct dcmi_media_resource media;
};
/* for single search */
struct dcmi_vdev_query_stru {
unsigned int vdev_id;
struct dcmi_vdev_query_info query_info;
};
struct dcmi_soc_free_resource {
unsigned int vfg_num;
unsigned int vfg_bitmap;
struct dcmi_base_resource base;
struct dcmi_computing_resource computing;
struct dcmi_media_resource media;
};
struct dcmi_soc_total_resource {
unsigned int vdev_num;
unsigned int vdev_id[DCMI_SOC_SPLIT_MAX];
unsigned int vfg_num;
unsigned int vfg_bitmap;
struct dcmi_base_resource base;
struct dcmi_computing_resource computing;
struct dcmi_media_resource media;
};
struct dcmi_dms_fault_event {
unsigned int event_id; /* Event ID */
unsigned short deviceid; /* Device ID */
unsigned char node_type; /* Node type */
unsigned char node_id; /* Node ID */
unsigned char sub_node_type; /* Subnode type */
unsigned char sub_node_id; /* Subnode ID */
unsigned char severity; /* Event severity. 0: warning; 1: minor; 2: major; 3: critical */
unsigned char assertion; /* Event type. 0: fault recovery; 1: fault generation; 2: one-off event */
int event_serial_num; /* Alarm serial number */
int notify_serial_num; /* Notification serial number*/
/* Time when the event occurs, presenting as the number of seconds that have elapsed since the Unix epoch. */
unsigned long long alarm_raised_time;
char event_name[DCMI_MAX_EVENT_NAME_LENGTH]; /* Event description */
char additional_info[DCMI_MAX_EVENT_DATA_LENGTH]; /* Additional event information */
unsigned char resv[DCMI_MAX_EVENT_RESV_LENGTH]; /**< Reserves 32 bytes */
};
struct dcmi_event {
enum dcmi_event_type type; /* Event type */
union {
struct dcmi_dms_fault_event dms_event; /* Event content */
} event_t;
};
struct dcmi_event_filter {
/* It can be used to enable one or all filter criteria. The filter criteria are as follows:
0: disables the filter criteria.
DCMI_EVENT_FILTER_FLAG_EVENT_ID: receives only specified events.
DCMI_EVENT_FILTER_FLAG_SERVERITY: receives only the events of a specified level and higher levels.
DCMI_EVENT_FILTER_FLAG_NODE_TYPE: receives only events of a specified node type. */
unsigned long long filter_flag;
/* Receives a specified event. For details, see the Health Management Error Definition. */
unsigned int event_id;
/* Receives events of a specified level and higher levels. For details,
see the severity definition in the struct dcmi_dms_fault_event structure. */
unsigned char severity;
/* Receives only events of a specified node type. For details, see the Health Management Error Definition. */
unsigned char node_type;
unsigned char resv[DCMI_MAX_EVENT_RESV_LENGTH]; /* < Reserves 32 bytes. */
};
struct dcmi_proc_mem_info {
int proc_id;
// unit is byte
unsigned long proc_mem_usage;
};
struct dcmi_board_info {
unsigned int board_id;
unsigned int pcb_id;
unsigned int bom_id;
unsigned int slot_id; // slot_id indicates pcie slot ID of the chip
};
struct dsmi_hbm_info_stru {
unsigned long long memory_size; /**< HBM total size, KB */
unsigned int freq; /**< HBM freq, MHZ */
unsigned long long memory_usage; /**< HBM memory_usage, KB */
int temp; /**< HBM temperature */
unsigned int bandwith_util_rate;
};
#define DCMI_VERSION_1
#define DCMI_VERSION_2
#if defined DCMI_VERSION_2
DCMIDLLEXPORT int dcmi_init(void);
DCMIDLLEXPORT int dcmi_get_card_list(int *card_num, int *card_list, int list_len);
DCMIDLLEXPORT int dcmi_get_device_num_in_card(int card_id, int *device_num);
DCMIDLLEXPORT int dcmi_get_device_id_in_card(int card_id, int *device_id_max, int *mcu_id, int *cpu_id);
DCMIDLLEXPORT int dcmi_get_device_type(int card_id, int device_id, enum dcmi_unit_type *device_type);
DCMIDLLEXPORT int dcmi_get_device_pcie_info_v2(int card_id, int device_id, struct dcmi_pcie_info_all *pcie_info);
DCMIDLLEXPORT int dcmi_get_device_chip_info(int card_id, int device_id, struct dcmi_chip_info *chip_info);
DCMIDLLEXPORT int dcmi_get_device_power_info(int card_id, int device_id, int *power);
DCMIDLLEXPORT int dcmi_get_device_health(int card_id, int device_id, unsigned int *health);
DCMIDLLEXPORT int dcmi_get_device_errorcode_v2(
int card_id, int device_id, int *error_count, unsigned int *error_code_list, unsigned int list_len);
DCMIDLLEXPORT int dcmi_get_device_temperature(int card_id, int device_id, int *temperature);
DCMIDLLEXPORT int dcmi_get_device_voltage(int card_id, int device_id, unsigned int *voltage);
DCMIDLLEXPORT int dcmi_get_device_frequency(
int card_id, int device_id, enum dcmi_freq_type input_type, unsigned int *frequency);
DCMIDLLEXPORT int dcmi_get_device_hbm_info(int card_id, int device_id, struct dcmi_hbm_info *hbm_info);
DCMIDLLEXPORT int dcmi_get_device_memory_info_v3(int card_id, int device_id,
struct dcmi_get_memory_info_stru *memory_info);
DCMIDLLEXPORT int dcmi_get_device_utilization_rate(
int card_id, int device_id, int input_type, unsigned int *utilization_rate);
DCMIDLLEXPORT int dcmi_get_device_info(
int card_id, int device_id, enum dcmi_main_cmd main_cmd, unsigned int sub_cmd, void *buf, unsigned int *size);
DCMIDLLEXPORT int dcmi_get_device_ip(int card_id, int device_id, enum dcmi_port_type input_type, int port_id,
struct dcmi_ip_addr *ip, struct dcmi_ip_addr *mask);
DCMIDLLEXPORT int dcmi_get_device_network_health(int card_id, int device_id, enum dcmi_rdfx_detect_result *result);
DCMIDLLEXPORT int dcmi_get_device_logic_id(int *device_logic_id, int card_id, int device_id);
DCMIDLLEXPORT int dcmi_create_vdevice(int card_id, int device_id, struct dcmi_create_vdev_res_stru *vdev,
struct dcmi_create_vdev_out *out);
DCMIDLLEXPORT int dcmi_set_destroy_vdevice(int card_id, int device_id, unsigned int vdevid);
DCMIDLLEXPORT int dcmi_get_device_phyid_from_logicid(unsigned int logicid, unsigned int *phyid);
DCMIDLLEXPORT int dcmi_get_device_logicid_from_phyid(unsigned int phyid, unsigned int *logicid);
DCMIDLLEXPORT int dcmi_get_card_id_device_id_from_logicid(int *card_id, int *device_id, unsigned int device_logic_id);
DCMIDLLEXPORT int dcmi_get_card_id_device_id_from_phyid(int *card_id, int *device_id, unsigned int device_phy_id);
DCMIDLLEXPORT int dcmi_get_product_type(int card_id, int device_id, char *product_type_str, int buf_size);
DCMIDLLEXPORT int dcmi_set_device_reset(int card_id, int device_id, enum dcmi_reset_channel channel_type);
DCMIDLLEXPORT int dcmi_get_device_boot_status(int card_id, int device_id, enum dcmi_boot_status *boot_status);
DCMIDLLEXPORT int dcmi_subscribe_fault_event(int card_id, int device_id, struct dcmi_event_filter filter);
DCMIDLLEXPORT int dcmi_get_npu_work_mode(int card_id, unsigned char *work_mode);
DCMIDLLEXPORT int dcmi_get_device_die_v2(
int card_id, int device_id, enum dcmi_die_type input_type, struct dcmi_die_id *die_id);
DCMIDLLEXPORT int dcmi_get_device_resource_info (int card_id, int device_id, struct dcmi_proc_mem_info *proc_info,
int *proc_num);
DCMIDLLEXPORT int dcmi_get_device_board_info (int card_id, int device_id, struct dcmi_board_info *board_info);
DCMIDLLEXPORT int dcmi_get_hbm_info(int card_id, int device_id, struct dsmi_hbm_info_stru *device_hbm_info);
#endif
#if defined DCMI_VERSION_1
/* The following interfaces are V1 version interfaces. In order to ensure the compatibility is temporarily reserved,
* the later version will be deleted. Please switch to the V2 version interface as soon as possible */
struct dcmi_memory_info_stru {
unsigned long long memory_size;
unsigned int freq;
unsigned int utilize;
};
DCMIDLLEXPORT int dcmi_get_memory_info(int card_id, int device_id, struct dcmi_memory_info_stru *device_memory_info);
DCMIDLLEXPORT int dcmi_get_device_errorcode(
int card_id, int device_id, int *error_count, unsigned int *error_code, int *error_width);
DCMIDLLEXPORT int dcmi_mcu_get_power_info(int card_id, int *power);
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __DCMI_INTERFACE_API_H__ */
================================================
FILE: include/ini.h
================================================
/* inih -- simple .INI file parser
SPDX-License-Identifier: BSD-3-Clause
Copyright (C) 2009-2020, Ben Hoyt
inih is released under the New BSD license (see LICENSE.txt). Go to the project
home page for more info:
https://github.com/benhoyt/inih
*/
#ifndef INI_H
#define INI_H
/* Make this header file easier to include in C++ code */
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/* Nonzero if ini_handler callback should accept lineno parameter. */
#ifndef INI_HANDLER_LINENO
#define INI_HANDLER_LINENO 0
#endif
/* Typedef for prototype of handler function. */
#if INI_HANDLER_LINENO
typedef int (*ini_handler)(void* user, const char* section,
const char* name, const char* value,
int lineno);
#else
typedef int (*ini_handler)(void* user, const char* section,
const char* name, const char* value);
#endif
/* Typedef for prototype of fgets-style reader function. */
typedef char* (*ini_reader)(char* str, int num, void* stream);
/* Parse given INI-style file. May have [section]s, name=value pairs
(whitespace stripped), and comments starting with ';' (semicolon). Section
is "" if name=value pair parsed before any section heading. name:value
pairs are also supported as a concession to Python's configparser.
For each name=value pair parsed, call handler function with given user
pointer as well as section, name, and value (data only valid for duration
of handler call). Handler should return nonzero on success, zero on error.
Returns 0 on success, line number of first error on parse error (doesn't
stop on first error), -1 on file open error, or -2 on memory allocation
error (only when INI_USE_STACK is zero).
*/
int ini_parse(const char* filename, ini_handler handler, void* user);
/* Same as ini_parse(), but takes a FILE* instead of filename. This doesn't
close the file when it's finished -- the caller must do that. */
int ini_parse_file(FILE* file, ini_handler handler, void* user);
/* Same as ini_parse(), but takes an ini_reader function pointer instead of
filename. Used for implementing custom or string-based I/O (see also
ini_parse_string). */
int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
void* user);
/* Same as ini_parse(), but takes a zero-terminated string with the INI data
instead of a file. Useful for parsing INI data from a network socket or
already in memory. */
int ini_parse_string(const char* string, ini_handler handler, void* user);
/* Nonzero to allow multi-line value parsing, in the style of Python's
configparser. If allowed, ini_parse() will call the handler with the same
name for each subsequent line parsed. */
#ifndef INI_ALLOW_MULTILINE
#define INI_ALLOW_MULTILINE 1
#endif
/* Nonzero to allow a UTF-8 BOM sequence (0xEF 0xBB 0xBF) at the start of
the file. See https://github.com/benhoyt/inih/issues/21 */
#ifndef INI_ALLOW_BOM
#define INI_ALLOW_BOM 1
#endif
/* Chars that begin a start-of-line comment. Per Python configparser, allow
both ; and # comments at the start of a line by default. */
#ifndef INI_START_COMMENT_PREFIXES
#define INI_START_COMMENT_PREFIXES ";#"
#endif
/* Nonzero to allow inline comments (with valid inline comment characters
specified by INI_INLINE_COMMENT_PREFIXES). Set to 0 to turn off and match
Python 3.2+ configparser behaviour. */
#ifndef INI_ALLOW_INLINE_COMMENTS
#define INI_ALLOW_INLINE_COMMENTS 1
#endif
#ifndef INI_INLINE_COMMENT_PREFIXES
#define INI_INLINE_COMMENT_PREFIXES ";"
#endif
/* Nonzero to use stack for line buffer, zero to use heap (malloc/free). */
#ifndef INI_USE_STACK
#define INI_USE_STACK 1
#endif
/* Maximum line length for any line in INI file (stack or heap). Note that
this must be 3 more than the longest line (due to '\r', '\n', and '\0'). */
#ifndef INI_MAX_LINE
#define INI_MAX_LINE 200
#endif
/* Nonzero to allow heap line buffer to grow via realloc(), zero for a
fixed-size buffer of INI_MAX_LINE bytes. Only applies if INI_USE_STACK is
zero. */
#ifndef INI_ALLOW_REALLOC
#define INI_ALLOW_REALLOC 0
#endif
/* Initial size in bytes for heap line buffer. Only applies if INI_USE_STACK
is zero. */
#ifndef INI_INITIAL_ALLOC
#define INI_INITIAL_ALLOC 200
#endif
/* Stop parsing on first error (default is to keep parsing). */
#ifndef INI_STOP_ON_FIRST_ERROR
#define INI_STOP_ON_FIRST_ERROR 0
#endif
/* Nonzero to call the handler at the start of each new section (with
name and value NULL). Default is to only call the handler on
each name=value pair. */
#ifndef INI_CALL_HANDLER_ON_NEW_SECTION
#define INI_CALL_HANDLER_ON_NEW_SECTION 0
#endif
/* Nonzero to allow a name without a value (no '=' or ':' on the line) and
call the handler with value NULL in this case. Default is to treat
no-value lines as an error. */
#ifndef INI_ALLOW_NO_VALUE
#define INI_ALLOW_NO_VALUE 0
#endif
/* Nonzero to use custom ini_malloc, ini_free, and ini_realloc memory
allocation functions (INI_USE_STACK must also be 0). These functions must
have the same signatures as malloc/free/realloc and behave in a similar
way. ini_realloc is only needed if INI_ALLOW_REALLOC is set. */
#ifndef INI_CUSTOM_ALLOCATOR
#define INI_CUSTOM_ALLOCATOR 0
#endif
#ifdef __cplusplus
}
#endif
#endif /* INI_H */
================================================
FILE: include/libdrm/xe_drm.h
================================================
/* SPDX-License-Identifier: MIT */
/* This file is required by nvtop in order to support the newest xe driver whose xe_drm.h hasn't made it to libdrm yet */
/*
* Copyright © 2023 Intel Corporation
*/
#ifndef _UAPI_XE_DRM_H_
#define _UAPI_XE_DRM_H_
#include "drm.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*
* Please note that modifications to all structs defined here are
* subject to backwards-compatibility constraints.
* Sections in this file are organized as follows:
* 1. IOCTL definition
* 2. Extension definition and helper structs
* 3. IOCTL's Query structs in the order of the Query's entries.
* 4. The rest of IOCTL structs in the order of IOCTL declaration.
*/
/**
* DOC: Xe Device Block Diagram
*
* The diagram below represents a high-level simplification of a discrete
* GPU supported by the Xe driver. It shows some device components which
* are necessary to understand this API, as well as how their relations
* to each other. This diagram does not represent real hardware::
*
* ┌──────────────────────────────────────────────────────────────────┐
* │ ┌──────────────────────────────────────────────────┐ ┌─────────┐ │
* │ │ ┌───────────────────────┐ ┌─────┐ │ │ ┌─────┐ │ │
* │ │ │ VRAM0 ├───┤ ... │ │ │ │VRAM1│ │ │
* │ │ └───────────┬───────────┘ └─GT1─┘ │ │ └──┬──┘ │ │
* │ │ ┌──────────────────┴───────────────────────────┐ │ │ ┌──┴──┐ │ │
* │ │ │ ┌─────────────────────┐ ┌─────────────────┐ │ │ │ │ │ │ │
* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │
* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │RCS0 │ │BCS0 │ │ │ │ │ │ │ │ │
* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │
* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │
* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │VCS0 │ │VCS1 │ │ │ │ │ │ │ │ │
* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │
* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │
* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │VECS0│ │VECS1│ │ │ │ │ │ ... │ │ │
* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │
* │ │ │ │ ┌──┐ ┌──┐ ┌──┐ ┌──┐ │ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │
* │ │ │ │ │EU│ │EU│ │EU│ │EU│ │ │ │CCS0 │ │CCS1 │ │ │ │ │ │ │ │ │
* │ │ │ │ └──┘ └──┘ └──┘ └──┘ │ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │
* │ │ │ └─────────DSS─────────┘ │ ┌─────┐ ┌─────┐ │ │ │ │ │ │ │ │
* │ │ │ │ │CCS2 │ │CCS3 │ │ │ │ │ │ │ │ │
* │ │ │ ┌─────┐ ┌─────┐ ┌─────┐ │ └─────┘ └─────┘ │ │ │ │ │ │ │ │
* │ │ │ │ ... │ │ ... │ │ ... │ │ │ │ │ │ │ │ │ │
* │ │ │ └─DSS─┘ └─DSS─┘ └─DSS─┘ └─────Engines─────┘ │ │ │ │ │ │ │
* │ │ └───────────────────────────GT0────────────────┘ │ │ └─GT2─┘ │ │
* │ └────────────────────────────Tile0─────────────────┘ └─ Tile1──┘ │
* └─────────────────────────────Device0───────┬──────────────────────┘
* │
* ───────────────────────┴────────── PCI bus
*/
/**
* DOC: Xe uAPI Overview
*
* This section aims to describe the Xe's IOCTL entries, its structs, and other
* Xe related uAPI such as uevents and PMU (Platform Monitoring Unit) related
* entries and usage.
*
* List of supported IOCTLs:
* - &DRM_IOCTL_XE_DEVICE_QUERY
* - &DRM_IOCTL_XE_GEM_CREATE
* - &DRM_IOCTL_XE_GEM_MMAP_OFFSET
* - &DRM_IOCTL_XE_VM_CREATE
* - &DRM_IOCTL_XE_VM_DESTROY
* - &DRM_IOCTL_XE_VM_BIND
* - &DRM_IOCTL_XE_EXEC_QUEUE_CREATE
* - &DRM_IOCTL_XE_EXEC_QUEUE_DESTROY
* - &DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY
* - &DRM_IOCTL_XE_EXEC
* - &DRM_IOCTL_XE_WAIT_USER_FENCE
* - &DRM_IOCTL_XE_OBSERVATION
*/
/*
* xe specific ioctls.
*
* The device specific ioctl range is [DRM_COMMAND_BASE, DRM_COMMAND_END) ie
* [0x40, 0xa0) (a0 is excluded). The numbers below are defined as offset
* against DRM_COMMAND_BASE and should be between [0x0, 0x60).
*/
#define DRM_XE_DEVICE_QUERY 0x00
#define DRM_XE_GEM_CREATE 0x01
#define DRM_XE_GEM_MMAP_OFFSET 0x02
#define DRM_XE_VM_CREATE 0x03
#define DRM_XE_VM_DESTROY 0x04
#define DRM_XE_VM_BIND 0x05
#define DRM_XE_EXEC_QUEUE_CREATE 0x06
#define DRM_XE_EXEC_QUEUE_DESTROY 0x07
#define DRM_XE_EXEC_QUEUE_GET_PROPERTY 0x08
#define DRM_XE_EXEC 0x09
#define DRM_XE_WAIT_USER_FENCE 0x0a
#define DRM_XE_OBSERVATION 0x0b
/* Must be kept compact -- no holes */
#define DRM_IOCTL_XE_DEVICE_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)
#define DRM_IOCTL_XE_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_CREATE, struct drm_xe_gem_create)
#define DRM_IOCTL_XE_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_MMAP_OFFSET, struct drm_xe_gem_mmap_offset)
#define DRM_IOCTL_XE_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create)
#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
#define DRM_IOCTL_XE_VM_BIND DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
#define DRM_IOCTL_XE_EXEC_QUEUE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_CREATE, struct drm_xe_exec_queue_create)
#define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
#define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property)
#define DRM_IOCTL_XE_EXEC DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
#define DRM_IOCTL_XE_OBSERVATION DRM_IOW(DRM_COMMAND_BASE + DRM_XE_OBSERVATION, struct drm_xe_observation_param)
/**
* DOC: Xe IOCTL Extensions
*
* Before detailing the IOCTLs and its structs, it is important to highlight
* that every IOCTL in Xe is extensible.
*
* Many interfaces need to grow over time. In most cases we can simply
* extend the struct and have userspace pass in more data. Another option,
* as demonstrated by Vulkan's approach to providing extensions for forward
* and backward compatibility, is to use a list of optional structs to
* provide those extra details.
*
* The key advantage to using an extension chain is that it allows us to
* redefine the interface more easily than an ever growing struct of
* increasing complexity, and for large parts of that interface to be
* entirely optional. The downside is more pointer chasing; chasing across
* the __user boundary with pointers encapsulated inside u64.
*
* Example chaining:
*
* .. code-block:: C
*
* struct drm_xe_user_extension ext3 {
* .next_extension = 0, // end
* .name = ...,
* };
* struct drm_xe_user_extension ext2 {
* .next_extension = (uintptr_t)&ext3,
* .name = ...,
* };
* struct drm_xe_user_extension ext1 {
* .next_extension = (uintptr_t)&ext2,
* .name = ...,
* };
*
* Typically the struct drm_xe_user_extension would be embedded in some uAPI
* struct, and in this case we would feed it the head of the chain(i.e ext1),
* which would then apply all of the above extensions.
*/
/**
* struct drm_xe_user_extension - Base class for defining a chain of extensions
*/
struct drm_xe_user_extension {
/**
* @next_extension:
*
* Pointer to the next struct drm_xe_user_extension, or zero if the end.
*/
__u64 next_extension;
/**
* @name: Name of the extension.
*
* Note that the name here is just some integer.
*
* Also note that the name space for this is not global for the whole
* driver, but rather its scope/meaning is limited to the specific piece
* of uAPI which has embedded the struct drm_xe_user_extension.
*/
__u32 name;
/**
* @pad: MBZ
*
* All undefined bits must be zero.
*/
__u32 pad;
};
/**
* struct drm_xe_ext_set_property - Generic set property extension
*
* A generic struct that allows any of the Xe's IOCTL to be extended
* with a set_property operation.
*/
struct drm_xe_ext_set_property {
/** @base: base user extension */
struct drm_xe_user_extension base;
/** @property: property to set */
__u32 property;
/** @pad: MBZ */
__u32 pad;
/** @value: property value */
__u64 value;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_engine_class_instance - instance of an engine class
*
* It is returned as part of the @drm_xe_engine, but it also is used as
* the input of engine selection for both @drm_xe_exec_queue_create and
* @drm_xe_query_engine_cycles
*
* The @engine_class can be:
* - %DRM_XE_ENGINE_CLASS_RENDER
* - %DRM_XE_ENGINE_CLASS_COPY
* - %DRM_XE_ENGINE_CLASS_VIDEO_DECODE
* - %DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE
* - %DRM_XE_ENGINE_CLASS_COMPUTE
* - %DRM_XE_ENGINE_CLASS_VM_BIND - Kernel only classes (not actual
* hardware engine class). Used for creating ordered queues of VM
* bind operations.
*/
struct drm_xe_engine_class_instance {
#define DRM_XE_ENGINE_CLASS_RENDER 0
#define DRM_XE_ENGINE_CLASS_COPY 1
#define DRM_XE_ENGINE_CLASS_VIDEO_DECODE 2
#define DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE 3
#define DRM_XE_ENGINE_CLASS_COMPUTE 4
#define DRM_XE_ENGINE_CLASS_VM_BIND 5
/** @engine_class: engine class id */
__u16 engine_class;
/** @engine_instance: engine instance id */
__u16 engine_instance;
/** @gt_id: Unique ID of this GT within the PCI Device */
__u16 gt_id;
/** @pad: MBZ */
__u16 pad;
};
/**
* struct drm_xe_engine - describe hardware engine
*/
struct drm_xe_engine {
/** @instance: The @drm_xe_engine_class_instance */
struct drm_xe_engine_class_instance instance;
/** @reserved: Reserved */
__u64 reserved[3];
};
/**
* struct drm_xe_query_engines - describe engines
*
* If a query is made with a struct @drm_xe_device_query where .query
* is equal to %DRM_XE_DEVICE_QUERY_ENGINES, then the reply uses an array of
* struct @drm_xe_query_engines in .data.
*/
struct drm_xe_query_engines {
/** @num_engines: number of engines returned in @engines */
__u32 num_engines;
/** @pad: MBZ */
__u32 pad;
/** @engines: The returned engines for this device */
struct drm_xe_engine engines[];
};
/**
* enum drm_xe_memory_class - Supported memory classes.
*/
enum drm_xe_memory_class {
/** @DRM_XE_MEM_REGION_CLASS_SYSMEM: Represents system memory. */
DRM_XE_MEM_REGION_CLASS_SYSMEM = 0,
/**
* @DRM_XE_MEM_REGION_CLASS_VRAM: On discrete platforms, this
* represents the memory that is local to the device, which we
* call VRAM. Not valid on integrated platforms.
*/
DRM_XE_MEM_REGION_CLASS_VRAM
};
/**
* struct drm_xe_mem_region - Describes some region as known to
* the driver.
*/
struct drm_xe_mem_region {
/**
* @mem_class: The memory class describing this region.
*
* See enum drm_xe_memory_class for supported values.
*/
__u16 mem_class;
/**
* @instance: The unique ID for this region, which serves as the
* index in the placement bitmask used as argument for
* &DRM_IOCTL_XE_GEM_CREATE
*/
__u16 instance;
/**
* @min_page_size: Min page-size in bytes for this region.
*
* When the kernel allocates memory for this region, the
* underlying pages will be at least @min_page_size in size.
* Buffer objects with an allowable placement in this region must be
* created with a size aligned to this value.
* GPU virtual address mappings of (parts of) buffer objects that
* may be placed in this region must also have their GPU virtual
* address and range aligned to this value.
* Affected IOCTLS will return %-EINVAL if alignment restrictions are
* not met.
*/
__u32 min_page_size;
/**
* @total_size: The usable size in bytes for this region.
*/
__u64 total_size;
/**
* @used: Estimate of the memory used in bytes for this region.
*
* Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable
* accounting. Without this the value here will always equal
* zero.
*/
__u64 used;
/**
* @cpu_visible_size: How much of this region can be CPU
* accessed, in bytes.
*
* This will always be <= @total_size, and the remainder (if
* any) will not be CPU accessible. If the CPU accessible part
* is smaller than @total_size then this is referred to as a
* small BAR system.
*
* On systems without small BAR (full BAR), the probed_size will
* always equal the @total_size, since all of it will be CPU
* accessible.
*
* Note this is only tracked for DRM_XE_MEM_REGION_CLASS_VRAM
* regions (for other types the value here will always equal
* zero).
*/
__u64 cpu_visible_size;
/**
* @cpu_visible_used: Estimate of CPU visible memory used, in
* bytes.
*
* Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable
* accounting. Without this the value here will always equal
* zero. Note this is only currently tracked for
* DRM_XE_MEM_REGION_CLASS_VRAM regions (for other types the value
* here will always be zero).
*/
__u64 cpu_visible_used;
/** @reserved: Reserved */
__u64 reserved[6];
};
/**
* struct drm_xe_query_mem_regions - describe memory regions
*
* If a query is made with a struct drm_xe_device_query where .query
* is equal to DRM_XE_DEVICE_QUERY_MEM_REGIONS, then the reply uses
* struct drm_xe_query_mem_regions in .data.
*/
struct drm_xe_query_mem_regions {
/** @num_mem_regions: number of memory regions returned in @mem_regions */
__u32 num_mem_regions;
/** @pad: MBZ */
__u32 pad;
/** @mem_regions: The returned memory regions for this device */
struct drm_xe_mem_region mem_regions[];
};
/**
* struct drm_xe_query_config - describe the device configuration
*
* If a query is made with a struct drm_xe_device_query where .query
* is equal to DRM_XE_DEVICE_QUERY_CONFIG, then the reply uses
* struct drm_xe_query_config in .data.
*
* The index in @info can be:
* - %DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID - Device ID (lower 16 bits)
* and the device revision (next 8 bits)
* - %DRM_XE_QUERY_CONFIG_FLAGS - Flags describing the device
* configuration, see list below
*
* - %DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM - Flag is set if the device
* has usable VRAM
* - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
* required by this device, typically SZ_4K or SZ_64K
* - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
* - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
* available exec queue priority
*/
struct drm_xe_query_config {
/** @num_params: number of parameters returned in info */
__u32 num_params;
/** @pad: MBZ */
__u32 pad;
#define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0
#define DRM_XE_QUERY_CONFIG_FLAGS 1
#define DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM (1 << 0)
#define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT 2
#define DRM_XE_QUERY_CONFIG_VA_BITS 3
#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 4
/** @info: array of elements containing the config info */
__u64 info[];
};
/**
* struct drm_xe_gt - describe an individual GT.
*
* To be used with drm_xe_query_gt_list, which will return a list with all the
* existing GT individual descriptions.
* Graphics Technology (GT) is a subset of a GPU/tile that is responsible for
* implementing graphics and/or media operations.
*
* The index in @type can be:
* - %DRM_XE_QUERY_GT_TYPE_MAIN
* - %DRM_XE_QUERY_GT_TYPE_MEDIA
*/
struct drm_xe_gt {
#define DRM_XE_QUERY_GT_TYPE_MAIN 0
#define DRM_XE_QUERY_GT_TYPE_MEDIA 1
/** @type: GT type: Main or Media */
__u16 type;
/** @tile_id: Tile ID where this GT lives (Information only) */
__u16 tile_id;
/** @gt_id: Unique ID of this GT within the PCI Device */
__u16 gt_id;
/** @pad: MBZ */
__u16 pad[3];
/** @reference_clock: A clock frequency for timestamp */
__u32 reference_clock;
/**
* @near_mem_regions: Bit mask of instances from
* drm_xe_query_mem_regions that are nearest to the current engines
* of this GT.
* Each index in this mask refers directly to the struct
* drm_xe_query_mem_regions' instance, no assumptions should
* be made about order. The type of each region is described
* by struct drm_xe_query_mem_regions' mem_class.
*/
__u64 near_mem_regions;
/**
* @far_mem_regions: Bit mask of instances from
* drm_xe_query_mem_regions that are far from the engines of this GT.
* In general, they have extra indirections when compared to the
* @near_mem_regions. For a discrete device this could mean system
* memory and memory living in a different tile.
* Each index in this mask refers directly to the struct
* drm_xe_query_mem_regions' instance, no assumptions should
* be made about order. The type of each region is described
* by struct drm_xe_query_mem_regions' mem_class.
*/
__u64 far_mem_regions;
/** @ip_ver_major: Graphics/media IP major version on GMD_ID platforms */
__u16 ip_ver_major;
/** @ip_ver_minor: Graphics/media IP minor version on GMD_ID platforms */
__u16 ip_ver_minor;
/** @ip_ver_rev: Graphics/media IP revision version on GMD_ID platforms */
__u16 ip_ver_rev;
/** @pad2: MBZ */
__u16 pad2;
/** @reserved: Reserved */
__u64 reserved[7];
};
/**
* struct drm_xe_query_gt_list - A list with GT description items.
*
* If a query is made with a struct drm_xe_device_query where .query
* is equal to DRM_XE_DEVICE_QUERY_GT_LIST, then the reply uses struct
* drm_xe_query_gt_list in .data.
*/
struct drm_xe_query_gt_list {
/** @num_gt: number of GT items returned in gt_list */
__u32 num_gt;
/** @pad: MBZ */
__u32 pad;
/** @gt_list: The GT list returned for this device */
struct drm_xe_gt gt_list[];
};
/**
* struct drm_xe_query_topology_mask - describe the topology mask of a GT
*
* This is the hardware topology which reflects the internal physical
* structure of the GPU.
*
* If a query is made with a struct drm_xe_device_query where .query
* is equal to DRM_XE_DEVICE_QUERY_GT_TOPOLOGY, then the reply uses
* struct drm_xe_query_topology_mask in .data.
*
* The @type can be:
* - %DRM_XE_TOPO_DSS_GEOMETRY - To query the mask of Dual Sub Slices
* (DSS) available for geometry operations. For example a query response
* containing the following in mask:
* ``DSS_GEOMETRY ff ff ff ff 00 00 00 00``
* means 32 DSS are available for geometry.
* - %DRM_XE_TOPO_DSS_COMPUTE - To query the mask of Dual Sub Slices
* (DSS) available for compute operations. For example a query response
* containing the following in mask:
* ``DSS_COMPUTE ff ff ff ff 00 00 00 00``
* means 32 DSS are available for compute.
* - %DRM_XE_TOPO_L3_BANK - To query the mask of enabled L3 banks
* - %DRM_XE_TOPO_EU_PER_DSS - To query the mask of Execution Units (EU)
* available per Dual Sub Slices (DSS). For example a query response
* containing the following in mask:
* ``EU_PER_DSS ff ff 00 00 00 00 00 00``
* means each DSS has 16 SIMD8 EUs. This type may be omitted if device
* doesn't have SIMD8 EUs.
* - %DRM_XE_TOPO_SIMD16_EU_PER_DSS - To query the mask of SIMD16 Execution
* Units (EU) available per Dual Sub Slices (DSS). For example a query
* response containing the following in mask:
* ``SIMD16_EU_PER_DSS ff ff 00 00 00 00 00 00``
* means each DSS has 16 SIMD16 EUs. This type may be omitted if device
* doesn't have SIMD16 EUs.
*/
struct drm_xe_query_topology_mask {
/** @gt_id: GT ID the mask is associated with */
__u16 gt_id;
#define DRM_XE_TOPO_DSS_GEOMETRY 1
#define DRM_XE_TOPO_DSS_COMPUTE 2
#define DRM_XE_TOPO_L3_BANK 3
#define DRM_XE_TOPO_EU_PER_DSS 4
#define DRM_XE_TOPO_SIMD16_EU_PER_DSS 5
/** @type: type of mask */
__u16 type;
/** @num_bytes: number of bytes in requested mask */
__u32 num_bytes;
/** @mask: little-endian mask of @num_bytes */
__u8 mask[];
};
/**
* struct drm_xe_query_engine_cycles - correlate CPU and GPU timestamps
*
* If a query is made with a struct drm_xe_device_query where .query is equal to
* DRM_XE_DEVICE_QUERY_ENGINE_CYCLES, then the reply uses struct drm_xe_query_engine_cycles
* in .data. struct drm_xe_query_engine_cycles is allocated by the user and
* .data points to this allocated structure.
*
* The query returns the engine cycles, which along with GT's @reference_clock,
* can be used to calculate the engine timestamp. In addition the
* query returns a set of cpu timestamps that indicate when the command
* streamer cycle count was captured.
*/
struct drm_xe_query_engine_cycles {
/**
* @eci: This is input by the user and is the engine for which command
* streamer cycles is queried.
*/
struct drm_xe_engine_class_instance eci;
/**
* @clockid: This is input by the user and is the reference clock id for
* CPU timestamp. For definition, see clock_gettime(2) and
* perf_event_open(2). Supported clock ids are CLOCK_MONOTONIC,
* CLOCK_MONOTONIC_RAW, CLOCK_REALTIME, CLOCK_BOOTTIME, CLOCK_TAI.
*/
__s32 clockid;
/** @width: Width of the engine cycle counter in bits. */
__u32 width;
/**
* @engine_cycles: Engine cycles as read from its register
* at 0x358 offset.
*/
__u64 engine_cycles;
/**
* @cpu_timestamp: CPU timestamp in ns. The timestamp is captured before
* reading the engine_cycles register using the reference clockid set by the
* user.
*/
__u64 cpu_timestamp;
/**
* @cpu_delta: Time delta in ns captured around reading the lower dword
* of the engine_cycles register.
*/
__u64 cpu_delta;
};
/**
* struct drm_xe_query_uc_fw_version - query a micro-controller firmware version
*
* Given a uc_type this will return the branch, major, minor and patch version
* of the micro-controller firmware.
*/
struct drm_xe_query_uc_fw_version {
/** @uc_type: The micro-controller type to query firmware version */
#define XE_QUERY_UC_TYPE_GUC_SUBMISSION 0
#define XE_QUERY_UC_TYPE_HUC 1
__u16 uc_type;
/** @pad: MBZ */
__u16 pad;
/** @branch_ver: branch uc fw version */
__u32 branch_ver;
/** @major_ver: major uc fw version */
__u32 major_ver;
/** @minor_ver: minor uc fw version */
__u32 minor_ver;
/** @patch_ver: patch uc fw version */
__u32 patch_ver;
/** @pad2: MBZ */
__u32 pad2;
/** @reserved: Reserved */
__u64 reserved;
};
/**
* struct drm_xe_device_query - Input of &DRM_IOCTL_XE_DEVICE_QUERY - main
* structure to query device information
*
* The user selects the type of data to query among DRM_XE_DEVICE_QUERY_*
* and sets the value in the query member. This determines the type of
* the structure provided by the driver in data, among struct drm_xe_query_*.
*
* The @query can be:
* - %DRM_XE_DEVICE_QUERY_ENGINES
* - %DRM_XE_DEVICE_QUERY_MEM_REGIONS
* - %DRM_XE_DEVICE_QUERY_CONFIG
* - %DRM_XE_DEVICE_QUERY_GT_LIST
* - %DRM_XE_DEVICE_QUERY_HWCONFIG - Query type to retrieve the hardware
* configuration of the device such as information on slices, memory,
* caches, and so on. It is provided as a table of key / value
* attributes.
* - %DRM_XE_DEVICE_QUERY_GT_TOPOLOGY
* - %DRM_XE_DEVICE_QUERY_ENGINE_CYCLES
*
* If size is set to 0, the driver fills it with the required size for
* the requested type of data to query. If size is equal to the required
* size, the queried information is copied into data. If size is set to
* a value different from 0 and different from the required size, the
* IOCTL call returns -EINVAL.
*
* For example the following code snippet allows retrieving and printing
* information about the device engines with DRM_XE_DEVICE_QUERY_ENGINES:
*
* .. code-block:: C
*
* struct drm_xe_query_engines *engines;
* struct drm_xe_device_query query = {
* .extensions = 0,
* .query = DRM_XE_DEVICE_QUERY_ENGINES,
* .size = 0,
* .data = 0,
* };
* ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query);
* engines = malloc(query.size);
* query.data = (uintptr_t)engines;
* ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query);
* for (int i = 0; i < engines->num_engines; i++) {
* printf("Engine %d: %s\n", i,
* engines->engines[i].instance.engine_class ==
* DRM_XE_ENGINE_CLASS_RENDER ? "RENDER":
* engines->engines[i].instance.engine_class ==
* DRM_XE_ENGINE_CLASS_COPY ? "COPY":
* engines->engines[i].instance.engine_class ==
* DRM_XE_ENGINE_CLASS_VIDEO_DECODE ? "VIDEO_DECODE":
* engines->engines[i].instance.engine_class ==
* DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ? "VIDEO_ENHANCE":
* engines->engines[i].instance.engine_class ==
* DRM_XE_ENGINE_CLASS_COMPUTE ? "COMPUTE":
* "UNKNOWN");
* }
* free(engines);
*/
struct drm_xe_device_query {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
#define DRM_XE_DEVICE_QUERY_ENGINES 0
#define DRM_XE_DEVICE_QUERY_MEM_REGIONS 1
#define DRM_XE_DEVICE_QUERY_CONFIG 2
#define DRM_XE_DEVICE_QUERY_GT_LIST 3
#define DRM_XE_DEVICE_QUERY_HWCONFIG 4
#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5
#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6
#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7
#define DRM_XE_DEVICE_QUERY_OA_UNITS 8
/** @query: The type of data to query */
__u32 query;
/** @size: Size of the queried data */
__u32 size;
/** @data: Queried data is placed here */
__u64 data;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_gem_create - Input of &DRM_IOCTL_XE_GEM_CREATE - A structure for
* gem creation
*
* The @flags can be:
* - %DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING
* - %DRM_XE_GEM_CREATE_FLAG_SCANOUT
* - %DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM - When using VRAM as a
* possible placement, ensure that the corresponding VRAM allocation
* will always use the CPU accessible part of VRAM. This is important
* for small-bar systems (on full-bar systems this gets turned into a
* noop).
* Note1: System memory can be used as an extra placement if the kernel
* should spill the allocation to system memory, if space can't be made
* available in the CPU accessible part of VRAM (giving the same
* behaviour as the i915 interface, see
* I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS).
* Note2: For clear-color CCS surfaces the kernel needs to read the
* clear-color value stored in the buffer, and on discrete platforms we
* need to use VRAM for display surfaces, therefore the kernel requires
* setting this flag for such objects, otherwise an error is thrown on
* small-bar systems.
*
* @cpu_caching supports the following values:
* - %DRM_XE_GEM_CPU_CACHING_WB - Allocate the pages with write-back
* caching. On iGPU this can't be used for scanout surfaces. Currently
* not allowed for objects placed in VRAM.
* - %DRM_XE_GEM_CPU_CACHING_WC - Allocate the pages as write-combined. This
* is uncached. Scanout surfaces should likely use this. All objects
* that can be placed in VRAM must use this.
*/
struct drm_xe_gem_create {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/**
* @size: Size of the object to be created, must match region
* (system or vram) minimum alignment (&min_page_size).
*/
__u64 size;
/**
* @placement: A mask of memory instances of where BO can be placed.
* Each index in this mask refers directly to the struct
* drm_xe_query_mem_regions' instance, no assumptions should
* be made about order. The type of each region is described
* by struct drm_xe_query_mem_regions' mem_class.
*/
__u32 placement;
#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (1 << 0)
#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (1 << 1)
#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (1 << 2)
/**
* @flags: Flags, currently a mask of memory instances of where BO can
* be placed
*/
__u32 flags;
/**
* @vm_id: Attached VM, if any
*
* If a VM is specified, this BO must:
*
* 1. Only ever be bound to that VM.
* 2. Cannot be exported as a PRIME fd.
*/
__u32 vm_id;
/**
* @handle: Returned handle for the object.
*
* Object handles are nonzero.
*/
__u32 handle;
#define DRM_XE_GEM_CPU_CACHING_WB 1
#define DRM_XE_GEM_CPU_CACHING_WC 2
/**
* @cpu_caching: The CPU caching mode to select for this object. If
* mmaping the object the mode selected here will also be used. The
* exception is when mapping system memory (including data evicted
* to system) on discrete GPUs. The caching mode selected will
* then be overridden to DRM_XE_GEM_CPU_CACHING_WB, and coherency
* between GPU- and CPU is guaranteed. The caching mode of
* existing CPU-mappings will be updated transparently to
* user-space clients.
*/
__u16 cpu_caching;
/** @pad: MBZ */
__u16 pad[3];
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_gem_mmap_offset - Input of &DRM_IOCTL_XE_GEM_MMAP_OFFSET
*/
struct drm_xe_gem_mmap_offset {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @handle: Handle for the object being mapped. */
__u32 handle;
/** @flags: Must be zero */
__u32 flags;
/** @offset: The fake offset to use for subsequent mmap call */
__u64 offset;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_vm_create - Input of &DRM_IOCTL_XE_VM_CREATE
*
* The @flags can be:
* - %DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE
* - %DRM_XE_VM_CREATE_FLAG_LR_MODE - An LR, or Long Running VM accepts
* exec submissions to its exec_queues that don't have an upper time
* limit on the job execution time. But exec submissions to these
* don't allow any of the flags DRM_XE_SYNC_FLAG_SYNCOBJ,
* DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ, DRM_XE_SYNC_FLAG_DMA_BUF,
* used as out-syncobjs, that is, together with DRM_XE_SYNC_FLAG_SIGNAL.
* LR VMs can be created in recoverable page-fault mode using
* DRM_XE_VM_CREATE_FLAG_FAULT_MODE, if the device supports it.
* If that flag is omitted, the UMD can not rely on the slightly
* different per-VM overcommit semantics that are enabled by
* DRM_XE_VM_CREATE_FLAG_FAULT_MODE (see below), but KMD may
* still enable recoverable pagefaults if supported by the device.
* - %DRM_XE_VM_CREATE_FLAG_FAULT_MODE - Requires also
* DRM_XE_VM_CREATE_FLAG_LR_MODE. It allows memory to be allocated on
* demand when accessed, and also allows per-VM overcommit of memory.
* The xe driver internally uses recoverable pagefaults to implement
* this.
*/
struct drm_xe_vm_create {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE (1 << 0)
#define DRM_XE_VM_CREATE_FLAG_LR_MODE (1 << 1)
#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE (1 << 2)
/** @flags: Flags */
__u32 flags;
/** @vm_id: Returned VM ID */
__u32 vm_id;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_vm_destroy - Input of &DRM_IOCTL_XE_VM_DESTROY
*/
struct drm_xe_vm_destroy {
/** @vm_id: VM ID */
__u32 vm_id;
/** @pad: MBZ */
__u32 pad;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_vm_bind_op - run bind operations
*
* The @op can be:
* - %DRM_XE_VM_BIND_OP_MAP
* - %DRM_XE_VM_BIND_OP_UNMAP
* - %DRM_XE_VM_BIND_OP_MAP_USERPTR
* - %DRM_XE_VM_BIND_OP_UNMAP_ALL
* - %DRM_XE_VM_BIND_OP_PREFETCH
*
* and the @flags can be:
* - %DRM_XE_VM_BIND_FLAG_READONLY - Setup the page tables as read-only
* to ensure write protection
* - %DRM_XE_VM_BIND_FLAG_IMMEDIATE - On a faulting VM, do the
* MAP operation immediately rather than deferring the MAP to the page
* fault handler. This is implied on a non-faulting VM as there is no
* fault handler to defer to.
* - %DRM_XE_VM_BIND_FLAG_NULL - When the NULL flag is set, the page
* tables are setup with a special bit which indicates writes are
* dropped and all reads return zero. In the future, the NULL flags
* will only be valid for DRM_XE_VM_BIND_OP_MAP operations, the BO
* handle MBZ, and the BO offset MBZ. This flag is intended to
* implement VK sparse bindings.
*/
struct drm_xe_vm_bind_op {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/**
* @obj: GEM object to operate on, MBZ for MAP_USERPTR, MBZ for UNMAP
*/
__u32 obj;
/**
* @pat_index: The platform defined @pat_index to use for this mapping.
* The index basically maps to some predefined memory attributes,
* including things like caching, coherency, compression etc. The exact
* meaning of the pat_index is platform specific and defined in the
* Bspec and PRMs. When the KMD sets up the binding the index here is
* encoded into the ppGTT PTE.
*
* For coherency the @pat_index needs to be at least 1way coherent when
* drm_xe_gem_create.cpu_caching is DRM_XE_GEM_CPU_CACHING_WB. The KMD
* will extract the coherency mode from the @pat_index and reject if
* there is a mismatch (see note below for pre-MTL platforms).
*
* Note: On pre-MTL platforms there is only a caching mode and no
* explicit coherency mode, but on such hardware there is always a
* shared-LLC (or is dgpu) so all GT memory accesses are coherent with
* CPU caches even with the caching mode set as uncached. It's only the
* display engine that is incoherent (on dgpu it must be in VRAM which
* is always mapped as WC on the CPU). However to keep the uapi somewhat
* consistent with newer platforms the KMD groups the different cache
* levels into the following coherency buckets on all pre-MTL platforms:
*
* ppGTT UC -> COH_NONE
* ppGTT WC -> COH_NONE
* ppGTT WT -> COH_NONE
* ppGTT WB -> COH_AT_LEAST_1WAY
*
* In practice UC/WC/WT should only ever used for scanout surfaces on
* such platforms (or perhaps in general for dma-buf if shared with
* another device) since it is only the display engine that is actually
* incoherent. Everything else should typically use WB given that we
* have a shared-LLC. On MTL+ this completely changes and the HW
* defines the coherency mode as part of the @pat_index, where
* incoherent GT access is possible.
*
* Note: For userptr and externally imported dma-buf the kernel expects
* either 1WAY or 2WAY for the @pat_index.
*
* For DRM_XE_VM_BIND_FLAG_NULL bindings there are no KMD restrictions
* on the @pat_index. For such mappings there is no actual memory being
* mapped (the address in the PTE is invalid), so the various PAT memory
* attributes likely do not apply. Simply leaving as zero is one
* option (still a valid pat_index).
*/
__u16 pat_index;
/** @pad: MBZ */
__u16 pad;
union {
/**
* @obj_offset: Offset into the object, MBZ for CLEAR_RANGE,
* ignored for unbind
*/
__u64 obj_offset;
/** @userptr: user pointer to bind on */
__u64 userptr;
};
/**
* @range: Number of bytes from the object to bind to addr, MBZ for UNMAP_ALL
*/
__u64 range;
/** @addr: Address to operate on, MBZ for UNMAP_ALL */
__u64 addr;
#define DRM_XE_VM_BIND_OP_MAP 0x0
#define DRM_XE_VM_BIND_OP_UNMAP 0x1
#define DRM_XE_VM_BIND_OP_MAP_USERPTR 0x2
#define DRM_XE_VM_BIND_OP_UNMAP_ALL 0x3
#define DRM_XE_VM_BIND_OP_PREFETCH 0x4
/** @op: Bind operation to perform */
__u32 op;
#define DRM_XE_VM_BIND_FLAG_READONLY (1 << 0)
#define DRM_XE_VM_BIND_FLAG_IMMEDIATE (1 << 1)
#define DRM_XE_VM_BIND_FLAG_NULL (1 << 2)
#define DRM_XE_VM_BIND_FLAG_DUMPABLE (1 << 3)
/** @flags: Bind flags */
__u32 flags;
/**
* @prefetch_mem_region_instance: Memory region to prefetch VMA to.
* It is a region instance, not a mask.
* To be used only with %DRM_XE_VM_BIND_OP_PREFETCH operation.
*/
__u32 prefetch_mem_region_instance;
/** @pad2: MBZ */
__u32 pad2;
/** @reserved: Reserved */
__u64 reserved[3];
};
/**
* struct drm_xe_vm_bind - Input of &DRM_IOCTL_XE_VM_BIND
*
* Below is an example of a minimal use of @drm_xe_vm_bind to
* asynchronously bind the buffer `data` at address `BIND_ADDRESS` to
* illustrate `userptr`. It can be synchronized by using the example
* provided for @drm_xe_sync.
*
* .. code-block:: C
*
* data = aligned_alloc(ALIGNMENT, BO_SIZE);
* struct drm_xe_vm_bind bind = {
* .vm_id = vm,
* .num_binds = 1,
* .bind.obj = 0,
* .bind.obj_offset = to_user_pointer(data),
* .bind.range = BO_SIZE,
* .bind.addr = BIND_ADDRESS,
* .bind.op = DRM_XE_VM_BIND_OP_MAP_USERPTR,
* .bind.flags = 0,
* .num_syncs = 1,
* .syncs = &sync,
* .exec_queue_id = 0,
* };
* ioctl(fd, DRM_IOCTL_XE_VM_BIND, &bind);
*
*/
struct drm_xe_vm_bind {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @vm_id: The ID of the VM to bind to */
__u32 vm_id;
/**
* @exec_queue_id: exec_queue_id, must be of class DRM_XE_ENGINE_CLASS_VM_BIND
* and exec queue must have same vm_id. If zero, the default VM bind engine
* is used.
*/
__u32 exec_queue_id;
/** @pad: MBZ */
__u32 pad;
/** @num_binds: number of binds in this IOCTL */
__u32 num_binds;
union {
/** @bind: used if num_binds == 1 */
struct drm_xe_vm_bind_op bind;
/**
* @vector_of_binds: userptr to array of struct
* drm_xe_vm_bind_op if num_binds > 1
*/
__u64 vector_of_binds;
};
/** @pad2: MBZ */
__u32 pad2;
/** @num_syncs: amount of syncs to wait on */
__u32 num_syncs;
/** @syncs: pointer to struct drm_xe_sync array */
__u64 syncs;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_exec_queue_create - Input of &DRM_IOCTL_XE_EXEC_QUEUE_CREATE
*
* The example below shows how to use @drm_xe_exec_queue_create to create
* a simple exec_queue (no parallel submission) of class
* &DRM_XE_ENGINE_CLASS_RENDER.
*
* .. code-block:: C
*
* struct drm_xe_engine_class_instance instance = {
* .engine_class = DRM_XE_ENGINE_CLASS_RENDER,
* };
* struct drm_xe_exec_queue_create exec_queue_create = {
* .extensions = 0,
* .vm_id = vm,
* .num_bb_per_exec = 1,
* .num_eng_per_bb = 1,
* .instances = to_user_pointer(&instance),
* };
* ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &exec_queue_create);
*
*/
struct drm_xe_exec_queue_create {
#define DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY 0
#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY 0
#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE 1
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @width: submission width (number BB per exec) for this exec queue */
__u16 width;
/** @num_placements: number of valid placements for this exec queue */
__u16 num_placements;
/** @vm_id: VM to use for this exec queue */
__u32 vm_id;
/** @flags: MBZ */
__u32 flags;
/** @exec_queue_id: Returned exec queue ID */
__u32 exec_queue_id;
/**
* @instances: user pointer to a 2-d array of struct
* drm_xe_engine_class_instance
*
* length = width (i) * num_placements (j)
* index = j + i * width
*/
__u64 instances;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_exec_queue_destroy - Input of &DRM_IOCTL_XE_EXEC_QUEUE_DESTROY
*/
struct drm_xe_exec_queue_destroy {
/** @exec_queue_id: Exec queue ID */
__u32 exec_queue_id;
/** @pad: MBZ */
__u32 pad;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_exec_queue_get_property - Input of &DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY
*
* The @property can be:
* - %DRM_XE_EXEC_QUEUE_GET_PROPERTY_BAN
*/
struct drm_xe_exec_queue_get_property {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @exec_queue_id: Exec queue ID */
__u32 exec_queue_id;
#define DRM_XE_EXEC_QUEUE_GET_PROPERTY_BAN 0
/** @property: property to get */
__u32 property;
/** @value: property value */
__u64 value;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_sync - sync object
*
* The @type can be:
* - %DRM_XE_SYNC_TYPE_SYNCOBJ
* - %DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ
* - %DRM_XE_SYNC_TYPE_USER_FENCE
*
* and the @flags can be:
* - %DRM_XE_SYNC_FLAG_SIGNAL
*
* A minimal use of @drm_xe_sync looks like this:
*
* .. code-block:: C
*
* struct drm_xe_sync sync = {
* .flags = DRM_XE_SYNC_FLAG_SIGNAL,
* .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
* };
* struct drm_syncobj_create syncobj_create = { 0 };
* ioctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &syncobj_create);
* sync.handle = syncobj_create.handle;
* ...
* use of &sync in drm_xe_exec or drm_xe_vm_bind
* ...
* struct drm_syncobj_wait wait = {
* .handles = &sync.handle,
* .timeout_nsec = INT64_MAX,
* .count_handles = 1,
* .flags = 0,
* .first_signaled = 0,
* .pad = 0,
* };
* ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait);
*/
struct drm_xe_sync {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
#define DRM_XE_SYNC_TYPE_SYNCOBJ 0x0
#define DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ 0x1
#define DRM_XE_SYNC_TYPE_USER_FENCE 0x2
/** @type: Type of the this sync object */
__u32 type;
#define DRM_XE_SYNC_FLAG_SIGNAL (1 << 0)
/** @flags: Sync Flags */
__u32 flags;
union {
/** @handle: Handle for the object */
__u32 handle;
/**
* @addr: Address of user fence. When sync is passed in via exec
* IOCTL this is a GPU address in the VM. When sync passed in via
* VM bind IOCTL this is a user pointer. In either case, it is
* the users responsibility that this address is present and
* mapped when the user fence is signalled. Must be qword
* aligned.
*/
__u64 addr;
};
/**
* @timeline_value: Input for the timeline sync object. Needs to be
* different than 0 when used with %DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ.
*/
__u64 timeline_value;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_exec - Input of &DRM_IOCTL_XE_EXEC
*
* This is an example to use @drm_xe_exec for execution of the object
* at BIND_ADDRESS (see example in @drm_xe_vm_bind) by an exec_queue
* (see example in @drm_xe_exec_queue_create). It can be synchronized
* by using the example provided for @drm_xe_sync.
*
* .. code-block:: C
*
* struct drm_xe_exec exec = {
* .exec_queue_id = exec_queue,
* .syncs = &sync,
* .num_syncs = 1,
* .address = BIND_ADDRESS,
* .num_batch_buffer = 1,
* };
* ioctl(fd, DRM_IOCTL_XE_EXEC, &exec);
*
*/
struct drm_xe_exec {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @exec_queue_id: Exec queue ID for the batch buffer */
__u32 exec_queue_id;
/** @num_syncs: Amount of struct drm_xe_sync in array. */
__u32 num_syncs;
/** @syncs: Pointer to struct drm_xe_sync array. */
__u64 syncs;
/**
* @address: address of batch buffer if num_batch_buffer == 1 or an
* array of batch buffer addresses
*/
__u64 address;
/**
* @num_batch_buffer: number of batch buffer in this exec, must match
* the width of the engine
*/
__u16 num_batch_buffer;
/** @pad: MBZ */
__u16 pad[3];
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* struct drm_xe_wait_user_fence - Input of &DRM_IOCTL_XE_WAIT_USER_FENCE
*
* Wait on user fence, XE will wake-up on every HW engine interrupt in the
* instances list and check if user fence is complete::
*
* (*addr & MASK) OP (VALUE & MASK)
*
* Returns to user on user fence completion or timeout.
*
* The @op can be:
* - %DRM_XE_UFENCE_WAIT_OP_EQ
* - %DRM_XE_UFENCE_WAIT_OP_NEQ
* - %DRM_XE_UFENCE_WAIT_OP_GT
* - %DRM_XE_UFENCE_WAIT_OP_GTE
* - %DRM_XE_UFENCE_WAIT_OP_LT
* - %DRM_XE_UFENCE_WAIT_OP_LTE
*
* and the @flags can be:
* - %DRM_XE_UFENCE_WAIT_FLAG_ABSTIME
* - %DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP
*
* The @mask values can be for example:
* - 0xffu for u8
* - 0xffffu for u16
* - 0xffffffffu for u32
* - 0xffffffffffffffffu for u64
*/
struct drm_xe_wait_user_fence {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/**
* @addr: user pointer address to wait on, must qword aligned
*/
__u64 addr;
#define DRM_XE_UFENCE_WAIT_OP_EQ 0x0
#define DRM_XE_UFENCE_WAIT_OP_NEQ 0x1
#define DRM_XE_UFENCE_WAIT_OP_GT 0x2
#define DRM_XE_UFENCE_WAIT_OP_GTE 0x3
#define DRM_XE_UFENCE_WAIT_OP_LT 0x4
#define DRM_XE_UFENCE_WAIT_OP_LTE 0x5
/** @op: wait operation (type of comparison) */
__u16 op;
#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 0)
/** @flags: wait flags */
__u16 flags;
/** @pad: MBZ */
__u32 pad;
/** @value: compare value */
__u64 value;
/** @mask: comparison mask */
__u64 mask;
/**
* @timeout: how long to wait before bailing, value in nanoseconds.
* Without DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flag set (relative timeout)
* it contains timeout expressed in nanoseconds to wait (fence will
* expire at now() + timeout).
* When DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flat is set (absolute timeout) wait
* will end at timeout (uses system MONOTONIC_CLOCK).
* Passing negative timeout leads to neverending wait.
*
* On relative timeout this value is updated with timeout left
* (for restarting the call in case of signal delivery).
* On absolute timeout this value stays intact (restarted call still
* expire at the same point of time).
*/
__s64 timeout;
/** @exec_queue_id: exec_queue_id returned from xe_exec_queue_create_ioctl */
__u32 exec_queue_id;
/** @pad2: MBZ */
__u32 pad2;
/** @reserved: Reserved */
__u64 reserved[2];
};
/**
* enum drm_xe_observation_type - Observation stream types
*/
enum drm_xe_observation_type {
/** @DRM_XE_OBSERVATION_TYPE_OA: OA observation stream type */
DRM_XE_OBSERVATION_TYPE_OA,
};
/**
* enum drm_xe_observation_op - Observation stream ops
*/
enum drm_xe_observation_op {
/** @DRM_XE_OBSERVATION_OP_STREAM_OPEN: Open an observation stream */
DRM_XE_OBSERVATION_OP_STREAM_OPEN,
/** @DRM_XE_OBSERVATION_OP_ADD_CONFIG: Add observation stream config */
DRM_XE_OBSERVATION_OP_ADD_CONFIG,
/** @DRM_XE_OBSERVATION_OP_REMOVE_CONFIG: Remove observation stream config */
DRM_XE_OBSERVATION_OP_REMOVE_CONFIG,
};
/**
* struct drm_xe_observation_param - Input of &DRM_XE_OBSERVATION
*
* The observation layer enables multiplexing observation streams of
* multiple types. The actual params for a particular stream operation are
* supplied via the @param pointer (use __copy_from_user to get these
* params).
*/
struct drm_xe_observation_param {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @observation_type: observation stream type, of enum @drm_xe_observation_type */
__u64 observation_type;
/** @observation_op: observation stream op, of enum @drm_xe_observation_op */
__u64 observation_op;
/** @param: Pointer to actual stream params */
__u64 param;
};
/**
* enum drm_xe_observation_ioctls - Observation stream fd ioctl's
*
* Information exchanged between userspace and kernel for observation fd
* ioctl's is stream type specific
*/
enum drm_xe_observation_ioctls {
/** @DRM_XE_OBSERVATION_IOCTL_ENABLE: Enable data capture for an observation stream */
DRM_XE_OBSERVATION_IOCTL_ENABLE = _IO('i', 0x0),
/** @DRM_XE_OBSERVATION_IOCTL_DISABLE: Disable data capture for a observation stream */
DRM_XE_OBSERVATION_IOCTL_DISABLE = _IO('i', 0x1),
/** @DRM_XE_OBSERVATION_IOCTL_CONFIG: Change observation stream configuration */
DRM_XE_OBSERVATION_IOCTL_CONFIG = _IO('i', 0x2),
/** @DRM_XE_OBSERVATION_IOCTL_STATUS: Return observation stream status */
DRM_XE_OBSERVATION_IOCTL_STATUS = _IO('i', 0x3),
/** @DRM_XE_OBSERVATION_IOCTL_INFO: Return observation stream info */
DRM_XE_OBSERVATION_IOCTL_INFO = _IO('i', 0x4),
};
/**
* enum drm_xe_oa_unit_type - OA unit types
*/
enum drm_xe_oa_unit_type {
/**
* @DRM_XE_OA_UNIT_TYPE_OAG: OAG OA unit. OAR/OAC are considered
* sub-types of OAG. For OAR/OAC, use OAG.
*/
DRM_XE_OA_UNIT_TYPE_OAG,
/** @DRM_XE_OA_UNIT_TYPE_OAM: OAM OA unit */
DRM_XE_OA_UNIT_TYPE_OAM,
};
/**
* struct drm_xe_oa_unit - describe OA unit
*/
struct drm_xe_oa_unit {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @oa_unit_id: OA unit ID */
__u32 oa_unit_id;
/** @oa_unit_type: OA unit type of @drm_xe_oa_unit_type */
__u32 oa_unit_type;
/** @capabilities: OA capabilities bit-mask */
__u64 capabilities;
#define DRM_XE_OA_CAPS_BASE (1 << 0)
/** @oa_timestamp_freq: OA timestamp freq */
__u64 oa_timestamp_freq;
/** @reserved: MBZ */
__u64 reserved[4];
/** @num_engines: number of engines in @eci array */
__u64 num_engines;
/** @eci: engines attached to this OA unit */
struct drm_xe_engine_class_instance eci[];
};
/**
* struct drm_xe_query_oa_units - describe OA units
*
* If a query is made with a struct drm_xe_device_query where .query
* is equal to DRM_XE_DEVICE_QUERY_OA_UNITS, then the reply uses struct
* drm_xe_query_oa_units in .data.
*
* OA unit properties for all OA units can be accessed using a code block
* such as the one below:
*
* .. code-block:: C
*
* struct drm_xe_query_oa_units *qoa;
* struct drm_xe_oa_unit *oau;
* u8 *poau;
*
* // malloc qoa and issue DRM_XE_DEVICE_QUERY_OA_UNITS. Then:
* poau = (u8 *)&qoa->oa_units[0];
* for (int i = 0; i < qoa->num_oa_units; i++) {
* oau = (struct drm_xe_oa_unit *)poau;
* // Access 'struct drm_xe_oa_unit' fields here
* poau += sizeof(*oau) + oau->num_engines * sizeof(oau->eci[0]);
* }
*/
struct drm_xe_query_oa_units {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @num_oa_units: number of OA units returned in oau[] */
__u32 num_oa_units;
/** @pad: MBZ */
__u32 pad;
/**
* @oa_units: struct @drm_xe_oa_unit array returned for this device.
* Written below as a u64 array to avoid problems with nested flexible
* arrays with some compilers
*/
__u64 oa_units[];
};
/**
* enum drm_xe_oa_format_type - OA format types as specified in PRM/Bspec
* 52198/60942
*/
enum drm_xe_oa_format_type {
/** @DRM_XE_OA_FMT_TYPE_OAG: OAG report format */
DRM_XE_OA_FMT_TYPE_OAG,
/** @DRM_XE_OA_FMT_TYPE_OAR: OAR report format */
DRM_XE_OA_FMT_TYPE_OAR,
/** @DRM_XE_OA_FMT_TYPE_OAM: OAM report format */
DRM_XE_OA_FMT_TYPE_OAM,
/** @DRM_XE_OA_FMT_TYPE_OAC: OAC report format */
DRM_XE_OA_FMT_TYPE_OAC,
/** @DRM_XE_OA_FMT_TYPE_OAM_MPEC: OAM SAMEDIA or OAM MPEC report format */
DRM_XE_OA_FMT_TYPE_OAM_MPEC,
/** @DRM_XE_OA_FMT_TYPE_PEC: PEC report format */
DRM_XE_OA_FMT_TYPE_PEC,
};
/**
* enum drm_xe_oa_property_id - OA stream property id's
*
* Stream params are specified as a chain of @drm_xe_ext_set_property
* struct's, with @property values from enum @drm_xe_oa_property_id and
* @drm_xe_user_extension base.name set to @DRM_XE_OA_EXTENSION_SET_PROPERTY.
* @param field in struct @drm_xe_observation_param points to the first
* @drm_xe_ext_set_property struct.
*
* Exactly the same mechanism is also used for stream reconfiguration using the
* @DRM_XE_OBSERVATION_IOCTL_CONFIG observation stream fd ioctl, though only a
* subset of properties below can be specified for stream reconfiguration.
*/
enum drm_xe_oa_property_id {
#define DRM_XE_OA_EXTENSION_SET_PROPERTY 0
/**
* @DRM_XE_OA_PROPERTY_OA_UNIT_ID: ID of the OA unit on which to open
* the OA stream, see @oa_unit_id in 'struct
* drm_xe_query_oa_units'. Defaults to 0 if not provided.
*/
DRM_XE_OA_PROPERTY_OA_UNIT_ID = 1,
/**
* @DRM_XE_OA_PROPERTY_SAMPLE_OA: A value of 1 requests inclusion of raw
* OA unit reports or stream samples in a global buffer attached to an
* OA unit.
*/
DRM_XE_OA_PROPERTY_SAMPLE_OA,
/**
* @DRM_XE_OA_PROPERTY_OA_METRIC_SET: OA metrics defining contents of OA
* reports, previously added via @DRM_XE_OBSERVATION_OP_ADD_CONFIG.
*/
DRM_XE_OA_PROPERTY_OA_METRIC_SET,
/** @DRM_XE_OA_PROPERTY_OA_FORMAT: OA counter report format */
DRM_XE_OA_PROPERTY_OA_FORMAT,
/*
* OA_FORMAT's are specified the same way as in PRM/Bspec 52198/60942,
* in terms of the following quantities: a. enum @drm_xe_oa_format_type
* b. Counter select c. Counter size and d. BC report. Also refer to the
* oa_formats array in drivers/gpu/drm/xe/xe_oa.c.
*/
#define DRM_XE_OA_FORMAT_MASK_FMT_TYPE (0xffu << 0)
#define DRM_XE_OA_FORMAT_MASK_COUNTER_SEL (0xffu << 8)
#define DRM_XE_OA_FORMAT_MASK_COUNTER_SIZE (0xffu << 16)
#define DRM_XE_OA_FORMAT_MASK_BC_REPORT (0xffu << 24)
/**
* @DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT: Requests periodic OA unit
* sampling with sampling frequency proportional to 2^(period_exponent + 1)
*/
DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT,
/**
* @DRM_XE_OA_PROPERTY_OA_DISABLED: A value of 1 will open the OA
* stream in a DISABLED state (see @DRM_XE_OBSERVATION_IOCTL_ENABLE).
*/
DRM_XE_OA_PROPERTY_OA_DISABLED,
/**
* @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID: Open the stream for a specific
* @exec_queue_id. OA queries can be executed on this exec queue.
*/
DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID,
/**
* @DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE: Optional engine instance to
* pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0.
*/
DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE,
/**
* @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing
* to be disabled for the stream exec queue.
*/
DRM_XE_OA_PROPERTY_NO_PREEMPT,
};
/**
* struct drm_xe_oa_config - OA metric configuration
*
* Multiple OA configs can be added using @DRM_XE_OBSERVATION_OP_ADD_CONFIG. A
* particular config can be specified when opening an OA stream using
* @DRM_XE_OA_PROPERTY_OA_METRIC_SET property.
*/
struct drm_xe_oa_config {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @uuid: String formatted like "%\08x-%\04x-%\04x-%\04x-%\012x" */
char uuid[36];
/** @n_regs: Number of regs in @regs_ptr */
__u32 n_regs;
/**
* @regs_ptr: Pointer to (register address, value) pairs for OA config
* registers. Expected length of buffer is: (2 * sizeof(u32) * @n_regs).
*/
__u64 regs_ptr;
};
/**
* struct drm_xe_oa_stream_status - OA stream status returned from
* @DRM_XE_OBSERVATION_IOCTL_STATUS observation stream fd ioctl. Userspace can
* call the ioctl to query stream status in response to EIO errno from
* observation fd read().
*/
struct drm_xe_oa_stream_status {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @oa_status: OA stream status (see Bspec 46717/61226) */
__u64 oa_status;
#define DRM_XE_OASTATUS_MMIO_TRG_Q_FULL (1 << 3)
#define DRM_XE_OASTATUS_COUNTER_OVERFLOW (1 << 2)
#define DRM_XE_OASTATUS_BUFFER_OVERFLOW (1 << 1)
#define DRM_XE_OASTATUS_REPORT_LOST (1 << 0)
/** @reserved: reserved for future use */
__u64 reserved[3];
};
/**
* struct drm_xe_oa_stream_info - OA stream info returned from
* @DRM_XE_OBSERVATION_IOCTL_INFO observation stream fd ioctl
*/
struct drm_xe_oa_stream_info {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @oa_buf_size: OA buffer size */
__u64 oa_buf_size;
/** @reserved: reserved for future use */
__u64 reserved[3];
};
#if defined(__cplusplus)
}
#endif
#endif /* _UAPI_XE_DRM_H_ */
================================================
FILE: include/list.h
================================================
/*
* Copyright (C) 2002 Free Software Foundation, Inc.
* (originally part of the GNU C Library)
* Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
*
* Copyright (C) 2009 Pierre-Marc Fournier
* Conversion to RCU list.
* Copyright (C) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _LIST_H
#define _LIST_H 1
#include <stddef.h>
/*
* container_of - Get the address of an object containing a field.
*
* @ptr: pointer to the field.
* @type: type of the object.
* @member: name of the field within the object.
*/
#define container_of(ptr, type, member) \
__extension__ \
({ \
const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \
(type *)((char *)__ptr - offsetof(type, member)); \
})
/*
* The definitions of this file are adopted from those which can be
* found in the Linux kernel headers to enable people familiar with the
* latter find their way in these sources as well.
*/
/* Basic type for the double-link list. */
struct list_head {
struct list_head *next, *prev;
};
/* Define a variable with the head and tail of the list. */
#define LIST_HEAD(name) \
struct list_head name = { &(name), &(name) }
/* Initialize a new list head. */
#define INIT_LIST_HEAD(ptr) \
(ptr)->next = (ptr)->prev = (ptr)
#define LIST_HEAD_INIT(name) { .next = &(name), .prev = &(name) }
/* Add new element at the head of the list. */
static inline
void list_add(struct list_head *newp, struct list_head *head)
{
head->next->prev = newp;
newp->next = head->next;
newp->prev = head;
head->next = newp;
}
/* Add new element at the tail of the list. */
static inline
void list_add_tail(struct list_head *newp, struct list_head *head)
{
head->prev->next = newp;
newp->next = head;
newp->prev = head->prev;
head->prev = newp;
}
/* Remove element from list. */
static inline
void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
}
/* Remove element from list. */
static inline
void list_del(struct list_head *elem)
{
__list_del(elem->prev, elem->next);
}
/* Remove element from list, initializing the element's list pointers. */
static inline
void list_del_init(struct list_head *elem)
{
list_del(elem);
INIT_LIST_HEAD(elem);
}
/* Delete from list, add to another list as head. */
static inline
void list_move(struct list_head *elem, struct list_head *head)
{
__list_del(elem->prev, elem->next);
list_add(elem, head);
}
/* Delete from list, add to another list as tail. */
static inline
void list_move_tail(struct list_head *elem, struct list_head *head)
{
__list_del(elem->prev, elem->next);
list_add_tail(elem, head);
}
/* Replace an old entry. */
static inline
void list_replace(struct list_head *old, struct list_head *_new)
{
_new->next = old->next;
_new->prev = old->prev;
_new->prev->next = _new;
_new->next->prev = _new;
}
/* Join two lists. */
static inline
void list_splice(struct list_head *add, struct list_head *head)
{
/* Do nothing if the list which gets added is empty. */
if (add != add->next) {
add->next->prev = head;
add->prev->next = head->next;
head->next->prev = add->prev;
head->next = add->next;
}
}
/* Get typed element from list at a given position. */
#define list_entry(ptr, type, member) container_of(ptr, type, member)
/* Get first entry from a list. */
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
/* Iterate forward over the elements of the list. */
#define list_for_each(pos, head) \
for (pos = (head)->next; (pos) != (head); pos = (pos)->next)
/*
* Iterate forward over the elements list. The list elements can be
* removed from the list while doing this.
*/
#define list_for_each_safe(pos, p, head) \
for (pos = (head)->next, p = (pos)->next; \
(pos) != (head); \
pos = (p), p = (pos)->next)
/* Iterate backward over the elements of the list. */
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; (pos) != (head); pos = (pos)->prev)
/*
* Iterate backwards over the elements list. The list elements can be
* removed from the list while doing this.
*/
#define list_for_each_prev_safe(pos, p, head) \
for (pos = (head)->prev, p = (pos)->prev; \
(pos) != (head); \
pos = (p), p = (pos)->prev)
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, __typeof__(*(pos)), member); \
&(pos)->member != (head); \
pos = list_entry((pos)->member.next, __typeof__(*(pos)), member))
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, __typeof__(*(pos)), member); \
&(pos)->member != (head); \
pos = list_entry((pos)->member.prev, __typeof__(*(pos)), member))
#define list_for_each_entry_safe(pos, p, head, member) \
for (pos = list_entry((head)->next, __typeof__(*(pos)), member), \
p = list_entry((pos)->member.next, __typeof__(*(pos)), member); \
&(pos)->member != (head); \
pos = (p), p = list_entry((pos)->member.next, __typeof__(*(pos)), member))
#define list_for_each_entry_reverse_safe(pos, p, head, member) \
for (pos = list_entry((head)->prev, __typeof__(*(pos)), member), \
p = list_entry((pos)->member.prev, __typeof__(*(pos)), member); \
&(pos)->member != (head); pos = (p), p = list_entry((pos)->member.prev, __typeof__(*(pos)), member))
/*
* Same as list_for_each_entry_safe, but starts from "pos" which should
* point to an entry within the list.
*/
#define list_for_each_entry_safe_from(pos, p, head, member) \
for (p = list_entry((pos)->member.next, __typeof__(*(pos)), member); \
&(pos)->member != (head); \
pos = (p), p = list_entry((pos)->member.next, __typeof__(*(pos)), member))
static inline
int list_empty(struct list_head *head)
{
return head == head->next;
}
static inline
void list_replace_init(struct list_head *old,
struct list_head *_new)
{
struct list_head *head = old->next;
list_del(old);
list_add_tail(_new, head);
INIT_LIST_HEAD(old);
}
#endif /* _LIST_H */
================================================
FILE: include/nvtop/common.h
================================================
/*
*
* Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>
*
* This file is part of Nvtop.
*
* Nvtop is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nvtop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with nvtop. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef NVTOP_COMMON_H__
#define NVTOP_COMMON_H__
#if !defined(HAS_REALLOCARRAY)
#include <errno.h>
#include <stdlib.h>
#undef reallocarray
// Reallocarray from musl libc (https://git.musl-libc.org/cgit/musl/tree/src/malloc/reallocarray.c)
static void *nvtop_reallocarray__(void *ptr, size_t nmemb, size_t size) {
if (size && nmemb > -1 / size) {
errno = ENOMEM;
return NULL;
}
return realloc(ptr, nmemb * size);
}
#define reallocarray(ptr, nmemb, size) nvtop_reallocarray__(ptr, nmemb, size)
#endif // !defined(HAS_REALLOCARRAY)
// Increment for the number of tracked processes
// 16 has been experimentally selected for being small while avoiding multiple allocations in most common cases
#define COMMON_PROCESS_LINEAR_REALLOC_INC 16
#define MAX_LINES_PER_PLOT 4
// Helper macro to stringify an integer
#define QUOTE(x) #x
#define EXPAND_AND_QUOTE(x) QUOTE(x)
#endif // NVTOP_COMMON_H__
================================================
FILE: include/nvtop/device_discovery.h
================================================
/*
*
* Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>
*
* This file is part of Nvtop.
*
* Nvtop is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Nvtop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with nvtop. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef NVTOP_DEVICE_DISCOVERY_H__
#define NVTOP_DEVICE_DISCOVERY_H__
// Devices
typedef struct nvtop_device nvtop_device;
nvtop_device *nvtop_device_ref(nvtop_device *device);
nvtop_device *nvtop_device_unref(nvtop_device *device);
int nvtop_device_new_from_syspath(nvtop_device **ret, const char *syspath);
int nvtop_device_get_parent(nvtop_device *child, nvtop_device **parent);
int nvtop_device_get_driver(nvtop_device *device, const char **driver);
int nvtop_device_get_devname(nvtop_device *device, const char **devname);
int nvtop_device_get_property_value(nvtop_device *device, const char *key, const char **value);
int nvtop_device_get_sysattr_value(nvtop_device *device, const char *sysattr, const char **value);
int nvtop_device_get_syspath(nvtop_device *device, const char **sysPath);
// Devices enumerator
typedef struct nvtop_device_enumerator nvtop_device_enumerator;
int nvtop_enumerator_new(nvtop_device_enumerator **enumerator);
nvtop_device_enumerator *nvtop_enumerator_ref(nvtop_device_enumerator *enumerator);
nvtop_device_enumerator *nvtop_enumerator_unref(nvtop_device_enumerator *enumerator);
int nvtop_device_enumerator_add_match_subsystem(nvtop_device_enumerator *enumerator, const char *subsystem, int match);
int nvtop_device_enumerator_add_match_property(nvtop_device_enumerator *enumerator, const char *property,
const char *value);
int nvtop_device_enumerator_add_match_parent(nvtop_device_enumerator *enumerator, nvtop_device *parent);
nvtop_device *nvtop_enumerator_get_device_first(nvtop_device_enumerator *enumerator);
nvtop_device *nvtop_enumerator_get_device_next(nvtop_device_enumerator *enumerator);
typedef struct {
unsigned width;
unsigned speed;
} nvtop_pcie_link;
int nvtop_device_maximum_pcie_link(nvtop_device *dev, nvtop_pcie_link *pcie_info);
int nvtop_device_current_pcie_link(nvtop_device *dev, nvtop_pcie_link *pcie_info);
nvtop_device *nvtop_device_get_hwmon(nvtop_device *dev);
#endif // NVTOP_DEVICE_DISCOVERY_H__
================================================
FILE: include/nvtop/extract_gpuinfo.h
================================================
/*
*
* Copyright (C) 2017-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>
*
* This file is part of Nvtop.
*
* Nvtop is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any l
gitextract_spmzcg02/
├── .clang-format
├── .github/
│ └── workflows/
│ └── compile.yml
├── .gitignore
├── AppImage/
│ ├── README.md
│ └── make_appimage.sh
├── CMakeLists.txt
├── COPYING
├── Dockerfile
├── README.markdown
├── cmake/
│ ├── cmake_uninstall.cmake.in
│ ├── compile-flags-helpers.cmake
│ ├── modules/
│ │ ├── FindASan.cmake
│ │ ├── FindCurses.cmake
│ │ ├── FindLibdrm.cmake
│ │ ├── FindMSan.cmake
│ │ ├── FindSanitizers.cmake
│ │ ├── FindSystemd.cmake
│ │ ├── FindTSan.cmake
│ │ ├── FindUBSan.cmake
│ │ ├── FindUDev.cmake
│ │ ├── asan-wrapper
│ │ └── sanitize-helpers.cmake
│ └── optimization_flags.cmake
├── desktop/
│ ├── nvtop.desktop
│ └── nvtop.metainfo.xml.in
├── include/
│ ├── ascend/
│ │ └── dcmi_interface_api.h
│ ├── ini.h
│ ├── libdrm/
│ │ └── xe_drm.h
│ ├── list.h
│ ├── nvtop/
│ │ ├── common.h
│ │ ├── device_discovery.h
│ │ ├── extract_gpuinfo.h
│ │ ├── extract_gpuinfo_common.h
│ │ ├── extract_processinfo_fdinfo.h
│ │ ├── get_process_info.h
│ │ ├── info_messages.h
│ │ ├── interface.h
│ │ ├── interface_common.h
│ │ ├── interface_internal_common.h
│ │ ├── interface_layout_selection.h
│ │ ├── interface_options.h
│ │ ├── interface_ring_buffer.h
│ │ ├── interface_setup_win.h
│ │ ├── plot.h
│ │ ├── time.h
│ │ └── version.h.in
│ └── uthash.h
├── manpage/
│ └── nvtop.in
├── snap/
│ └── snapcraft.yaml
├── src/
│ ├── CMakeLists.txt
│ ├── amdgpu_ids.h
│ ├── device_discovery_linux.c
│ ├── extract_gcuinfo_enflame.c
│ ├── extract_gpuinfo.c
│ ├── extract_gpuinfo_amdgpu.c
│ ├── extract_gpuinfo_amdgpu_utils.c
│ ├── extract_gpuinfo_apple.m
│ ├── extract_gpuinfo_ascend.c
│ ├── extract_gpuinfo_intel.c
│ ├── extract_gpuinfo_intel.h
│ ├── extract_gpuinfo_intel_i915.c
│ ├── extract_gpuinfo_intel_xe.c
│ ├── extract_gpuinfo_mali_common.c
│ ├── extract_gpuinfo_metax.c
│ ├── extract_gpuinfo_msm.c
│ ├── extract_gpuinfo_msm_utils.c
│ ├── extract_gpuinfo_nvidia.c
│ ├── extract_gpuinfo_panfrost.c
│ ├── extract_gpuinfo_panfrost_utils.c
│ ├── extract_gpuinfo_panthor.c
│ ├── extract_gpuinfo_panthor_utils.c
│ ├── extract_gpuinfo_tpu.c
│ ├── extract_gpuinfo_v3d.c
│ ├── extract_gpuinfo_v3d_utils.c
│ ├── extract_npuinfo_rockchip.c
│ ├── extract_processinfo_fdinfo.c
│ ├── extract_processinfo_mac.c
│ ├── get_process_info_linux.c
│ ├── get_process_info_mac.c
│ ├── info_messages_linux.c
│ ├── info_messages_mac.c
│ ├── ini.c
│ ├── interface.c
│ ├── interface_layout_selection.c
│ ├── interface_options.c
│ ├── interface_ring_buffer.c
│ ├── interface_setup_win.c
│ ├── mali_common.h
│ ├── nvtop.c
│ ├── panfrost_drm.h
│ ├── panfrost_utils.h
│ ├── panthor_drm.h
│ ├── panthor_utils.h
│ ├── plot.c
│ └── time.c
└── tests/
├── CMakeLists.txt
└── interfaceTests.cpp
SYMBOL INDEX (835 symbols across 60 files)
FILE: include/ascend/dcmi_interface_api.h
type dcmi_chip_info (line 47) | struct dcmi_chip_info {
type dcmi_pcie_info_all (line 54) | struct dcmi_pcie_info_all {
type dcmi_die_id (line 66) | struct dcmi_die_id {
type dcmi_hbm_info (line 70) | struct dcmi_hbm_info {
type dcmi_get_memory_info_stru (line 78) | struct dcmi_get_memory_info_stru {
type dcmi_ip_addr_type (line 89) | enum dcmi_ip_addr_type {
type dcmi_ip_addr (line 95) | struct dcmi_ip_addr {
type dcmi_unit_type (line 103) | enum dcmi_unit_type {
type dcmi_rdfx_detect_result (line 110) | enum dcmi_rdfx_detect_result {
type dcmi_port_type (line 123) | enum dcmi_port_type {
type dcmi_main_cmd (line 129) | enum dcmi_main_cmd {
type dcmi_freq_type (line 143) | enum dcmi_freq_type {
type dcmi_reset_channel (line 152) | enum dcmi_reset_channel {
type dcmi_boot_status (line 157) | enum dcmi_boot_status {
type dcmi_event_type (line 164) | enum dcmi_event_type {
type dcmi_die_type (line 168) | enum dcmi_die_type {
type dcmi_base_resource (line 184) | struct dcmi_base_resource {
type dcmi_computing_resource (line 194) | struct dcmi_computing_resource {
type dcmi_media_resource (line 231) | struct dcmi_media_resource {
type dcmi_create_vdev_out (line 242) | struct dcmi_create_vdev_out {
type dcmi_create_vdev_res_stru (line 251) | struct dcmi_create_vdev_res_stru {
type dcmi_vdev_query_info (line 258) | struct dcmi_vdev_query_info {
type dcmi_vdev_query_stru (line 271) | struct dcmi_vdev_query_stru {
type dcmi_soc_free_resource (line 276) | struct dcmi_soc_free_resource {
type dcmi_soc_total_resource (line 284) | struct dcmi_soc_total_resource {
type dcmi_dms_fault_event (line 294) | struct dcmi_dms_fault_event {
type dcmi_event (line 312) | struct dcmi_event {
type dcmi_event_filter (line 319) | struct dcmi_event_filter {
type dcmi_proc_mem_info (line 336) | struct dcmi_proc_mem_info {
type dcmi_board_info (line 342) | struct dcmi_board_info {
type dsmi_hbm_info_stru (line 349) | struct dsmi_hbm_info_stru {
type dcmi_unit_type (line 370) | enum dcmi_unit_type
type dcmi_pcie_info_all (line 372) | struct dcmi_pcie_info_all
type dcmi_chip_info (line 374) | struct dcmi_chip_info
type dcmi_freq_type (line 388) | enum dcmi_freq_type
type dcmi_hbm_info (line 390) | struct dcmi_hbm_info
type dcmi_get_memory_info_stru (line 393) | struct dcmi_get_memory_info_stru
type dcmi_main_cmd (line 399) | enum dcmi_main_cmd
type dcmi_port_type (line 401) | enum dcmi_port_type
type dcmi_ip_addr (line 402) | struct dcmi_ip_addr
type dcmi_ip_addr (line 402) | struct dcmi_ip_addr
type dcmi_rdfx_detect_result (line 404) | enum dcmi_rdfx_detect_result
type dcmi_create_vdev_res_stru (line 408) | struct dcmi_create_vdev_res_stru
type dcmi_create_vdev_out (line 409) | struct dcmi_create_vdev_out
type dcmi_reset_channel (line 423) | enum dcmi_reset_channel
type dcmi_boot_status (line 425) | enum dcmi_boot_status
type dcmi_event_filter (line 427) | struct dcmi_event_filter
type dcmi_die_type (line 432) | enum dcmi_die_type
type dcmi_die_id (line 432) | struct dcmi_die_id
type dcmi_proc_mem_info (line 434) | struct dcmi_proc_mem_info
type dcmi_board_info (line 437) | struct dcmi_board_info
type dsmi_hbm_info_stru (line 439) | struct dsmi_hbm_info_stru
type dcmi_memory_info_stru (line 447) | struct dcmi_memory_info_stru {
type dcmi_memory_info_stru (line 453) | struct dcmi_memory_info_stru
FILE: include/libdrm/xe_drm.h
type drm_xe_user_extension (line 167) | struct drm_xe_user_extension {
type drm_xe_ext_set_property (line 200) | struct drm_xe_ext_set_property {
type drm_xe_engine_class_instance (line 234) | struct drm_xe_engine_class_instance {
type drm_xe_engine (line 254) | struct drm_xe_engine {
type drm_xe_query_engines (line 269) | struct drm_xe_query_engines {
type drm_xe_memory_class (line 281) | enum drm_xe_memory_class {
type drm_xe_mem_region (line 296) | struct drm_xe_mem_region {
type drm_xe_query_mem_regions (line 375) | struct drm_xe_query_mem_regions {
type drm_xe_query_config (line 405) | struct drm_xe_query_config {
type drm_xe_gt (line 434) | struct drm_xe_gt {
type drm_xe_query_gt_list (line 488) | struct drm_xe_query_gt_list {
type drm_xe_query_topology_mask (line 532) | struct drm_xe_query_topology_mask {
type drm_xe_query_engine_cycles (line 564) | struct drm_xe_query_engine_cycles {
type drm_xe_query_uc_fw_version (line 608) | struct drm_xe_query_uc_fw_version {
type drm_xe_device_query (line 691) | struct drm_xe_device_query {
type drm_xe_gem_create (line 748) | struct drm_xe_gem_create {
type drm_xe_gem_mmap_offset (line 816) | struct drm_xe_gem_mmap_offset {
type drm_xe_vm_create (line 856) | struct drm_xe_vm_create {
type drm_xe_vm_destroy (line 876) | struct drm_xe_vm_destroy {
type drm_xe_vm_bind_op (line 911) | struct drm_xe_vm_bind_op {
type drm_xe_vm_bind (line 1044) | struct drm_xe_vm_bind {
type drm_xe_exec_queue_create (line 1110) | struct drm_xe_exec_queue_create {
type drm_xe_exec_queue_destroy (line 1149) | struct drm_xe_exec_queue_destroy {
type drm_xe_exec_queue_get_property (line 1166) | struct drm_xe_exec_queue_get_property {
type drm_xe_sync (line 1219) | struct drm_xe_sync {
type drm_xe_exec (line 1278) | struct drm_xe_exec {
type drm_xe_wait_user_fence (line 1338) | struct drm_xe_wait_user_fence {
type drm_xe_observation_type (line 1398) | enum drm_xe_observation_type {
type drm_xe_observation_op (line 1406) | enum drm_xe_observation_op {
type drm_xe_observation_param (line 1425) | struct drm_xe_observation_param {
type drm_xe_observation_ioctls (line 1442) | enum drm_xe_observation_ioctls {
type drm_xe_oa_unit_type (line 1462) | enum drm_xe_oa_unit_type {
type drm_xe_oa_unit (line 1476) | struct drm_xe_oa_unit {
type drm_xe_query_oa_units (line 1527) | struct drm_xe_query_oa_units {
type drm_xe_oa_format_type (line 1546) | enum drm_xe_oa_format_type {
type drm_xe_oa_property_id (line 1574) | enum drm_xe_oa_property_id {
type drm_xe_oa_config (line 1647) | struct drm_xe_oa_config {
type drm_xe_oa_stream_status (line 1670) | struct drm_xe_oa_stream_status {
type drm_xe_oa_stream_info (line 1689) | struct drm_xe_oa_stream_info {
FILE: include/list.h
type list_head (line 51) | struct list_head {
function list_add (line 66) | static inline
function list_add_tail (line 76) | static inline
function __list_del (line 86) | static inline
function list_del (line 94) | static inline
function list_del_init (line 101) | static inline
function list_move (line 109) | static inline
function list_move_tail (line 117) | static inline
function list_replace (line 125) | static inline
function list_splice (line 135) | static inline
function list_empty (line 211) | static inline
function list_replace_init (line 217) | static inline
FILE: include/nvtop/device_discovery.h
type nvtop_device (line 26) | typedef struct nvtop_device nvtop_device;
type nvtop_device_enumerator (line 40) | typedef struct nvtop_device_enumerator nvtop_device_enumerator;
type nvtop_pcie_link (line 54) | typedef struct {
FILE: include/nvtop/extract_gpuinfo.h
type list_head (line 29) | struct list_head
type list_head (line 31) | struct list_head
type list_head (line 33) | struct list_head
type list_head (line 35) | struct list_head
type list_head (line 37) | struct list_head
type list_head (line 39) | struct list_head
type list_head (line 41) | struct list_head
type list_head (line 43) | struct list_head
FILE: include/nvtop/extract_gpuinfo_common.h
type gpuinfo_static_info_valid (line 54) | enum gpuinfo_static_info_valid {
type gpuinfo_static_info (line 69) | struct gpuinfo_static_info {
type gpuinfo_dynamic_info_valid (line 87) | enum gpuinfo_dynamic_info_valid {
type gpuinfo_dynamic_info (line 113) | struct gpuinfo_dynamic_info {
type gpu_process_type (line 139) | enum gpu_process_type {
type gpuinfo_process_info_valid (line 150) | enum gpuinfo_process_info_valid {
type gpu_process (line 170) | struct gpu_process {
type gpu_info (line 193) | struct gpu_info
type gpu_vendor (line 195) | struct gpu_vendor {
type gpu_info (line 214) | struct gpu_info {
type gpu_vendor (line 225) | struct gpu_vendor
type gpu_info (line 229) | struct gpu_info
function busy_usage_from_time_usage_round (line 235) | inline unsigned busy_usage_from_time_usage_round(uint64_t current_use_ns...
FILE: include/nvtop/extract_processinfo_fdinfo.h
type gpu_info (line 34) | struct gpu_info
type gpu_process (line 34) | struct gpu_process
type gpu_info (line 42) | struct gpu_info
type gpu_info (line 49) | struct gpu_info
type gpu_info (line 57) | struct gpu_info
FILE: include/nvtop/get_process_info.h
type process_cpu_usage (line 31) | struct process_cpu_usage {
type process_cpu_usage (line 43) | struct process_cpu_usage
FILE: include/nvtop/info_messages.h
type list_head (line 25) | struct list_head
FILE: include/nvtop/interface.h
type nvtop_interface (line 29) | struct nvtop_interface
type nvtop_interface (line 31) | struct nvtop_interface
type nvtop_interface (line 34) | struct nvtop_interface
type nvtop_interface (line 36) | struct nvtop_interface
type list_head (line 37) | struct list_head
type list_head (line 38) | struct list_head
type list_head (line 40) | struct list_head
type list_head (line 42) | struct list_head
type nvtop_interface (line 42) | struct nvtop_interface
type list_head (line 44) | struct list_head
type nvtop_interface (line 44) | struct nvtop_interface
type nvtop_interface (line 46) | struct nvtop_interface
type nvtop_interface (line 48) | struct nvtop_interface
type nvtop_interface (line 50) | struct nvtop_interface
type nvtop_interface (line 52) | struct nvtop_interface
type nvtop_interface (line 54) | struct nvtop_interface
type list_head (line 58) | struct list_head
FILE: include/nvtop/interface_common.h
type plot_information (line 25) | enum plot_information {
type plot_info_to_draw (line 39) | typedef int plot_info_to_draw;
type process_field (line 41) | enum process_field {
type process_field_displayed (line 56) | typedef int process_field_displayed;
FILE: include/nvtop/interface_internal_common.h
type nvtop_option_window_state (line 37) | enum nvtop_option_window_state {
type interface_color (line 43) | enum interface_color {
type device_window (line 52) | struct device_window {
type option_window (line 79) | struct option_window {
type process_window (line 87) | struct process_window {
type plot_window (line 97) | struct plot_window {
type setup_window_section (line 106) | enum setup_window_section {
type setup_window (line 115) | struct setup_window {
type nvtop_interface (line 127) | struct nvtop_interface {
type device_field (line 140) | enum device_field {
function set_attribute_between (line 154) | inline void set_attribute_between(WINDOW *win, int startY, int startX, i...
FILE: include/nvtop/interface_layout_selection.h
type window_position (line 9) | struct window_position {
type window_position (line 19) | struct window_position
type window_position (line 20) | struct window_position
type window_position (line 21) | struct window_position
type window_position (line 21) | struct window_position
FILE: include/nvtop/interface_options.h
type nvtop_interface_gpu_opts (line 31) | typedef struct {
type nvtop_interface_option (line 37) | typedef struct nvtop_interface_option_struct {
function plot_isset_draw_info (line 57) | inline bool plot_isset_draw_info(enum plot_information check_info, plot_...
function plot_count_draw_info (line 61) | inline unsigned plot_count_draw_info(plot_info_to_draw to_draw) {
function plot_info_to_draw (line 69) | inline plot_info_to_draw plot_add_draw_info(enum plot_information set_in...
function plot_info_to_draw (line 76) | inline plot_info_to_draw plot_remove_draw_info(enum plot_information res...
function plot_info_to_draw (line 80) | inline plot_info_to_draw plot_default_draw_info(void) { return (1 << plo...
type list_head (line 82) | struct list_head
type list_head (line 85) | struct list_head
type list_head (line 86) | struct list_head
function process_is_field_displayed (line 92) | inline bool process_is_field_displayed(enum process_field field, process...
function process_field_displayed (line 96) | inline process_field_displayed process_remove_field_to_display(enum proc...
function process_field_displayed (line 101) | inline process_field_displayed process_add_field_to_display(enum process...
function process_field_displayed (line 106) | inline process_field_displayed process_default_displayed_field(void) {
function process_field_displayed_count (line 116) | inline unsigned process_field_displayed_count(process_field_displayed fi...
type process_field (line 125) | enum process_field
FILE: include/nvtop/interface_ring_buffer.h
type interface_ring_buffer (line 27) | typedef struct interface_ring_buffer_st {
function interface_ring_buffer_data_stored (line 48) | inline unsigned interface_ring_buffer_data_stored(const interface_ring_b...
function interface_index_in_ring (line 60) | inline unsigned interface_index_in_ring(const interface_ring_buffer *buf...
function interface_ring_buffer_get (line 71) | inline unsigned interface_ring_buffer_get(const interface_ring_buffer *b...
function interface_ring_buffer_push (line 78) | inline void interface_ring_buffer_push(interface_ring_buffer *buff, unsi...
function interface_ring_buffer_pop (line 98) | inline void interface_ring_buffer_pop(interface_ring_buffer *buff, unsig...
function interface_ring_buffer_empty_select (line 110) | inline void interface_ring_buffer_empty_select(interface_ring_buffer *bu...
function interface_ring_buffer_empty (line 116) | inline void interface_ring_buffer_empty(interface_ring_buffer *buff, uns...
FILE: include/nvtop/interface_setup_win.h
type window_position (line 29) | struct window_position
type setup_window (line 29) | struct setup_window
type setup_window (line 31) | struct setup_window
type nvtop_interface (line 33) | struct nvtop_interface
type nvtop_interface (line 35) | struct nvtop_interface
type list_head (line 37) | struct list_head
type nvtop_interface (line 37) | struct nvtop_interface
type nvtop_interface (line 39) | struct nvtop_interface
type nvtop_interface (line 41) | struct nvtop_interface
FILE: include/nvtop/time.h
type nvtop_time (line 35) | typedef struct timespec nvtop_time;
function nvtop_get_current_time (line 37) | inline void nvtop_get_current_time(nvtop_time *time) { clock_gettime(NVT...
function nvtop_difftime (line 39) | inline double nvtop_difftime(nvtop_time t0, nvtop_time t1) {
function nvtop_time_u64 (line 51) | inline uint64_t nvtop_time_u64(nvtop_time t0) { return (uint64_t)(t0.tv_...
function nvtop_difftime_u64 (line 53) | inline uint64_t nvtop_difftime_u64(nvtop_time t0, nvtop_time t1) {
function nvtop_time (line 57) | inline nvtop_time nvtop_hmns_to_time(unsigned hour, unsigned minutes, un...
function nvtop_time (line 62) | inline nvtop_time nvtop_substract_time(nvtop_time t0, nvtop_time t1) {
function nvtop_time (line 69) | inline nvtop_time nvtop_add_time(nvtop_time t0, nvtop_time t1) {
FILE: include/uthash.h
type UT_hash_bucket (line 1068) | typedef struct UT_hash_bucket {
type UT_hash_table (line 1092) | typedef struct UT_hash_table {
type UT_hash_handle (line 1125) | typedef struct UT_hash_handle {
FILE: src/amdgpu_ids.h
type amdgpu_id_struct (line 15) | struct amdgpu_id_struct {
type amdgpu_id_struct (line 21) | struct amdgpu_id_struct
FILE: src/device_discovery_linux.c
type nvtop_device_enumerator (line 39) | typedef struct nvtop_device_enumerator {
function nvtop_device (line 48) | nvtop_device *nvtop_device_ref(nvtop_device *device) {
function nvtop_device (line 53) | nvtop_device *nvtop_device_unref(nvtop_device *device) {
function nvtop_device_new_from_syspath (line 59) | int nvtop_device_new_from_syspath(nvtop_device **dev, const char *syspat...
function nvtop_device_get_parent (line 68) | int nvtop_device_get_parent(nvtop_device *child, nvtop_device **parent) {
function nvtop_device_get_driver (line 73) | int nvtop_device_get_driver(nvtop_device *device, const char **driver) {
function nvtop_device_get_devname (line 78) | int nvtop_device_get_devname(nvtop_device *device, const char **devname) {
function nvtop_device_get_property_value (line 83) | int nvtop_device_get_property_value(nvtop_device *device, const char *ke...
function nvtop_device_get_sysattr_value (line 88) | int nvtop_device_get_sysattr_value(nvtop_device *device, const char *sys...
function nvtop_device_get_syspath (line 93) | int nvtop_device_get_syspath(nvtop_device *device, const char **sysPath) {
function nvtop_enumerator_new (line 98) | int nvtop_enumerator_new(nvtop_device_enumerator **enumerator) {
function nvtop_free_enumerator_devices (line 119) | static void nvtop_free_enumerator_devices(nvtop_device_enumerator *enume...
function nvtop_device_enumerator (line 129) | nvtop_device_enumerator *nvtop_enumerator_ref(nvtop_device_enumerator *e...
function nvtop_device_enumerator (line 136) | nvtop_device_enumerator *nvtop_enumerator_unref(nvtop_device_enumerator ...
function nvtop_device_enumerator_add_match_subsystem (line 149) | int nvtop_device_enumerator_add_match_subsystem(nvtop_device_enumerator ...
function nvtop_device_enumerator_add_match_property (line 161) | int nvtop_device_enumerator_add_match_property(nvtop_device_enumerator *...
function nvtop_device_enumerator_add_match_parent (line 168) | int nvtop_device_enumerator_add_match_parent(nvtop_device_enumerator *en...
function nvtop_device (line 174) | static nvtop_device *nvtop_enumerator_get_current(nvtop_device_enumerato...
function nvtop_device (line 180) | nvtop_device *nvtop_enumerator_get_device_first(nvtop_device_enumerator ...
function nvtop_device (line 202) | nvtop_device *nvtop_enumerator_get_device_next(nvtop_device_enumerator *...
function nvtop_device (line 214) | nvtop_device *nvtop_device_ref(nvtop_device *device) { return (nvtop_dev...
function nvtop_device (line 216) | nvtop_device *nvtop_device_unref(nvtop_device *device) {
function nvtop_device_new_from_syspath (line 222) | int nvtop_device_new_from_syspath(nvtop_device **dev, const char *syspat...
function nvtop_device_get_parent (line 226) | int nvtop_device_get_parent(nvtop_device *child, nvtop_device **parent) {
function nvtop_device_get_driver (line 230) | int nvtop_device_get_driver(nvtop_device *device, const char **driver) {
function nvtop_device_get_devname (line 234) | int nvtop_device_get_devname(nvtop_device *device, const char **devname) {
function nvtop_device_get_property_value (line 238) | int nvtop_device_get_property_value(nvtop_device *device, const char *ke...
function nvtop_device_get_sysattr_value (line 242) | int nvtop_device_get_sysattr_value(nvtop_device *device, const char *sys...
function nvtop_device_get_syspath (line 246) | int nvtop_device_get_syspath(nvtop_device *device, const char **sysPath) {
function nvtop_enumerator_new (line 250) | int nvtop_enumerator_new(nvtop_device_enumerator **enumerator) {
function nvtop_device_enumerator (line 254) | nvtop_device_enumerator *nvtop_enumerator_ref(nvtop_device_enumerator *e...
function nvtop_device_enumerator (line 258) | nvtop_device_enumerator *nvtop_enumerator_unref(nvtop_device_enumerator ...
function nvtop_device_enumerator_add_match_subsystem (line 262) | int nvtop_device_enumerator_add_match_subsystem(nvtop_device_enumerator ...
function nvtop_device_enumerator_add_match_property (line 266) | int nvtop_device_enumerator_add_match_property(nvtop_device_enumerator *...
function nvtop_device_enumerator_add_match_parent (line 271) | int nvtop_device_enumerator_add_match_parent(nvtop_device_enumerator *en...
function nvtop_device (line 275) | nvtop_device *nvtop_enumerator_get_device_first(nvtop_device_enumerator ...
function nvtop_device (line 279) | nvtop_device *nvtop_enumerator_get_device_next(nvtop_device_enumerator *...
function pcie_walker_helper (line 285) | static int pcie_walker_helper(nvtop_device *dev, nvtop_pcie_link *pcie_i...
function nvtop_device_maximum_pcie_link (line 319) | int nvtop_device_maximum_pcie_link(nvtop_device *dev, nvtop_pcie_link *p...
function nvtop_device_current_pcie_link (line 325) | int nvtop_device_current_pcie_link(nvtop_device *dev, nvtop_pcie_link *p...
function nvtop_device (line 340) | nvtop_device *nvtop_device_get_hwmon(nvtop_device *dev) {
FILE: src/extract_gcuinfo_enflame.c
type efmlDevice (line 36) | struct efmlDevice
type efmlReturn_v1_t (line 37) | typedef int efmlReturn_v1_t;
type efmlPciInfo_t (line 55) | typedef struct {
type efmlTemperatureThresholds_t (line 71) | typedef enum {
type efmlClockType_t (line 86) | typedef enum {
type efmlUtilization_t (line 97) | typedef struct {
type efmlMemory_v1_t (line 104) | typedef struct {
type efmlMemory_v2_t (line 110) | typedef struct {
type efmlPcieUtilCounter_t (line 125) | typedef enum {
type efmlTemperatureSensors_t (line 135) | typedef enum {
type efmlProcessInfo_v1_t (line 154) | typedef struct {
type efmlProcessInfo_v2_t (line 159) | typedef struct {
type efmlProcessInfo_v3_t (line 166) | typedef struct {
type efmlProcessUtilizationSample_t (line 215) | typedef struct {
type gcu_info_enflame (line 228) | struct gcu_info_enflame {
type list_head (line 242) | struct list_head
type gpu_info (line 243) | struct gpu_info
type gpu_info (line 244) | struct gpu_info
type gpu_info (line 245) | struct gpu_info
type gpu_vendor (line 247) | struct gpu_vendor
function init_extract_gcuinfo_enflame (line 258) | __attribute__((constructor)) static void init_extract_gcuinfo_enflame(vo...
function gcuinfo_enflame_init (line 269) | static bool gcuinfo_enflame_init(void) {
function gcuinfo_enflame_shutdown (line 441) | static void gcuinfo_enflame_shutdown(void) {
function gcuinfo_enflame_get_device_handles (line 468) | static bool gcuinfo_enflame_get_device_handles(struct list_head *devices...
function gcuinfo_enflame_populate_static_info (line 504) | static void gcuinfo_enflame_populate_static_info(struct gpu_info *_gcu_i...
function gcuinfo_enflame_refresh_dynamic_info (line 536) | static void gcuinfo_enflame_refresh_dynamic_info(struct gpu_info *_gcu_i...
function gcuinfo_enflame_get_process_utilization (line 812) | static void gcuinfo_enflame_get_process_utilization(struct gcu_info_enfl...
function gcuinfo_enflame_get_running_processes (line 861) | static void gcuinfo_enflame_get_running_processes(struct gpu_info *_gcu_...
FILE: src/extract_gpuinfo.c
type process_info_cache (line 40) | struct process_info_cache {
type process_info_cache (line 49) | struct process_info_cache
type process_info_cache (line 50) | struct process_info_cache
function register_gpu_vendor (line 54) | void register_gpu_vendor(struct gpu_vendor *vendor) { list_add(&vendor->...
function gpuinfo_init_info_extraction (line 56) | bool gpuinfo_init_info_extraction(unsigned *monitored_dev_count, struct ...
function gpuinfo_shutdown_info_extraction (line 77) | bool gpuinfo_shutdown_info_extraction(struct list_head *devices) {
function gpuinfo_populate_static_infos (line 91) | bool gpuinfo_populate_static_infos(struct list_head *devices) {
function calculate_effective_load (line 98) | static void calculate_effective_load(struct gpuinfo_dynamic_info *dynami...
function gpuinfo_refresh_dynamic_info (line 111) | bool gpuinfo_refresh_dynamic_info(struct list_head *devices) {
function gpuinfo_fix_dynamic_info_from_process_info (line 123) | bool gpuinfo_fix_dynamic_info_from_process_info(struct list_head *device...
function gpuinfo_populate_process_info (line 202) | static void gpuinfo_populate_process_info(struct gpu_info *device) {
function gpuinfo_clean_old_cache (line 267) | static void gpuinfo_clean_old_cache(void) {
function gpuinfo_refresh_processes (line 279) | bool gpuinfo_refresh_processes(struct list_head *devices) {
function gpuinfo_utilisation_rate (line 296) | bool gpuinfo_utilisation_rate(struct list_head *devices) {
function gpuinfo_clear_cache (line 307) | void gpuinfo_clear_cache(void) {
function extract_drm_fdinfo_key_value (line 319) | bool extract_drm_fdinfo_key_value(char *buf, char **key, char **val) {
function nvtop_pcie_gen_from_link_speed (line 341) | unsigned nvtop_pcie_gen_from_link_speed(unsigned linkSpeed) {
function gpuinfo_refresh_utilisation_rate (line 366) | void gpuinfo_refresh_utilisation_rate(struct gpu_info *gpu_info) {
FILE: src/extract_gpuinfo_amdgpu.c
type amdgpu_gpu_info (line 53) | struct amdgpu_gpu_info
type amdgpu_process_info_cache_valid (line 89) | enum amdgpu_process_info_cache_valid {
type unique_cache_id (line 97) | struct __attribute__((__packed__)) unique_cache_id {
type amdgpu_process_info_cache (line 103) | struct amdgpu_process_info_cache {
type gpu_info_amdgpu (line 114) | struct gpu_info_amdgpu {
type gpu_info_amdgpu (line 136) | struct gpu_info_amdgpu
type list_head (line 141) | struct list_head
type gpu_info (line 142) | struct gpu_info
type gpu_info (line 143) | struct gpu_info
type gpu_info (line 144) | struct gpu_info
type gpu_vendor (line 146) | struct gpu_vendor
function init_extract_gpuinfo_amdgpu (line 159) | __attribute__((constructor)) static void init_extract_gpuinfo_amdgpu(voi...
function wrap_drmGetDevices (line 161) | static int wrap_drmGetDevices(drmDevicePtr devices[], int max_devices) {
type gpu_info (line 169) | struct gpu_info
type gpu_process (line 169) | struct gpu_process
function gpuinfo_amdgpu_init (line 171) | static bool gpuinfo_amdgpu_init(void) {
function gpuinfo_amdgpu_shutdown (line 235) | static void gpuinfo_amdgpu_shutdown(void) {
function authenticate_drm (line 295) | static void authenticate_drm(int fd) {
function initDeviceSysfsPaths (line 319) | static void initDeviceSysfsPaths(struct gpu_info_amdgpu *gpu_info) {
function gpuinfo_amdgpu_get_device_handles (line 385) | static bool gpuinfo_amdgpu_get_device_handles(struct list_head *devices,...
function rewindAndReadPattern (line 483) | static int rewindAndReadPattern(FILE *file, const char *format, ...) {
function readAttributeFromDevice (line 495) | static int readAttributeFromDevice(nvtop_device *dev, const char *sysAtt...
function gpuinfo_amdgpu_populate_static_info (line 510) | static void gpuinfo_amdgpu_populate_static_info(struct gpu_info *_gpu_in...
function gpuinfo_amdgpu_refresh_dynamic_info (line 654) | static void gpuinfo_amdgpu_refresh_dynamic_info(struct gpu_info *_gpu_in...
function parse_drm_fdinfo_amd (line 804) | static bool parse_drm_fdinfo_amd(struct gpu_info *info, FILE *fdinfo_fil...
function swap_process_cache_for_next_update (line 1014) | static void swap_process_cache_for_next_update(struct gpu_info_amdgpu *g...
function gpuinfo_amdgpu_get_running_processes (line 1027) | static void gpuinfo_amdgpu_get_running_processes(struct gpu_info *_gpu_i...
FILE: src/extract_gpuinfo_amdgpu_utils.c
type amdgpu_gpu_info (line 26) | struct amdgpu_gpu_info
type amdgpu_gpu_info (line 28) | struct amdgpu_gpu_info
FILE: src/extract_gpuinfo_ascend.c
type gpu_info_ascend (line 42) | struct gpu_info_ascend {
type list_head (line 52) | struct list_head
type gpu_info (line 53) | struct gpu_info
type gpu_info (line 54) | struct gpu_info
type gpu_info (line 55) | struct gpu_info
type gpu_vendor (line 60) | struct gpu_vendor
function init_extract_gpuinfo_ascend (line 71) | __attribute__((constructor)) static void init_extract_gpuinfo_ascend(voi...
function gpuinfo_ascend_init (line 73) | static bool gpuinfo_ascend_init(void) {
function gpuinfo_ascend_shutdown (line 78) | static void gpuinfo_ascend_shutdown(void) {
function gpuinfo_ascend_get_device_handles (line 92) | static bool gpuinfo_ascend_get_device_handles(struct list_head *devices,...
function _encode_card_device_id_to_pdev (line 139) | static void _encode_card_device_id_to_pdev(char *pdev, int card_id, int ...
function _decode_card_device_id_from_pdev (line 143) | static void _decode_card_device_id_from_pdev(const char *pdev, int *card...
function gpuinfo_ascend_populate_static_info (line 147) | static void gpuinfo_ascend_populate_static_info(struct gpu_info *_gpu_in...
function gpuinfo_ascend_refresh_dynamic_info (line 169) | static void gpuinfo_ascend_refresh_dynamic_info(struct gpu_info *_gpu_in...
function gpuinfo_ascend_get_running_processes (line 229) | static void gpuinfo_ascend_get_running_processes(struct gpu_info *_gpu_i...
FILE: src/extract_gpuinfo_intel.c
type list_head (line 39) | struct list_head
type gpu_info (line 40) | struct gpu_info
type gpu_info (line 41) | struct gpu_info
type gpu_info (line 42) | struct gpu_info
type gpu_vendor (line 44) | struct gpu_vendor
type gpu_info_intel (line 56) | struct gpu_info_intel
function init_extract_gpuinfo_intel (line 67) | __attribute__((constructor)) static void init_extract_gpuinfo_intel(void...
function gpuinfo_intel_init (line 69) | bool gpuinfo_intel_init(void) { return true; }
function gpuinfo_intel_shutdown (line 70) | void gpuinfo_intel_shutdown(void) {
function parse_drm_fdinfo_intel (line 82) | static bool parse_drm_fdinfo_intel(struct gpu_info *info, FILE *fdinfo_f...
function add_intel_cards (line 93) | static void add_intel_cards(struct nvtop_device *dev, struct list_head *...
function gpuinfo_intel_get_device_handles (line 127) | bool gpuinfo_intel_get_device_handles(struct list_head *devices_list, un...
function gpuinfo_intel_populate_static_info (line 164) | void gpuinfo_intel_populate_static_info(struct gpu_info *_gpu_info) {
function gpuinfo_intel_refresh_dynamic_info (line 219) | void gpuinfo_intel_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function swap_process_cache_for_next_update (line 350) | static void swap_process_cache_for_next_update(struct gpu_info_intel *gp...
function gpuinfo_intel_get_running_processes (line 363) | void gpuinfo_intel_get_running_processes(struct gpu_info *_gpu_info) {
FILE: src/extract_gpuinfo_intel.h
type intel_process_info_cache_valid (line 11) | enum intel_process_info_cache_valid {
type unique_cache_id (line 22) | struct __attribute__((__packed__)) unique_cache_id {
type intel_process_info_cache (line 39) | struct intel_process_info_cache {
type gpu_info_intel (line 53) | struct gpu_info_intel {
type gpu_info (line 72) | struct gpu_info
type gpu_info (line 73) | struct gpu_info
type gpu_info (line 75) | struct gpu_info
type gpu_process (line 75) | struct gpu_process
type gpu_info (line 76) | struct gpu_info
type gpu_process (line 76) | struct gpu_process
FILE: src/extract_gpuinfo_intel_i915.c
type drm_i915_memory_region_info (line 46) | struct drm_i915_memory_region_info {
type drm_i915_query_memory_regions (line 62) | struct drm_i915_query_memory_regions {
function intel_ioctl (line 70) | static inline int intel_ioctl(int fd, unsigned long request, void *arg) {
function intel_i915_query (line 81) | static inline int intel_i915_query(int fd, uint64_t query_id, void *buff...
function gpuinfo_intel_i915_refresh_dynamic_info (line 133) | void gpuinfo_intel_i915_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function parse_drm_fdinfo_intel_i915 (line 170) | bool parse_drm_fdinfo_intel_i915(struct gpu_info *info, FILE *fdinfo_fil...
FILE: src/extract_gpuinfo_intel_xe.c
function intel_ioctl (line 43) | static inline int intel_ioctl(int fd, unsigned long request, void *arg) {
type drm_xe_device_query (line 55) | struct drm_xe_device_query
function gpuinfo_intel_xe_refresh_dynamic_info (line 77) | void gpuinfo_intel_xe_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function parse_drm_fdinfo_intel_xe (line 130) | bool parse_drm_fdinfo_intel_xe(struct gpu_info *info, FILE *fdinfo_file,...
FILE: src/extract_gpuinfo_mali_common.c
type mali_process_info_cache_valid (line 31) | enum mali_process_info_cache_valid {
type unique_cache_id (line 36) | struct __attribute__((__packed__)) unique_cache_id {
type mali_process_info_cache (line 41) | struct mali_process_info_cache {
function mali_init_drm_funcs (line 50) | bool mali_init_drm_funcs(struct drmFuncTable *drmFuncs,
function mali_deinit_drm (line 121) | void mali_deinit_drm(struct mali_gpu_state *state)
function mali_shutdown_common (line 127) | void mali_shutdown_common(struct mali_gpu_state *state,
type mali_gpu_state (line 151) | struct mali_gpu_state
function wrap_drmGetDevices (line 183) | static int wrap_drmGetDevices(drmDevicePtr devices[], int max_devices, s...
function authenticate_drm (line 191) | static void authenticate_drm(int fd, struct drmFuncTable *funcs) {
function mali_common_get_device_handles (line 215) | bool mali_common_get_device_handles(struct mali_gpu_state *state,
function parse_memory_multiplier (line 302) | uint64_t parse_memory_multiplier(const char *str) {
function mali_common_refresh_dynamic_info (line 319) | void mali_common_refresh_dynamic_info(struct gpuinfo_dynamic_info *dynam...
function swap_process_cache_for_next_update (line 376) | static void swap_process_cache_for_next_update(struct gpu_info_mali *gpu...
function mali_common_get_running_processes (line 389) | void mali_common_get_running_processes(struct gpu_info *_gpu_info, enum ...
function mali_common_parse_fdinfo_handle_cache (line 401) | void mali_common_parse_fdinfo_handle_cache(struct gpu_info_mali *gpu_info,
function mali_common_parse_drm_fdinfo (line 458) | bool mali_common_parse_drm_fdinfo(struct gpu_info *info, FILE *fdinfo_file,
FILE: src/extract_gpuinfo_metax.c
type mxSmlReturn_t (line 38) | typedef unsigned int mxSmlReturn_t;
type mxSmlDeviceType_t (line 50) | typedef enum {
type mxSmlDeviceBrand_t (line 54) | typedef enum {
type mxSmlDeviceVirtualizationMode_t (line 61) | typedef enum {
type mxSmlDeviceInfo_t (line 67) | typedef struct {
type mxSmlPcieInfo_t (line 83) | typedef struct {
type mxSmlTemperatureSensors_t (line 92) | typedef enum {
type mxSmlClockIp_t (line 101) | typedef enum {
type mxSmlDpmIp_t (line 111) | typedef enum {
type mxSmlUsageIp_t (line 120) | typedef enum {
type mxSmlMemoryInfo_t (line 129) | typedef struct {
type mxSmlPcieThroughput_t (line 140) | typedef struct {
type mxSmlBoardWayElectricInfo_t (line 149) | typedef struct {
type mxSmlProcessGpuInfo_t (line 164) | typedef struct {
type mxSmlProcessInfo_t (line 170) | typedef struct {
type gpu_info_metax (line 187) | struct gpu_info_metax {
type list_head (line 199) | struct list_head
type gpu_info (line 200) | struct gpu_info
type gpu_info (line 201) | struct gpu_info
type gpu_info (line 202) | struct gpu_info
type gpu_vendor (line 204) | struct gpu_vendor
function init_extract_gpuinfo_metax (line 215) | __attribute__((constructor)) static void init_extract_gpuinfo_metax(void...
function gpuinfo_metax_init (line 225) | static bool gpuinfo_metax_init(void) {
function gpuinfo_metax_shutdown (line 319) | static void gpuinfo_metax_shutdown(void) {
function gpuinfo_metax_get_device_handles (line 345) | static bool gpuinfo_metax_get_device_handles(struct list_head *devices, ...
function gpuinfo_metax_populate_static_info (line 384) | static void gpuinfo_metax_populate_static_info(struct gpu_info *_gpu_inf...
function gpuinfo_metax_refresh_dynamic_info (line 415) | static void gpuinfo_metax_refresh_dynamic_info(struct gpu_info *_gpu_inf...
function gpuinfo_metax_get_running_processes (line 574) | static void gpuinfo_metax_get_running_processes(struct gpu_info *_gpu_in...
FILE: src/extract_gpuinfo_msm.c
type intel_process_info_cache_valid (line 49) | enum intel_process_info_cache_valid {
type unique_cache_id (line 54) | struct __attribute__((__packed__)) unique_cache_id {
type msm_process_info_cache (line 59) | struct msm_process_info_cache {
type gpu_info_msm (line 67) | struct gpu_info_msm {
type list_head (line 78) | struct list_head
type gpu_info (line 79) | struct gpu_info
type gpu_info (line 80) | struct gpu_info
type gpu_info (line 81) | struct gpu_info
type gpu_vendor (line 83) | struct gpu_vendor
type gpu_info_msm (line 95) | struct gpu_info_msm
function wrap_drmGetDevices (line 115) | static int wrap_drmGetDevices(drmDevicePtr devices[], int max_devices) {
function authenticate_drm (line 123) | static void authenticate_drm(int fd) {
function init_extract_gpuinfo_msm (line 150) | __attribute__((constructor)) static void init_extract_gpuinfo_msm(void) ...
function gpuinfo_msm_init (line 152) | bool gpuinfo_msm_init(void) {
function gpuinfo_msm_shutdown (line 208) | void gpuinfo_msm_shutdown(void) {
function parse_memory_multiplier (line 254) | static uint64_t parse_memory_multiplier(const char *str) {
function parse_drm_fdinfo_msm (line 276) | static bool parse_drm_fdinfo_msm(struct gpu_info *info, FILE *fdinfo_fil...
function gpuinfo_msm_get_device_handles (line 383) | static bool gpuinfo_msm_get_device_handles(struct list_head *devices, un...
function gpuinfo_msm_query_param (line 453) | static int gpuinfo_msm_query_param(int gpu, uint32_t param, uint64_t *va...
function gpuinfo_msm_populate_static_info (line 469) | void gpuinfo_msm_populate_static_info(struct gpu_info *_gpu_info) {
function gpuinfo_msm_refresh_dynamic_info (line 499) | void gpuinfo_msm_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function swap_process_cache_for_next_update (line 567) | static void swap_process_cache_for_next_update(struct gpu_info_msm *gpu_...
function gpuinfo_msm_get_running_processes (line 580) | void gpuinfo_msm_get_running_processes(struct gpu_info *_gpu_info) {
FILE: src/extract_gpuinfo_msm_utils.c
type msm_id_struct (line 23) | struct msm_id_struct {
type msm_id_struct (line 39) | struct msm_id_struct
FILE: src/extract_gpuinfo_nvidia.c
type nvmlDevice (line 37) | struct nvmlDevice
type nvmlReturn_t (line 38) | typedef int nvmlReturn_t;
type nvmlPciInfo_t (line 56) | typedef struct {
type nvmlTemperatureThresholds_t (line 73) | typedef enum {
type nvmlClockType_t (line 88) | typedef enum {
type nvmlUtilization_t (line 99) | typedef struct {
type nvmlMemory_v1_t (line 106) | typedef struct {
type nvmlMemory_v2_t (line 112) | typedef struct {
type nvmlPcieUtilCounter_t (line 127) | typedef enum {
type nvmlTemperatureSensors_t (line 137) | typedef enum {
type nvmlProcessInfo_v1_t (line 156) | typedef struct {
type nvmlProcessInfo_v2_t (line 161) | typedef struct {
type nvmlProcessInfo_v3_t (line 168) | typedef struct {
type nvmlProcessUtilizationSample_t (line 219) | typedef struct {
type gpu_info_nvidia (line 232) | struct gpu_info_nvidia {
type list_head (line 246) | struct list_head
type gpu_info (line 247) | struct gpu_info
type gpu_info (line 248) | struct gpu_info
type gpu_info (line 249) | struct gpu_info
type gpu_vendor (line 251) | struct gpu_vendor
function init_extract_gpuinfo_nvidia (line 262) | __attribute__((constructor)) static void init_extract_gpuinfo_nvidia(voi...
function gpuinfo_nvidia_init (line 273) | static bool gpuinfo_nvidia_init(void) {
function gpuinfo_nvidia_shutdown (line 447) | static void gpuinfo_nvidia_shutdown(void) {
function gpuinfo_nvidia_get_device_handles (line 474) | static bool gpuinfo_nvidia_get_device_handles(struct list_head *devices,...
function gpuinfo_nvidia_populate_static_info (line 510) | static void gpuinfo_nvidia_populate_static_info(struct gpu_info *_gpu_in...
function gpuinfo_nvidia_refresh_dynamic_info (line 542) | static void gpuinfo_nvidia_refresh_dynamic_info(struct gpu_info *_gpu_in...
function gpuinfo_nvidia_get_process_utilization (line 731) | static void gpuinfo_nvidia_get_process_utilization(struct gpu_info_nvidi...
function gpuinfo_nvidia_get_running_processes (line 787) | static void gpuinfo_nvidia_get_running_processes(struct gpu_info *_gpu_i...
FILE: src/extract_gpuinfo_panfrost.c
type list_head (line 42) | struct list_head
type gpu_info (line 43) | struct gpu_info
type gpu_info (line 44) | struct gpu_info
type gpu_info (line 45) | struct gpu_info
type gpu_vendor (line 47) | struct gpu_vendor
type drmFuncTable (line 59) | struct drmFuncTable
type mali_gpu_state (line 60) | struct mali_gpu_state
function init_extract_gpuinfo_panfrost (line 62) | __attribute__((constructor)) static void init_extract_gpuinfo_panfrost(v...
function gpuinfo_panfrost_init (line 64) | bool gpuinfo_panfrost_init(void) {
function gpuinfo_panfrost_shutdown (line 68) | void gpuinfo_panfrost_shutdown(void) {
function panfrost_check_fdinfo_keys (line 99) | static void panfrost_check_fdinfo_keys (bool *is_engine, bool *is_cycles,
function parse_drm_fdinfo_panfrost (line 120) | static bool parse_drm_fdinfo_panfrost(struct gpu_info *info, FILE *fdinf...
type gpu_info_mali (line 139) | struct gpu_info_mali
type stat (line 144) | struct stat
function panfrost_open_sysfs_profile (line 194) | static bool panfrost_open_sysfs_profile(struct gpu_info_mali *gpu_info) {
function gpuinfo_panfrost_get_device_handles (line 246) | static bool gpuinfo_panfrost_get_device_handles(struct list_head *device...
function gpuinfo_panfrost_query_param (line 252) | static int gpuinfo_panfrost_query_param(int gpu, uint32_t param, uint64_...
function gpuinfo_panfrost_populate_static_info (line 268) | void gpuinfo_panfrost_populate_static_info(struct gpu_info *_gpu_info) {
function gpuinfo_panfrost_refresh_dynamic_info (line 309) | void gpuinfo_panfrost_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function gpuinfo_panfrost_get_running_processes (line 324) | void gpuinfo_panfrost_get_running_processes(struct gpu_info *_gpu_info) {
FILE: src/extract_gpuinfo_panfrost_utils.c
type panfrost_model (line 24) | struct panfrost_model {
function get_num_eng_g52 (line 30) | static uint32_t get_num_eng_g52(int core_count,
type panfrost_model (line 46) | struct panfrost_model
function panfrost_model_cmp (line 65) | static inline int panfrost_model_cmp(unsigned int match, unsigned int id)
function get_number_engines (line 82) | unsigned int get_number_engines(uint32_t gpu_id,
function util_last_bit (line 98) | unsigned int util_last_bit(unsigned int u)
FILE: src/extract_gpuinfo_panthor.c
type list_head (line 35) | struct list_head
type gpu_info (line 36) | struct gpu_info
type gpu_info (line 37) | struct gpu_info
type gpu_info (line 38) | struct gpu_info
type gpu_vendor (line 40) | struct gpu_vendor
type drmFuncTable (line 52) | struct drmFuncTable
type mali_gpu_state (line 53) | struct mali_gpu_state
function init_extract_gpuinfo_panthor (line 55) | __attribute__((constructor)) static void init_extract_gpuinfo_panthor(vo...
function gpuinfo_panthor_init (line 57) | bool gpuinfo_panthor_init(void) {
function gpuinfo_panthor_shutdown (line 61) | void gpuinfo_panthor_shutdown(void) {
function panthor_check_fdinfo_keys (line 73) | static void panthor_check_fdinfo_keys (bool *is_engine, bool *is_cycles,
function parse_drm_fdinfo_panthor (line 90) | static bool parse_drm_fdinfo_panthor(struct gpu_info *info, FILE *fdinfo...
function gpuinfo_panthor_get_device_handles (line 109) | static bool gpuinfo_panthor_get_device_handles(struct list_head *devices...
function gpuinfo_panthor_populate_static_info (line 115) | void gpuinfo_panthor_populate_static_info(struct gpu_info *_gpu_info) {
function gpuinfo_panthor_refresh_dynamic_info (line 154) | void gpuinfo_panthor_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function gpuinfo_panthor_get_running_processes (line 169) | void gpuinfo_panthor_get_running_processes(struct gpu_info *_gpu_info) {
FILE: src/extract_gpuinfo_panthor_utils.c
type panthor_model (line 27) | struct panthor_model {
type panthor_model (line 50) | struct panthor_model
type panthor_model (line 59) | struct panthor_model
FILE: src/extract_gpuinfo_tpu.c
type gpu_info_tpu (line 34) | struct gpu_info_tpu {
type tpu_chip_usage_data (line 39) | struct tpu_chip_usage_data {
type list_head (line 51) | struct list_head
type gpu_info (line 52) | struct gpu_info
type gpu_info (line 53) | struct gpu_info
type gpu_info (line 54) | struct gpu_info
type gpu_vendor (line 60) | struct gpu_vendor
function init_extract_gpuinfo_tpu (line 71) | __attribute__((constructor)) static void init_extract_gpuinfo_tpu(void) {
type gpu_info_tpu (line 76) | struct gpu_info_tpu
type tpu_chip_usage_data (line 101) | struct tpu_chip_usage_data
function is_cache_valid (line 106) | bool is_cache_valid(void) {
function refresh_tpu_cache (line 113) | bool refresh_tpu_cache(void) {
function reset_tpu_cache (line 134) | void reset_tpu_cache(bool fully) {
function gpuinfo_tpu_init (line 148) | bool gpuinfo_tpu_init(void) {
function free_ptr (line 210) | void free_ptr(void **ptr) {
function gpuinfo_tpu_shutdown (line 217) | void gpuinfo_tpu_shutdown(void) {
function add_tpu_chip (line 230) | static void add_tpu_chip(struct list_head *devices, unsigned *count) {
function gpuinfo_tpu_get_device_handles (line 244) | bool gpuinfo_tpu_get_device_handles(struct list_head *devices_list, unsi...
function gpuinfo_tpu_populate_static_info (line 253) | void gpuinfo_tpu_populate_static_info(struct gpu_info *_gpu_info) {
function gpuinfo_tpu_refresh_dynamic_info (line 263) | void gpuinfo_tpu_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function gpuinfo_tpu_get_running_processes (line 283) | void gpuinfo_tpu_get_running_processes(struct gpu_info *_gpu_info) {
FILE: src/extract_gpuinfo_v3d.c
type gpuinfo_dynamic_info (line 35) | struct gpuinfo_dynamic_info
type gpuinfo_dynamic_info (line 36) | struct gpuinfo_dynamic_info
type v3d_process_info_cache_valid (line 46) | enum v3d_process_info_cache_valid { v3d_cache_engine_render_valid = 0, v...
type unique_cache_id (line 48) | struct __attribute__((__packed__)) unique_cache_id {
type v3d_process_info_cache (line 53) | struct v3d_process_info_cache {
type gpu_info_v3d (line 61) | struct gpu_info_v3d {
type list_head (line 74) | struct list_head
type gpu_info (line 75) | struct gpu_info
type gpu_info (line 76) | struct gpu_info
type gpu_info (line 77) | struct gpu_info
type gpu_vendor (line 79) | struct gpu_vendor
type gpu_info_v3d (line 91) | struct gpu_info_v3d
function init_extract_gpuinfo_v3d (line 93) | __attribute__((constructor)) static void init_extract_gpuinfo_v3d(void) ...
function gpuinfo_v3d_init (line 95) | bool gpuinfo_v3d_init(void) { return true; }
function gpuinfo_v3d_shutdown (line 96) | void gpuinfo_v3d_shutdown(void) {
function parse_drm_fdinfo_v3d (line 110) | static bool parse_drm_fdinfo_v3d(struct gpu_info *info, FILE *fdinfo_fil...
function add_v3d_cards (line 192) | static void add_v3d_cards(struct nvtop_device *dev, const char *devname,...
function gpuinfo_v3d_get_device_handles (line 217) | bool gpuinfo_v3d_get_device_handles(struct list_head *devices_list, unsi...
function gpuinfo_v3d_populate_static_info (line 254) | void gpuinfo_v3d_populate_static_info(struct gpu_info *_gpu_info) {
function gpuinfo_v3d_refresh_dynamic_info (line 269) | void gpuinfo_v3d_refresh_dynamic_info(struct gpu_info *_gpu_info) {
function swap_process_cache_for_next_update (line 286) | static void swap_process_cache_for_next_update(struct gpu_info_v3d *gpu_...
function gpuinfo_v3d_get_running_processes (line 299) | void gpuinfo_v3d_get_running_processes(struct gpu_info *_gpu_info) {
FILE: src/extract_gpuinfo_v3d_utils.c
type gpuinfo_dynamic_info (line 44) | struct gpuinfo_dynamic_info
type gpuinfo_dynamic_info (line 45) | struct gpuinfo_dynamic_info
function set_debug_files (line 57) | void set_debug_files(int card_id) {
function mbox_property (line 63) | static int mbox_property(int mb, void *buf) {
function mbox_open (line 72) | int mbox_open(void) {
function mbox_close (line 84) | void mbox_close(int mb) { close(mb); }
function gencmd (line 86) | static unsigned gencmd(int mb, const char *command, char *result, int re...
function set_init_max_memory (line 118) | void set_init_max_memory(int mb) {
function cal_percentage_usage (line 129) | static unsigned cal_percentage_usage(unsigned usage, unsigned all) { ret...
function set_gpuinfo_decode (line 131) | static void set_gpuinfo_decode(struct gpuinfo_dynamic_info *dynamic_info...
function set_gpuinfo_temp (line 143) | static void set_gpuinfo_temp(struct gpuinfo_dynamic_info *dynamic_info, ...
function set_gpuinfo_clock (line 155) | static void set_gpuinfo_clock(struct gpuinfo_dynamic_info *dynamic_info,...
function set_gpuinfo_from_vcio (line 167) | void set_gpuinfo_from_vcio(struct gpuinfo_dynamic_info *dynamic_info, in...
function set_memory_gpuinfo (line 173) | void set_memory_gpuinfo(struct gpuinfo_dynamic_info *dynamic_info) {
FILE: src/extract_npuinfo_rockchip.c
type gpu_info_rknpu (line 31) | struct gpu_info_rknpu {
type gpu_info_rknpu (line 35) | struct gpu_info_rknpu
function gpuinfo_rknpu_init (line 37) | static bool gpuinfo_rknpu_init(void) {
function gpuinfo_rknpu_shutdown (line 44) | static void gpuinfo_rknpu_shutdown(void) {
function add_rknpu_chip (line 55) | static void add_rknpu_chip(struct list_head *devices, unsigned *count) {
function gpuinfo_rknpu_get_device_handles (line 69) | static bool gpuinfo_rknpu_get_device_handles(struct list_head *devices_l...
function gpuinfo_rknpu_populate_static_info (line 77) | static void gpuinfo_rknpu_populate_static_info(struct gpu_info *_gpu_inf...
function read_int_from_file (line 89) | static int read_int_from_file(const char *path) {
function read_npu_load (line 99) | static int read_npu_load(const char *file) {
function set_gpuinfo_dynamic_memory (line 115) | static int set_gpuinfo_dynamic_memory(struct gpuinfo_dynamic_info *dynam...
function gpuinfo_rknpu_refresh_dynamic_info (line 138) | static void gpuinfo_rknpu_refresh_dynamic_info(struct gpu_info *_gpu_inf...
function gpuinfo_rknpu_get_running_processes (line 157) | static void gpuinfo_rknpu_get_running_processes(struct gpu_info *_gpu_in...
type gpu_vendor (line 161) | struct gpu_vendor
function init_extract_gpuinfo_rknpu (line 172) | __attribute__((constructor)) static void init_extract_gpuinfo_rknpu(void) {
FILE: src/extract_processinfo_fdinfo.c
type callback_entry (line 44) | struct callback_entry {
type callback_entry (line 53) | struct callback_entry
function processinfo_drop_callback (line 55) | void processinfo_drop_callback(const struct gpu_info *info) {
function processinfo_register_fdinfo_callback (line 65) | void processinfo_register_fdinfo_callback(processinfo_fdinfo_callback ca...
function processinfo_enable_disable_callback_for (line 80) | void processinfo_enable_disable_callback_for(const struct gpu_info *info...
function is_drm_fd (line 88) | static bool is_drm_fd(int fd_dir_fd, const char *name) {
function processinfo_sweep_fdinfos (line 101) | void processinfo_sweep_fdinfos(void) {
FILE: src/extract_processinfo_mac.c
function processinfo_drop_callback (line 23) | void processinfo_drop_callback(const struct gpu_info *info) {
function processinfo_register_fdinfo_callback (line 27) | void processinfo_register_fdinfo_callback(processinfo_fdinfo_callback ca...
function processinfo_sweep_fdinfos (line 32) | void processinfo_sweep_fdinfos(void) {
function processinfo_enable_disable_callback_for (line 35) | void processinfo_enable_disable_callback_for(const struct gpu_info *info...
FILE: src/get_process_info_linux.c
function get_username_from_pid (line 36) | void get_username_from_pid(pid_t pid, char **buffer) {
function get_command_from_pid (line 62) | void get_command_from_pid(pid_t pid, char **buffer) {
function get_process_info (line 179) | bool get_process_info(pid_t pid, struct process_cpu_usage *usage) {
FILE: src/get_process_info_mac.c
function get_username_from_pid (line 32) | void get_username_from_pid(pid_t pid, char **buffer) {
function get_command_from_pid (line 52) | void get_command_from_pid(pid_t pid, char **buffer) {
function get_process_info (line 117) | bool get_process_info(pid_t pid, struct process_cpu_usage *usage) {
FILE: src/info_messages_linux.c
function get_linux_kernel_release (line 31) | static int get_linux_kernel_release(unsigned *major, unsigned *minor, un...
type messages (line 40) | enum messages {
function get_info_messages (line 53) | void get_info_messages(struct list_head *devices, unsigned *num_messages...
FILE: src/info_messages_mac.c
function get_info_messages (line 25) | void get_info_messages(struct list_head *devices, unsigned *num_messages...
FILE: src/ini.c
type ini_parse_string_ctx (line 42) | typedef struct {
function ini_parse_stream (line 92) | int ini_parse_stream(ini_reader reader, void *stream, ini_handler handle...
function ini_parse_file (line 233) | int ini_parse_file(FILE *file, ini_handler handler, void *user) {
function ini_parse (line 238) | int ini_parse(const char *filename, ini_handler handler, void *user) {
function ini_parse_string (line 278) | int ini_parse_string(const char *string, ini_handler handler, void *user) {
FILE: src/interface.c
function alloc_device_window (line 58) | static void alloc_device_window(unsigned int start_row, unsigned int sta...
function free_device_windows (line 188) | static void free_device_windows(struct device_window *dwin) {
function alloc_process_with_option (line 207) | static void alloc_process_with_option(struct nvtop_interface *interface,...
function initialize_gpu_mem_plot (line 230) | static void initialize_gpu_mem_plot(struct plot_window *plot, struct win...
function alloc_plot_window (line 323) | static void alloc_plot_window(unsigned devices_count, struct window_posi...
function device_length (line 344) | static unsigned device_length(void) {
function initialize_all_windows (line 353) | static void initialize_all_windows(struct nvtop_interface *dwin) {
function delete_all_windows (line 386) | static void delete_all_windows(struct nvtop_interface *dwin) {
function initialize_colors (line 404) | static void initialize_colors(void) {
type nvtop_interface (line 423) | struct nvtop_interface
type nvtop_interface (line 425) | struct nvtop_interface
function clean_ncurses (line 460) | void clean_ncurses(struct nvtop_interface *interface) {
function draw_percentage_meter (line 470) | static void draw_percentage_meter(WINDOW *win, const char *prelude, unsi...
function draw_percentage_meter_with_yellow_highlight (line 497) | static void draw_percentage_meter_with_yellow_highlight(WINDOW *win, con...
function draw_temp_color (line 515) | static void draw_temp_color(WINDOW *win, unsigned int temp, unsigned int...
function print_pcie_at_scale (line 543) | static void print_pcie_at_scale(WINDOW *win, unsigned int value) {
function werase_and_wnoutrefresh (line 561) | static inline void werase_and_wnoutrefresh(WINDOW *w) {
function cleaned_enc_window (line 566) | static bool cleaned_enc_window(struct device_window *dev, double encode_...
function cleaned_dec_window (line 584) | static bool cleaned_dec_window(struct device_window *dev, double encode_...
function encode_decode_show_select (line 602) | static void encode_decode_show_select(struct device_window *dev, bool en...
function draw_devices (line 643) | static void draw_devices(struct list_head *devices, struct nvtop_interfa...
type all_processes (line 893) | typedef struct {
function all_processes (line 901) | static all_processes all_processes_array(struct list_head *devices) {
function compare_pid_desc (line 933) | static int compare_pid_desc(const void *pp1, const void *pp2) {
function compare_pid_asc (line 939) | static int compare_pid_asc(const void *pp1, const void *pp2) { return co...
function compare_username_desc (line 941) | static int compare_username_desc(const void *pp1, const void *pp2) {
function compare_username_asc (line 950) | static int compare_username_asc(const void *pp1, const void *pp2) { retu...
function compare_process_name_desc (line 952) | static int compare_process_name_desc(const void *pp1, const void *pp2) {
function compare_process_name_asc (line 961) | static int compare_process_name_asc(const void *pp1, const void *pp2) { ...
function compare_mem_usage_desc (line 963) | static int compare_mem_usage_desc(const void *pp1, const void *pp2) {
function compare_mem_usage_asc (line 973) | static int compare_mem_usage_asc(const void *pp1, const void *pp2) { ret...
function compare_cpu_usage_desc (line 975) | static int compare_cpu_usage_desc(const void *pp1, const void *pp2) {
function compare_cpu_usage_asc (line 984) | static int compare_cpu_usage_asc(const void *pp1, const void *pp2) { ret...
function compare_cpu_mem_usage_desc (line 986) | static int compare_cpu_mem_usage_desc(const void *pp1, const void *pp2) {
function compare_cpu_mem_usage_asc (line 996) | static int compare_cpu_mem_usage_asc(const void *pp1, const void *pp2) {...
function compare_gpu_desc (line 998) | static int compare_gpu_desc(const void *pp1, const void *pp2) {
function compare_gpu_asc (line 1004) | static int compare_gpu_asc(const void *pp1, const void *pp2) { return -c...
function compare_process_type_desc (line 1006) | static int compare_process_type_desc(const void *pp1, const void *pp2) {
function compare_process_type_asc (line 1012) | static int compare_process_type_asc(const void *pp1, const void *pp2) { ...
function compare_process_gpu_rate_desc (line 1014) | static int compare_process_gpu_rate_desc(const void *pp1, const void *pp...
function compare_process_gpu_rate_asc (line 1030) | static int compare_process_gpu_rate_asc(const void *pp1, const void *pp2) {
function compare_process_enc_rate_desc (line 1034) | static int compare_process_enc_rate_desc(const void *pp1, const void *pp...
function compare_process_enc_rate_asc (line 1051) | static int compare_process_enc_rate_asc(const void *pp1, const void *pp2) {
function compare_process_dec_rate_desc (line 1055) | static int compare_process_dec_rate_desc(const void *pp1, const void *pp...
function compare_process_dec_rate_asc (line 1071) | static int compare_process_dec_rate_asc(const void *pp1, const void *pp2) {
function sort_process (line 1075) | static void sort_process(all_processes all_procs, enum process_field cri...
function filter_out_nvtop_pid (line 1152) | static void filter_out_nvtop_pid(all_processes *all_procs, struct nvtop_...
function update_selected_offset_with_window_size (line 1169) | static void update_selected_offset_with_window_size(unsigned int *select...
function print_processes_on_screen (line 1191) | static void print_processes_on_screen(all_processes all_procs, struct pr...
type nvtop_interface (line 1402) | struct nvtop_interface
function draw_processes (line 1404) | static void draw_processes(struct list_head *devices, struct nvtop_inter...
function draw_kill_option (line 1468) | static void draw_kill_option(struct nvtop_interface *interface) {
function draw_sort_option (line 1497) | static void draw_sort_option(struct nvtop_interface *interface) {
function update_process_option_win (line 1547) | static void update_process_option_win(struct nvtop_interface *interface) {
function draw_process_shortcuts (line 1602) | static void draw_process_shortcuts(struct nvtop_interface *interface) {
function draw_shortcuts (line 1651) | static void draw_shortcuts(struct nvtop_interface *interface) {
function save_current_data_to_ring (line 1659) | void save_current_data_to_ring(struct list_head *devices, struct nvtop_i...
function populate_plot_data_from_ring_buffer (line 1734) | static unsigned populate_plot_data_from_ring_buffer(const struct nvtop_i...
function draw_plots (line 1815) | static void draw_plots(struct nvtop_interface *interface) {
function draw_gpu_info_ncurses (line 1832) | void draw_gpu_info_ncurses(unsigned devices_count, struct list_head *dev...
function update_window_size_to_terminal_size (line 1845) | void update_window_size_to_terminal_size(struct nvtop_interface *inter) {
function is_escape_for_quit (line 1854) | bool is_escape_for_quit(struct nvtop_interface *interface) {
function option_do_kill (line 1861) | static void option_do_kill(struct nvtop_interface *interface) {
function option_change_sort (line 1871) | static void option_change_sort(struct nvtop_interface *interface) {
function interface_key (line 1886) | void interface_key(int keyId, struct nvtop_interface *interface) {
function interface_freeze_processes (line 1988) | bool interface_freeze_processes(struct nvtop_interface *interface) {
function interface_update_interval (line 1994) | int interface_update_interval(const struct nvtop_interface *interface) {...
function interface_largest_gpu_name (line 1996) | unsigned interface_largest_gpu_name(struct list_head *devices) {
function interface_check_monitored_gpu_change (line 2008) | void interface_check_monitored_gpu_change(struct nvtop_interface **inter...
function message_lines (line 2028) | static unsigned message_lines(unsigned message_size, unsigned cols) { re...
function show_information_messages (line 2030) | bool show_information_messages(unsigned num_messages, const char **messa...
function print_snapshot (line 2097) | void print_snapshot(struct list_head *devices, bool use_fahrenheit_optio...
FILE: src/interface_layout_selection.c
function min_rows_taken_by_process (line 15) | static unsigned min_rows_taken_by_process(unsigned rows, unsigned num_de...
function min_plot_cols (line 21) | static unsigned min_plot_cols(unsigned num_data_info_to_plot) {
function who_to_merge (line 28) | static bool who_to_merge(unsigned max_merge_size, unsigned plot_count, u...
function move_plot_to_stack (line 53) | static bool move_plot_to_stack(unsigned stack_max_cols, unsigned plot_id...
function info_in_plot (line 70) | static unsigned info_in_plot(unsigned plot_id, unsigned devices_count, c...
function cols_used_by_stack (line 81) | static unsigned cols_used_by_stack(unsigned stack_id, unsigned plot_coun...
function size_differences_between_stacks (line 91) | static unsigned size_differences_between_stacks(unsigned plot_count, uns...
function preliminary_plot_positioning (line 106) | static void preliminary_plot_positioning(unsigned rows_for_plots, unsign...
function balance_info_on_stacks_preserving_plot_order (line 205) | static void balance_info_on_stacks_preserving_plot_order(unsigned stack_...
function compute_sizes_from_layout (line 233) | void compute_sizes_from_layout(unsigned devices_count, unsigned device_h...
FILE: src/interface_options.c
function interface_check_and_fix_monitored_gpus (line 65) | unsigned interface_check_and_fix_monitored_gpus(unsigned num_devices, st...
function alloc_interface_options_internals (line 109) | void alloc_interface_options_internals(char *config_location, unsigned n...
type nvtop_option_ini_data (line 152) | struct nvtop_option_ini_data {
function nvtop_option_ini_handler (line 197) | static int nvtop_option_ini_handler(void *user, const char *section, con...
function load_interface_options_from_config_file (line 335) | bool load_interface_options_from_config_file(unsigned num_devices, nvtop...
function create_config_directory_rec (line 348) | static bool create_config_directory_rec(char *config_directory) {
function save_interface_options_to_config_file (line 374) | bool save_interface_options_to_config_file(unsigned total_dev_count, con...
type plot_information (line 446) | enum plot_information
type plot_information (line 448) | enum plot_information
type plot_information (line 452) | enum plot_information
type process_field (line 456) | enum process_field
type process_field (line 458) | enum process_field
type process_field (line 461) | enum process_field
function process_default_sort_by_from (line 468) | enum process_field process_default_sort_by_from(process_field_displayed ...
FILE: src/interface_ring_buffer.c
function interface_alloc_ring_buffer (line 7) | void interface_alloc_ring_buffer(unsigned devices_count, unsigned per_de...
function interface_free_ring_buffer (line 24) | void interface_free_ring_buffer(interface_ring_buffer *buffer) {
FILE: src/interface_setup_win.c
type setup_window_type (line 34) | enum setup_window_type {
type setup_general_options (line 44) | enum setup_general_options {
type setup_header_options (line 56) | enum setup_header_options {
type setup_chart_options (line 69) | enum setup_chart_options {
type setup_proc_list_options (line 86) | enum setup_proc_list_options {
type option_state (line 109) | enum option_state {
function option_state_char (line 115) | static char option_state_char(enum option_state state) {
function alloc_setup_window (line 128) | void alloc_setup_window(struct window_position *position, struct setup_w...
function free_setup_window (line 156) | void free_setup_window(struct setup_window *setup_win) {
function show_setup_window (line 164) | void show_setup_window(struct nvtop_interface *interface) {
function hide_setup_window (line 174) | void hide_setup_window(struct nvtop_interface *interface) { interface->s...
function draw_setup_window_setup (line 176) | static void draw_setup_window_setup(struct nvtop_interface *interface) {
function draw_setup_window_general (line 198) | static void draw_setup_window_general(struct nvtop_interface *interface) {
function draw_setup_window_header (line 242) | static void draw_setup_window_header(struct nvtop_interface *interface) {
function draw_setup_window_chart (line 296) | static void draw_setup_window_chart(unsigned devices_count, struct list_...
function draw_setup_window_proc_list (line 423) | static void draw_setup_window_proc_list(struct nvtop_interface *interfac...
function draw_setup_window_gpu_select (line 557) | static void draw_setup_window_gpu_select(struct nvtop_interface *interfa...
function draw_setup_window_shortcuts (line 589) | void draw_setup_window_shortcuts(struct nvtop_interface *interface) {
function draw_setup_window (line 607) | void draw_setup_window(unsigned devices_count, struct list_head *devices...
function handle_setup_win_keypress (line 630) | void handle_setup_win_keypress(int keyId, struct nvtop_interface *interf...
FILE: src/mali_common.h
type drmFuncTable (line 34) | struct drmFuncTable {
type mali_version (line 48) | enum mali_version {
type mali_process_info_cache (line 54) | struct mali_process_info_cache
type panfrost_driver_data (line 56) | struct panfrost_driver_data {
type panthor_driver_data (line 61) | struct panthor_driver_data {
type gpu_info_mali (line 65) | struct gpu_info_mali {
type mali_gpu_state (line 81) | struct mali_gpu_state {
type fdinfo_data (line 97) | struct fdinfo_data {
type drmFuncTable (line 113) | struct drmFuncTable
type mali_gpu_state (line 113) | struct mali_gpu_state
type mali_gpu_state (line 114) | struct mali_gpu_state
type mali_gpu_state (line 115) | struct mali_gpu_state
type drmFuncTable (line 115) | struct drmFuncTable
type mali_gpu_state (line 116) | struct mali_gpu_state
type mali_gpu_state (line 119) | struct mali_gpu_state
type drmFuncTable (line 120) | struct drmFuncTable
type gpu_vendor (line 121) | struct gpu_vendor
type list_head (line 123) | struct list_head
type gpu_info_mali (line 124) | struct gpu_info_mali
type mali_version (line 125) | enum mali_version
type gpuinfo_dynamic_info (line 126) | struct gpuinfo_dynamic_info
type mali_gpu_state (line 127) | struct mali_gpu_state
type gpu_info (line 130) | struct gpu_info
type mali_version (line 130) | enum mali_version
type gpu_info_mali (line 132) | struct gpu_info_mali
type gpu_process (line 133) | struct gpu_process
type gpu_info (line 139) | struct gpu_info
type gpu_process (line 140) | struct gpu_process
type gpuinfo_dynamic_info (line 141) | struct gpuinfo_dynamic_info
type fdinfo_data (line 143) | struct fdinfo_data
FILE: src/nvtop.c
function exit_handler (line 46) | static void exit_handler(int signum) {
function resize_handler (line 51) | static void resize_handler(int signum) {
function cont_handler (line 56) | static void cont_handler(int signum) {
type option (line 83) | struct option
function main (line 103) | int main(int argc, char **argv) {
FILE: src/panfrost_drm.h
type drm_panfrost_submit (line 49) | struct drm_panfrost_submit {
type drm_panfrost_wait_bo (line 81) | struct drm_panfrost_wait_bo {
type drm_panfrost_create_bo (line 96) | struct drm_panfrost_create_bo {
type drm_panfrost_mmap_bo (line 125) | struct drm_panfrost_mmap_bo {
type drm_panfrost_param (line 133) | enum drm_panfrost_param {
type drm_panfrost_get_param (line 178) | struct drm_panfrost_get_param {
type drm_panfrost_get_bo_offset (line 189) | struct drm_panfrost_get_bo_offset {
type drm_panfrost_perfcnt_enable (line 195) | struct drm_panfrost_perfcnt_enable {
type drm_panfrost_perfcnt_dump (line 204) | struct drm_panfrost_perfcnt_dump {
type drm_panfrost_madvise (line 222) | struct drm_panfrost_madvise {
type panfrost_dump_object_header (line 243) | struct panfrost_dump_object_header {
type panfrost_dump_registers (line 274) | struct panfrost_dump_registers {
FILE: src/panthor_drm.h
type drm_panthor_ioctl_id (line 85) | enum drm_panthor_ioctl_id {
type drm_panthor_obj_array (line 184) | struct drm_panthor_obj_array {
type drm_panthor_sync_op_flags (line 209) | enum drm_panthor_sync_op_flags {
type drm_panthor_sync_op (line 232) | struct drm_panthor_sync_op {
type drm_panthor_dev_query_type (line 252) | enum drm_panthor_dev_query_type {
type drm_panthor_gpu_info (line 265) | struct drm_panthor_gpu_info {
type drm_panthor_csif_info (line 340) | struct drm_panthor_csif_info {
type drm_panthor_dev_query (line 372) | struct drm_panthor_dev_query {
type drm_panthor_vm_create (line 400) | struct drm_panthor_vm_create {
type drm_panthor_vm_destroy (line 433) | struct drm_panthor_vm_destroy {
type drm_panthor_vm_bind_op_flags (line 444) | enum drm_panthor_vm_bind_op_flags {
type drm_panthor_vm_bind_op (line 481) | struct drm_panthor_vm_bind_op {
type drm_panthor_vm_bind_flags (line 519) | enum drm_panthor_vm_bind_flags {
type drm_panthor_vm_bind (line 530) | struct drm_panthor_vm_bind {
type drm_panthor_bo_flags (line 544) | enum drm_panthor_bo_flags {
type drm_panthor_bo_create (line 552) | struct drm_panthor_bo_create {
type drm_panthor_bo_mmap_offset (line 588) | struct drm_panthor_bo_mmap_offset {
type drm_panthor_queue_create (line 602) | struct drm_panthor_queue_create {
type drm_panthor_group_priority (line 619) | enum drm_panthor_group_priority {
type drm_panthor_group_create (line 633) | struct drm_panthor_group_create {
type drm_panthor_group_destroy (line 711) | struct drm_panthor_group_destroy {
type drm_panthor_queue_submit (line 726) | struct drm_panthor_queue_submit {
type drm_panthor_group_submit (line 769) | struct drm_panthor_group_submit {
type drm_panthor_group_state_flags (line 783) | enum drm_panthor_group_state_flags {
type drm_panthor_group_get_state (line 805) | struct drm_panthor_group_get_state {
type drm_panthor_tiler_heap_create (line 825) | struct drm_panthor_tiler_heap_create {
type drm_panthor_tiler_heap_destroy (line 864) | struct drm_panthor_tiler_heap_destroy {
FILE: src/plot.c
function data_level (line 31) | static inline int data_level(double rows, double data, double increment) {
function nvtop_line_plot (line 35) | void nvtop_line_plot(WINDOW *win, size_t num_data, const double *data, u...
function draw_rectangle (line 125) | void draw_rectangle(WINDOW *win, unsigned startX, unsigned startY, unsig...
FILE: tests/interfaceTests.cpp
type window_position (line 32) | struct window_position
function window_position_overlap (line 40) | bool window_position_overlap(struct window_position &w1, struct window_p...
function window_is_empty (line 48) | bool window_is_empty(const struct window_position &w1) { return w1.sizeX...
function check_non_empty_window (line 52) | bool check_non_empty_window(const struct window_position &w1) {
function check_no_windows_overlap (line 59) | bool check_no_windows_overlap(std::vector<struct window_position> &windo...
function check_window_inside (line 75) | bool check_window_inside(const struct window_position &win, const struct...
function check_window_below (line 84) | bool check_window_below(const struct window_position &w1, const struct w...
function check_layout (line 90) | bool check_layout(struct window_position screen, std::vector<struct wind...
function test_with_terminal_size (line 130) | bool test_with_terminal_size(unsigned device_count, unsigned header_rows...
function TEST (line 155) | TEST(InterfaceLayout, LayoutSelection_issue_147) { test_with_terminal_si...
function TEST (line 157) | TEST(InterfaceLayout, CheckEmptyProcessWindow) {
function TEST (line 180) | TEST(InterfaceLayout, FixInfiniteLoop) {
function TEST (line 201) | TEST(InterfaceLayout, LayoutSelection_test_fail_case1) { test_with_termi...
function TEST (line 205) | TEST(InterfaceLayout, CheckManyTermSize) {
Condensed preview — 97 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (994K chars).
[
{
"path": ".clang-format",
"chars": 5001,
"preview": "---\nLanguage: Cpp\n# BasedOnStyle: LLVM\nAccessModifierOffset: -2\nAlignAfterOpenBracket: Align\nAlignArrayOfStructu"
},
{
"path": ".github/workflows/compile.yml",
"chars": 830,
"preview": "name: Compile Ubuntu\n\non:\n - push\n - pull_request\n\njobs:\n build:\n runs-on: ${{ matrix.os }}\n\n strategy:\n f"
},
{
"path": ".gitignore",
"chars": 46,
"preview": "*.o\n*ctags\nbuild/\ncmake-build*/\n.vscode\n.idea\n"
},
{
"path": "AppImage/README.md",
"chars": 166,
"preview": "# Build the AppImage\n\n```bash\npodman pull ubuntu:18.04\npodman run --interactive --tty --rm --volume $PWD:/nvtop ubuntu:2"
},
{
"path": "AppImage/make_appimage.sh",
"chars": 1557,
"preview": "#!/usr/bin/env bash\n\nexport ARCH=\"$(uname -m)\"\nexport APPIMAGE_EXTRACT_AND_RUN=1\nAPPIMAGETOOL=\"https://github.com/AppIma"
},
{
"path": "CMakeLists.txt",
"chars": 7408,
"preview": "cmake_minimum_required(VERSION 3.18)\n\n#///////////////////////////////////////////////////////////////////#\n# "
},
{
"path": "COPYING",
"chars": 35147,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "Dockerfile",
"chars": 1252,
"preview": "\n# BUILD: docker build . -t nvtop\n# or use other image with: --build-arg IMAGE=nvcr.io/nvidia/cudagl:11.4.2-base-ubuntu2"
},
{
"path": "README.markdown",
"chars": 12434,
"preview": "NVTOP\n=====\n\nWhat is NVTOP?\n--------------\n\nNVTOP stands for Neat Videocard TOP, a (h)top like task monitor for GPUs and"
},
{
"path": "cmake/cmake_uninstall.cmake.in",
"chars": 1044,
"preview": "if(NOT EXISTS \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\")\n message(FATAL_ERROR\n \"Cannot find install manifest"
},
{
"path": "cmake/compile-flags-helpers.cmake",
"chars": 2799,
"preview": "include(CheckLinkerFlag)\n\nfunction(add_compiler_option_to_target_type TARGET BUILDTYPE VISIBILITY OPTIONS)\n include(Che"
},
{
"path": "cmake/modules/FindASan.cmake",
"chars": 2144,
"preview": "# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Federal Repub"
},
{
"path": "cmake/modules/FindCurses.cmake",
"chars": 8954,
"preview": "# Distributed under the OSI-approved BSD 3-Clause License. See accompanying\n# file Copyright.txt or https://cmake.org/l"
},
{
"path": "cmake/modules/FindLibdrm.cmake",
"chars": 3421,
"preview": "#.rst:\n# FindLibdrm\n# -------\n#\n# Try to find libdrm on a Unix system.\n#\n# This will define the following variables:\n#\n#"
},
{
"path": "cmake/modules/FindMSan.cmake",
"chars": 2292,
"preview": "# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Federal Repub"
},
{
"path": "cmake/modules/FindSanitizers.cmake",
"chars": 3737,
"preview": "# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Federal Repub"
},
{
"path": "cmake/modules/FindSystemd.cmake",
"chars": 1222,
"preview": "#\n# - Find systemd libraries\n#\n# SYSTEMD_INCLUDE_DIRS - where to find systemd/sd-journal.h, etc.\n# SYSTEMD_LIBRARIES "
},
{
"path": "cmake/modules/FindTSan.cmake",
"chars": 2555,
"preview": "# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Federal Repub"
},
{
"path": "cmake/modules/FindUBSan.cmake",
"chars": 1696,
"preview": "# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Federal Repub"
},
{
"path": "cmake/modules/FindUDev.cmake",
"chars": 1572,
"preview": "# Configure libudev environment\n#\n# UDEV_FOUND - system has a libudev\n# UDEV_INCLUDE_DIR - where to find header files\n# "
},
{
"path": "cmake/modules/asan-wrapper",
"chars": 2011,
"preview": "#!/bin/sh\n\n# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Fe"
},
{
"path": "cmake/modules/sanitize-helpers.cmake",
"chars": 7684,
"preview": "# The MIT License (MIT)\n#\n# Copyright (c)\n# 2013 Matthew Arsenault\n# 2015-2016 RWTH Aachen University, Federal Repub"
},
{
"path": "cmake/optimization_flags.cmake",
"chars": 885,
"preview": "set(ADDITIONAL_DEBUG_COMPILE_OPTIONS\n \"-Wall\"\n #\"-Wpedantic\"\n \"-Wextra\"\n \"-Waddress\"\n \"-Waggressive-loop-optimizati"
},
{
"path": "desktop/nvtop.desktop",
"chars": 167,
"preview": "[Desktop Entry]\nName=nvtop\nGenericName=GPU Process Monitor\nType=Application\nTerminal=true\nExec=nvtop\nIcon=nvtop\nCategori"
},
{
"path": "desktop/nvtop.metainfo.xml.in",
"chars": 1563,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<component type=\"console-application\">\n <id>io.github.syllo.nvtop</id>\n\n <n"
},
{
"path": "include/ascend/dcmi_interface_api.h",
"chars": 15788,
"preview": "/* Copyright(C) 2021-2023. Huawei Technologies Co.,Ltd. All rights reserved.\nLicensed under the Apache License, Version"
},
{
"path": "include/ini.h",
"chars": 5343,
"preview": "/* inih -- simple .INI file parser\n\nSPDX-License-Identifier: BSD-3-Clause\n\nCopyright (C) 2009-2020, Ben Hoyt\n\ninih is re"
},
{
"path": "include/libdrm/xe_drm.h",
"chars": 55400,
"preview": "/* SPDX-License-Identifier: MIT */\n\n/* This file is required by nvtop in order to support the newest xe driver whose xe_"
},
{
"path": "include/list.h",
"chars": 6908,
"preview": "/*\n * Copyright (C) 2002 Free Software Foundation, Inc.\n * (originally part of the GNU C Library)\n * Contributed by Ulri"
},
{
"path": "include/nvtop/common.h",
"chars": 1654,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/device_discovery.h",
"chars": 2771,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/extract_gpuinfo.h",
"chars": 1457,
"preview": "/*\n *\n * Copyright (C) 2017-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "include/nvtop/extract_gpuinfo_common.h",
"chars": 10133,
"preview": "/*\n *\n * Copyright (C) 2021-2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "include/nvtop/extract_processinfo_fdinfo.h",
"chars": 2396,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/get_process_info.h",
"chars": 1308,
"preview": "/*\n *\n * Copyright (C) 2017-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "include/nvtop/info_messages.h",
"chars": 941,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/interface.h",
"chars": 2206,
"preview": "/*\n *\n * Copyright (C) 2017-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "include/nvtop/interface_common.h",
"chars": 1447,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/interface_internal_common.h",
"chars": 4139,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/interface_layout_selection.h",
"chars": 1000,
"preview": "#ifndef INTERFACE_LAYOUT_SELECTION_H__\n#define INTERFACE_LAYOUT_SELECTION_H__\n\n#include \"nvtop/interface_common.h\"\n#incl"
},
{
"path": "include/nvtop/interface_options.h",
"chars": 5822,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/interface_ring_buffer.h",
"chars": 4908,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/interface_setup_win.h",
"chars": 1503,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/plot.h",
"chars": 1210,
"preview": "/*\n *\n * Copyright (C) 2018 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/nvtop/time.h",
"chars": 2597,
"preview": "/*\n *\n * Copyright (C) 2018-2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "include/nvtop/version.h.in",
"chars": 1075,
"preview": "/*\n *\n * Copyright (C) 2018 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "include/uthash.h",
"chars": 73785,
"preview": "/*\nCopyright (c) 2003-2021, Troy D. Hanson http://troydhanson.github.io/uthash/\nAll rights reserved.\n\nRedistribution"
},
{
"path": "manpage/nvtop.in",
"chars": 4028,
"preview": ".\\\" Manpage for nvtop\n.\\\" Contact maxime.schmitt91@gmail.com\n\n.TH nvtop 1 \"@TODAY_MANPAGE@\" \"Version @nvtop_VERSION_MAJO"
},
{
"path": "snap/snapcraft.yaml",
"chars": 2162,
"preview": "name: nvtop\nbase: core22\nadopt-info: nvtop\nsummary: 'GPUs monitoring tool for AMD, Intel and NVIDIA'\ndescription: |\n Nv"
},
{
"path": "src/CMakeLists.txt",
"chars": 5258,
"preview": "include(CheckCSourceCompiles)\n\nconfigure_file(\n \"${PROJECT_SOURCE_DIR}/include/nvtop/version.h.in\"\n \"${PROJECT_BINARY_"
},
{
"path": "src/amdgpu_ids.h",
"chars": 23186,
"preview": "\n/*\n * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.\n *\n * This file is modified from libdrm. MIT"
},
{
"path": "src/device_discovery_linux.c",
"chars": 12451,
"preview": "/*\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop and adapted from r"
},
{
"path": "src/extract_gcuinfo_enflame.c",
"chars": 42162,
"preview": "/*\n *\n * Copyright (c) 2025 Enflame Technology (Shanghai) Co., Ltd. All rights reserved.\n *\n * This file is part of Nvto"
},
{
"path": "src/extract_gpuinfo.c",
"chars": 15417,
"preview": "/*\n *\n * Copyright (C) 2017-2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "src/extract_gpuinfo_amdgpu.c",
"chars": 40053,
"preview": "/*\n * Copyright (C) 2012 Lauri Kasanen\n * Copyright (C) 2018 Genesis Cloud Ltd.\n * Copyright (C) 2022 YiFei Zhu <zhuyife"
},
{
"path": "src/extract_gpuinfo_amdgpu_utils.c",
"chars": 873,
"preview": "/*\n * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.\n *\n * MIT License.\n */\n\n\n#include <assert.h>\n"
},
{
"path": "src/extract_gpuinfo_apple.m",
"chars": 9272,
"preview": "/*\n * Copyright (C) 2023 Robin Voetter <robin@voetter.nl>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is free software"
},
{
"path": "src/extract_gpuinfo_ascend.c",
"chars": 9945,
"preview": "/*\n * Copyright (C) 2023 klayer <klayer@163.com>\n *\n * This file is part of Nvtop and adapted from Ascend DCMI from Huaw"
},
{
"path": "src/extract_gpuinfo_intel.c",
"chars": 15376,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop and adapted fro"
},
{
"path": "src/extract_gpuinfo_intel.h",
"chars": 2427,
"preview": "#include <stdint.h>\n#include <uthash.h>\n\n#define HASH_FIND_CLIENT(head, key_ptr, out_ptr) HASH_FIND(hh, head, key_ptr, s"
},
{
"path": "src/extract_gpuinfo_intel_i915.c",
"chars": 13126,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop and adapted fro"
},
{
"path": "src/extract_gpuinfo_intel_xe.c",
"chars": 10124,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop and adapted fro"
},
{
"path": "src/extract_gpuinfo_mali_common.c",
"chars": 17404,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * This file is part of Nvtop and adapted f"
},
{
"path": "src/extract_gpuinfo_metax.c",
"chars": 22747,
"preview": "/*\n *\n * Copyright (c) 2025 MetaX Integrated Circuits (Shanghai) Co., Ltd. All rights reserved.\n *\n * This file is part "
},
{
"path": "src/extract_gpuinfo_msm.c",
"chars": 18821,
"preview": "/*\n *\n * Copyright (C) 2023 Ryan Houdek <Sonicadvance1@gmail.com>\n *\n * This file is part of Nvtop and adapted from the "
},
{
"path": "src/extract_gpuinfo_msm_utils.c",
"chars": 3016,
"preview": "/*\n *\n * Copyright (C) 2023 Ryan Houdek <Sonicadvance1@gmail.com>\n *\n * Nvtop is free software: you can redistribute it "
},
{
"path": "src/extract_gpuinfo_nvidia.c",
"chars": 39409,
"preview": "/*\n *\n * Copyright (C) 2021-2024 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "src/extract_gpuinfo_panfrost.c",
"chars": 11531,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * This file is part of Nvtop and adapted f"
},
{
"path": "src/extract_gpuinfo_panfrost_utils.c",
"chars": 3031,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * Nvtop is free software: you can redistri"
},
{
"path": "src/extract_gpuinfo_panthor.c",
"chars": 6799,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * This file is part of Nvtop and adapted f"
},
{
"path": "src/extract_gpuinfo_panthor_utils.c",
"chars": 1957,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * Nvtop is free software: you can redistri"
},
{
"path": "src/extract_gpuinfo_tpu.c",
"chars": 10845,
"preview": "/*\n *\n * Copyright (C) 2025 Robert Dyro <robert.dyro@gmail.com>\n *\n * This file is part of Nvtop\n *\n * Nvtop is free sof"
},
{
"path": "src/extract_gpuinfo_v3d.c",
"chars": 11141,
"preview": "/*\n *\n * Copyright (C) 2022 Hoream Xiao <horeamx@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is free softwa"
},
{
"path": "src/extract_gpuinfo_v3d_utils.c",
"chars": 6126,
"preview": "/*\n *\n * Copyright (C) 2022 Hoream Xiao <horeamx@gmail.com>\n *\n * This file is part of Nvtop and adapted from the vcgenc"
},
{
"path": "src/extract_npuinfo_rockchip.c",
"chars": 5777,
"preview": "/*\n *\n * Copyright (C) 2025 YuLong Yao <feilongphone@gmail.com>\n *\n * This file is part of Nvtop and adapted from igt-gp"
},
{
"path": "src/extract_processinfo_fdinfo.c",
"chars": 11167,
"preview": "/*\n * Copyright (C) 2022 YiFei Zhu <zhuyifei1999@gmail.com>\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail"
},
{
"path": "src/extract_processinfo_mac.c",
"chars": 1160,
"preview": "/*\n * Copyright (C) 2023 Robin Voetter <robin@voetter.nl>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is free software"
},
{
"path": "src/get_process_info_linux.c",
"chars": 6654,
"preview": "/*\n *\n * Copyright (C) 2017-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "src/get_process_info_mac.c",
"chars": 3993,
"preview": "/*\n *\n * Copyright (C) 2023 Robin Voetter <robin@voetter.nl>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is free softw"
},
{
"path": "src/info_messages_linux.c",
"chars": 2831,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "src/info_messages_mac.c",
"chars": 943,
"preview": "/*\n *\n * Copyright (C) 2023 Robin Voetter <robin@voetter.nl>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is free softw"
},
{
"path": "src/ini.c",
"chars": 7334,
"preview": "/* inih -- simple .INI file parser\n\nSPDX-License-Identifier: BSD-3-Clause\n\nCopyright (C) 2009-2020, Ben Hoyt\n\ninih is re"
},
{
"path": "src/interface.c",
"chars": 93619,
"preview": "/*\n *\n * Copyright (C) 2017-2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "src/interface_layout_selection.c",
"chars": 16353,
"preview": "#include \"nvtop/interface_layout_selection.h\"\n#include \"nvtop/interface.h\"\n#include \"nvtop/interface_options.h\"\n\n#includ"
},
{
"path": "src/interface_options.c",
"chars": 20928,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "src/interface_ring_buffer.c",
"chars": 2104,
"preview": "\n#include \"nvtop/interface_ring_buffer.h\"\n\n#include \"stdio.h\"\n#include \"stdlib.h\"\n\nvoid interface_alloc_ring_buffer(unsi"
},
{
"path": "src/interface_setup_win.c",
"chars": 40087,
"preview": "/*\n *\n * Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
},
{
"path": "src/mali_common.h",
"chars": 4777,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * This file is part of Nvtop and adapted f"
},
{
"path": "src/nvtop.c",
"chars": 14629,
"preview": "/*\n *\n * Copyright (C) 2017-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "src/panfrost_drm.h",
"chars": 8476,
"preview": "/* SPDX-License-Identifier: MIT */\n/*\n * Copyright © 2014-2018 Broadcom\n * Copyright © 2019 Collabora ltd.\n */\n#ifndef _"
},
{
"path": "src/panfrost_utils.h",
"chars": 952,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * Nvtop is free software: you can redistri"
},
{
"path": "src/panthor_drm.h",
"chars": 25891,
"preview": "/* SPDX-License-Identifier: MIT */\n/* Copyright (C) 2023 Collabora ltd. */\n#ifndef _PANTHOR_DRM_H_\n#define _PANTHOR_DRM_"
},
{
"path": "src/panthor_utils.h",
"chars": 782,
"preview": "/*\n *\n * Copyright (C) 2023 Adrian Larumbe <adrian.larumbe@collabora.com>\n *\n * Nvtop is free software: you can redistri"
},
{
"path": "src/plot.c",
"chars": 5223,
"preview": "/*\n *\n * Copyright (C) 2019-2021 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "src/time.c",
"chars": 1276,
"preview": "/*\n *\n * Copyright (C) 2018-2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvt"
},
{
"path": "tests/CMakeLists.txt",
"chars": 838,
"preview": "find_package(GTest)\nif (BUILD_TESTING AND GTest_FOUND)\n\n option(THOROUGH_TESTING \"Enable extensive testing (takes hours"
},
{
"path": "tests/interfaceTests.cpp",
"chars": 9992,
"preview": "/*\n *\n * Copyright (C) 2022 Maxime Schmitt <maxime.schmitt91@gmail.com>\n *\n * This file is part of Nvtop.\n *\n * Nvtop is"
}
]
About this extraction
This page contains the full source code of the Syllo/nvtop GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 97 files (933.4 KB), approximately 249.5k tokens, and a symbol index with 835 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.