Hello community, here is the log from the commit of package radeontop for openSUSE:Factory checked in at 2019-08-13 20:45:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/radeontop (Old) and /work/SRC/openSUSE:Factory/.radeontop.new.9556 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "radeontop" Tue Aug 13 20:45:16 2019 rev:7 rq:723102 version:1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/radeontop/radeontop.changes 2018-07-10 16:18:06.201287934 +0200 +++ /work/SRC/openSUSE:Factory/.radeontop.new.9556/radeontop.changes 2019-08-13 20:45:19.107044228 +0200 @@ -1,0 +2,7 @@ +Tue Aug 13 14:44:52 UTC 2019 - Martin Pluskal <[email protected]> + +- Update to version 1.2: + * Add support for new graphic cards and their features +- Add radeontop-rpmlintrc to resolve error for xcb plugin + +------------------------------------------------------------------- Old: ---- radeontop-1.1.tar.gz New: ---- radeontop-1.2.tar.gz radeontop-rpmlintrc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ radeontop.spec ++++++ --- /var/tmp/diff_new_pack.MysO8T/_old 2019-08-13 20:45:19.607044084 +0200 +++ /var/tmp/diff_new_pack.MysO8T/_new 2019-08-13 20:45:19.611044082 +0200 @@ -1,7 +1,7 @@ # # spec file for package radeontop # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,18 +12,19 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: radeontop -Version: 1.1 +Version: 1.2 Release: 0 Summary: View Radeon GPU utilization License: GPL-3.0-only Group: System/Monitoring URL: https://github.com/clbr/radeontop -Source: https://github.com/clbr/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source0: https://github.com/clbr/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: radeontop-rpmlintrc BuildRequires: pkgconfig BuildRequires: pkgconfig(libdrm) >= 2.4.63 BuildRequires: pkgconfig(ncurses) ++++++ radeontop-1.1.tar.gz -> radeontop-1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/Makefile new/radeontop-1.2/Makefile --- old/radeontop-1.1/Makefile 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/Makefile 2019-06-03 09:59:56.000000000 +0200 @@ -8,11 +8,12 @@ # plain apply neither -g nor -s. # xcb enable libxcb to run unprivileged in Xorg, default on # amdgpu enable amdgpu VRAM size and usage reporting, default off -# because amdgpu requires libdrm >= 2.4.63 +# because amdgpu requires libdrm >= 2.4.77 PREFIX ?= /usr INSTALL ?= install LIBDIR ?= lib +MANDIR ?= share/man nls ?= 1 xcb ?= 1 @@ -78,7 +79,7 @@ all: $(xcblib) $(xcblib): auth_xcb.c $(wildcard include/*.h) $(verh) - $(CC) -shared -fPIC -o $@ $< $(CFLAGS) $(LDFLAGS) $(xcb_LIBS) + $(CC) -shared -fPIC -Wl,-soname,$@ -o $@ $< $(CFLAGS) $(LDFLAGS) $(xcb_LIBS) endif $(obj): $(wildcard include/*.h) $(verh) @@ -103,7 +104,7 @@ ifeq ($(xcb), 1) $(INSTALL) -D -m755 $(xcblib) $(DESTDIR)/$(PREFIX)/$(LIBDIR)/$(xcblib) endif - $(INSTALL) -D -m644 radeontop.1 $(DESTDIR)/$(PREFIX)/share/man/man1/radeontop.1 + $(INSTALL) -D -m644 radeontop.1 $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1/radeontop.1 ifeq ($(nls), 1) $(MAKE) -C translations install PREFIX=$(PREFIX) endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/README.md new/radeontop-1.2/README.md --- old/radeontop-1.1/README.md 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/README.md 2019-06-03 09:59:56.000000000 +0200 @@ -24,3 +24,65 @@ If you'd like to translate RadeonTop to your own language, please go here: https://translations.launchpad.net/radeontop + +Running +------- + +#### Prerequisites + +* libdrm +* libncurses +* libpciaccess +* libxcb + + +Simply start radeontop and it auto-selects the first supported GPU: + + ./radeontop + + +Running radeontop on a bus 0f: + + ./radeontop -b 0f + + +Writing values to stdout instead of showing a GUI: + + ./radeontop -d - + + +Getting all options: + + ./radeontop --help + + +Building +-------- + +#### Prerequisites +* all run time prerequisites with dev files +* gcc / clang +* pkgconf + +### Building +If all prerequisites are fullfilled, it can be build by simply running: + + make + +#### Build options + +Build options can be specified to having the following variables being set to "1" + + nls enable translations, default on + debug enable debug symbols, default off + nostrip disable stripping, default off + plain apply neither gcc's -g nor -s. + xcb enable libxcb to run unprivileged in Xorg, default on + amdgpu enable amdgpu VRAM size and usage reporting, default off (requires libdrm >= 2.4.77) + + +Example: + + make amdgpu=1 xcb=1 + +This will build radeontop with amdgpu VRAM reporting and xcb support. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/detect.c new/radeontop-1.2/detect.c --- old/radeontop-1.1/detect.c 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/detect.c 2019-06-03 09:59:56.000000000 +0200 @@ -1,5 +1,6 @@ /* Copyright (C) 2012 Lauri Kasanen + Copyright (C) 2018 Genesis Cloud Ltd. 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 @@ -18,18 +19,22 @@ #include <pciaccess.h> #include <dirent.h> +#ifdef ENABLE_AMDGPU +#ifndef AMDGPU_INFO_SENSOR +#error libdrm version is too old +#endif +#endif + struct bits_t bits; unsigned long long vramsize; unsigned long long gttsize; +unsigned long long mclk_max = 0; // kilohertz +unsigned long long sclk_max = 0; // kilohertz int drm_fd = -1; char drm_name[10] = ""; // should be radeon or amdgpu -unsigned int init_pci(unsigned char bus, const unsigned char forcemem) { - - int ret = pci_system_init(); - if (ret) - die(_("Failed to init pciaccess")); - +struct pci_device * findGPUDevice(const unsigned char bus) { + struct pci_device *dev; struct pci_id_match match; match.vendor_id = 0x1002; @@ -41,16 +46,12 @@ match.match_data = 0; struct pci_device_iterator *iter = pci_id_match_iterator_create(&match); - struct pci_device *dev = NULL; - char busid[32]; while ((dev = pci_device_next(iter))) { pci_device_probe(dev); if ((dev->device_class & 0x00ffff00) != 0x00030000 && (dev->device_class & 0x00ffff00) != 0x00038000) continue; - snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%u", - dev->domain, dev->bus, dev->dev, dev->func); if (!bus || bus == dev->bus) break; } @@ -60,12 +61,25 @@ if (!dev) die(_("Can't find Radeon cards")); - const unsigned int device_id = dev->device_id; + return dev; +} + +void init_pci(unsigned char *bus, unsigned int *device_id, const unsigned char forcemem) { + int ret = pci_system_init(); + if (ret) + die(_("Failed to init pciaccess")); + + const struct pci_device * const gpu_device = findGPUDevice(*bus); + + char busid[32]; + snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%u", + gpu_device->domain, gpu_device->bus, gpu_device->dev, gpu_device->func); + int reg = 2; - if (getfamily(device_id) >= BONAIRE) + if (getfamily(gpu_device->device_id) >= BONAIRE) reg = 5; - if (!dev->regions[reg].size) die(_("Can't get the register area size")); + if (!gpu_device->regions[reg].size) die(_("Can't get the register area size")); // printf("Found area %p, size %lu\n", area, dev->regions[reg].size); @@ -100,7 +114,7 @@ if (mem < 0) die(_("Cannot access GPU registers, are you root?")); area = mmap(NULL, MMAP_SIZE, PROT_READ, MAP_PRIVATE, mem, - dev->regions[reg].base_addr + 0x8000); + gpu_device->regions[reg].base_addr + 0x8000); if (area == MAP_FAILED) die(_("mmap failed")); } @@ -126,6 +140,25 @@ } drmFreeVersion(ver); + if (strcmp(drm_name, "amdgpu") == 0) { +#ifdef ENABLE_AMDGPU + struct drm_amdgpu_info_device device = {}; + + struct drm_amdgpu_info request = {}; + request.query = AMDGPU_INFO_DEV_INFO; + request.return_pointer = (unsigned long)&device; + request.return_size = sizeof(device); + ret = drmCommandWrite(drm_fd, DRM_AMDGPU_INFO, &request, sizeof(request)); + + if (ret == 0) { + mclk_max = device.max_memory_clock; + sclk_max = device.max_engine_clock; + } +#else + printf(_("amdgpu DRM driver is used, but clock reporting is not enabled\n")); +#endif + } + // No version indicator, so we need to test once // We use different codepaths for radeon and amdgpu // We store vram_size and check below if the ret value is sane @@ -189,9 +222,9 @@ out: + *bus = gpu_device->bus; + *device_id = gpu_device->device_id; pci_system_cleanup(); - - return device_id; } unsigned long long getvram() { @@ -249,6 +282,48 @@ return val; } + +#ifdef ENABLE_AMDGPU +static unsigned long long amdgpu_read_sensor(uint32_t sensor_id) { + int ret; + unsigned long long val = 0; + + struct drm_amdgpu_info info = {}; + info.query = AMDGPU_INFO_SENSOR; + info.sensor_info.type = sensor_id; + info.return_pointer = (unsigned long)&val; + info.return_size = sizeof(val); + ret = drmCommandWrite(drm_fd, DRM_AMDGPU_INFO, &info, sizeof(info)); + + if (ret) return 0; + + return val; +} +#endif + +unsigned long long getmclk() { + unsigned long long val = 0; + + if (strcmp(drm_name, "amdgpu") == 0) { +#ifdef ENABLE_AMDGPU + val = amdgpu_read_sensor(AMDGPU_INFO_SENSOR_GFX_MCLK); +#endif + } + + return val; +} + +unsigned long long getsclk() { + unsigned long long val = 0; + + if (strcmp(drm_name, "amdgpu") == 0) { +#ifdef ENABLE_AMDGPU + val = amdgpu_read_sensor(AMDGPU_INFO_SENSOR_GFX_SCLK); +#endif + } + + return val; +} int getfamily(unsigned int id) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/dump.c new/radeontop-1.2/dump.c --- old/radeontop-1.1/dump.c 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/dump.c 2019-06-03 09:59:56.000000000 +0200 @@ -1,5 +1,6 @@ /* Copyright (C) 2012 Lauri Kasanen + Copyright (C) 2018 Genesis Cloud Ltd. 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 @@ -28,7 +29,8 @@ } } -void dumpdata(const unsigned int ticks, const char file[], const unsigned int limit) { +void dumpdata(const unsigned int ticks, const char file[], const unsigned int limit, + const unsigned char bus, const unsigned int dumpinterval) { #ifdef ENABLE_NLS // This is a data format, so disable decimal point localization @@ -75,26 +77,33 @@ fprintf(f, "%llu.%llu: ", (unsigned long long) t.tv_sec, (unsigned long long) t.tv_usec); + fprintf(f, "bus %02x, ", bus); + // Again, no need to protect these. Worst that happens is a slightly // wrong number. - float ee = 100.0 * (float) results->ee / ticks; - float vgt = 100.0 * (float) results->vgt / ticks; - float gui = 100.0 * (float) results->gui / ticks; - float ta = 100.0 * (float) results->ta / ticks; - float tc = 100.0 * (float) results->tc / ticks; - float sx = 100.0 * (float) results->sx / ticks; - float sh = 100.0 * (float) results->sh / ticks; - float spi = 100.0 * (float) results->spi / ticks; - float smx = 100.0 * (float) results->smx / ticks; - float sc = 100.0 * (float) results->sc / ticks; - float pa = 100.0 * (float) results->pa / ticks; - float db = 100.0 * (float) results->db / ticks; - float cr = 100.0 * (float) results->cr / ticks; - float cb = 100.0 * (float) results->cb / ticks; - float vram = 100.0 * (float) results->vram / vramsize; + float k = 1.0f / ticks / dumpinterval; + float ee = 100 * results->ee * k; + float vgt = 100 * results->vgt * k; + float gui = 100 * results->gui * k; + float ta = 100 * results->ta * k; + float tc = 100 * results->tc * k; + float sx = 100 * results->sx * k; + float sh = 100 * results->sh * k; + float spi = 100 * results->spi * k; + float smx = 100 * results->smx * k; + float sc = 100 * results->sc * k; + float pa = 100 * results->pa * k; + float db = 100 * results->db * k; + float cr = 100 * results->cr * k; + float cb = 100 * results->cb * k; + float vram = 100.0f * results->vram / vramsize; float vrammb = results->vram / 1024.0f / 1024.0f; - float gtt = 100.0 * (float) results->gtt / gttsize; + float gtt = 100.0f * results->gtt / gttsize; float gttmb = results->gtt / 1024.0f / 1024.0f; + float mclk = 100.0f * (results->mclk * k) / (mclk_max / 1e3f); + float sclk = 100.0f * (results->sclk * k) / (sclk_max / 1e3f); + float mclk_ghz = results->mclk * k / 1000.0f; + float sclk_ghz = results->sclk * k / 1000.0f; fprintf(f, "gpu %.2f%%, ", gui); fprintf(f, "ee %.2f%%, ", ee); @@ -120,22 +129,25 @@ fprintf(f, "cb %.2f%%", cb); if (bits.vram) - fprintf(f, ", vram %.2f%% %.2fmb\n", vram, vrammb); - else - fprintf(f, "\n"); + fprintf(f, ", vram %.2f%% %.2fmb", vram, vrammb); if (bits.gtt) - fprintf(f, ", gtt %.2f%% %.2fmb\n", gtt, gttmb); - else - fprintf(f, "\n"); + fprintf(f, ", gtt %.2f%% %.2fmb", gtt, gttmb); + + if (mclk_max != 0 && mclk > 0) + fprintf(f, ", mclk %.2f%% %.3fghz, sclk %.2f%% %.3fghz", + mclk, mclk_ghz, sclk, sclk_ghz); + fprintf(f, "\n"); fflush(f); // Did we get a termination signal? if (quit) break; - sleep(1); + // No sleeping on the last line. + if (!limit || count > 1) + sleep(dumpinterval); } fflush(f); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/family_str.c new/radeontop-1.2/family_str.c --- old/radeontop-1.1/family_str.c 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/family_str.c 2019-06-03 09:59:56.000000000 +0200 @@ -63,6 +63,9 @@ str(POLARIS11), str(POLARIS10), str(POLARIS12), + str(VEGAM), str(VEGA10), + str(VEGA12), + str(VEGA20), str(RAVEN), }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/getver.sh new/radeontop-1.2/getver.sh --- old/radeontop-1.1/getver.sh 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/getver.sh 2019-06-03 09:59:56.000000000 +0200 @@ -2,7 +2,9 @@ ver=unknown -[ -n "`which git`" ] && ver=`git describe` +if [ -n "`which git`" ] && git rev-parse HEAD 2>/dev/null; then + ver=`git describe` +fi cat > include/version.h << EOF #ifndef VER_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/include/r600_pci_ids.h new/radeontop-1.2/include/r600_pci_ids.h --- old/radeontop-1.1/include/r600_pci_ids.h 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/include/r600_pci_ids.h 2019-06-03 09:59:56.000000000 +0200 @@ -529,6 +529,7 @@ CHIPSET(0x67CA, 0x67CA, POLARIS10) CHIPSET(0x67CC, 0x67CC, POLARIS10) CHIPSET(0x67CF, 0x67CF, POLARIS10) +CHIPSET(0x6FDF, 0x6FDF, POLARIS10) CHIPSET(0x6980, 0x6980, POLARIS12) CHIPSET(0x6981, 0x6981, POLARIS12) CHIPSET(0x6985, 0x6985, POLARIS12) @@ -537,6 +538,9 @@ CHIPSET(0x6995, 0x6995, POLARIS12) CHIPSET(0x6997, 0x6997, POLARIS12) CHIPSET(0x699F, 0x699F, POLARIS12) +CHIPSET(0x694C, 0x694C, VEGAM) +CHIPSET(0x694E, 0x694E, VEGAM) +CHIPSET(0x694F, 0x694F, VEGAM) CHIPSET(0x6860, 0x6860, VEGA10) CHIPSET(0x6861, 0x6861, VEGA10) CHIPSET(0x6862, 0x6862, VEGA10) @@ -544,6 +548,25 @@ CHIPSET(0x6864, 0x6864, VEGA10) CHIPSET(0x6867, 0x6867, VEGA10) CHIPSET(0x6868, 0x6868, VEGA10) +CHIPSET(0x6869, 0x6869, VEGA10) +CHIPSET(0x686a, 0x686a, VEGA10) +CHIPSET(0x686b, 0x686b, VEGA10) CHIPSET(0x686c, 0x686c, VEGA10) +CHIPSET(0x686d, 0x686d, VEGA10) +CHIPSET(0x686e, 0x686e, VEGA10) +CHIPSET(0x686f, 0x686f, VEGA10) CHIPSET(0x687f, 0x687f, VEGA10) +CHIPSET(0x69A0, 0x69A0, VEGA12) +CHIPSET(0x69A1, 0x69A1, VEGA12) +CHIPSET(0x69A2, 0x69A2, VEGA12) +CHIPSET(0x69A3, 0x69A3, VEGA12) +CHIPSET(0x69AF, 0x69AF, VEGA12) +CHIPSET(0x66A0, 0x66A0, VEGA20) +CHIPSET(0x66A1, 0x66A1, VEGA20) +CHIPSET(0x66A2, 0x66A2, VEGA20) +CHIPSET(0x66A3, 0x66A3, VEGA20) +CHIPSET(0x66A4, 0x66A4, VEGA20) +CHIPSET(0x66A7, 0x66A7, VEGA20) +CHIPSET(0x66AF, 0x66AF, VEGA20) CHIPSET(0x15dd, 0x15dd, RAVEN) +CHIPSET(0x15d8, 0x15d8, RAVEN) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/include/radeontop.h new/radeontop-1.2/include/radeontop.h --- old/radeontop-1.1/include/radeontop.h 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/include/radeontop.h 2019-06-03 09:59:56.000000000 +0200 @@ -1,5 +1,6 @@ /* Copyright (C) 2012 Lauri Kasanen + Copyright (C) 2018 Genesis Cloud Ltd. 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 @@ -17,7 +18,9 @@ #ifndef RADEONTOP_H #define RADEONTOP_H +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include "version.h" #include "gettext.h" @@ -63,22 +66,24 @@ extern int use_ioctl; // detect.c -unsigned int init_pci(unsigned char bus, const unsigned char forcemem); +void init_pci(unsigned char *bus, unsigned int *device_id, const unsigned char forcemem); int getfamily(unsigned int id); void initbits(int fam); unsigned long long getvram(); unsigned long long getgtt(); +unsigned long long getmclk(); +unsigned long long getsclk(); // ticks.c -void collect(unsigned int *ticks); +void collect(unsigned int ticks, unsigned int dumpinterval); extern struct bits_t *results; // ui.c -void present(const unsigned int ticks, const char card[], unsigned int color); +void present(const unsigned int ticks, const char card[], unsigned int color, const unsigned char bus, const unsigned int dumpinterval); // dump.c -void dumpdata(const unsigned int ticks, const char file[], const unsigned int limit); +void dumpdata(const unsigned int ticks, const char file[], const unsigned int limit, const unsigned char bus, const unsigned int dumpinterval); // chips enum radeon_family { @@ -126,7 +131,10 @@ POLARIS11, POLARIS10, POLARIS12, + VEGAM, VEGA10, + VEGA12, + VEGA20, RAVEN, }; @@ -150,11 +158,15 @@ unsigned int cr; unsigned long long vram; unsigned long long gtt; + unsigned long long mclk; + unsigned long long sclk; }; extern struct bits_t bits; extern unsigned long long vramsize; extern unsigned long long gttsize; +extern unsigned long long mclk_max; +extern unsigned long long sclk_max; extern int drm_fd; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/radeontop.1 new/radeontop-1.2/radeontop.1 --- old/radeontop-1.1/radeontop.1 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/radeontop.1 2019-06-03 09:59:56.000000000 +0200 @@ -2,12 +2,12 @@ .\" Title: radeontop .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 11/11/2015 +.\" Date: 07/13/2018 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "RADEONTOP" "1" "11/11/2015" "\ \&" "\ \&" +.TH "RADEONTOP" "1" "07/13/2018" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ radeontop \- tool to show GPU utilization .SH "SYNOPSIS" .sp -\fBradeontop [\-chv] [\-b \fR\fB\fIbus\fR\fR\fB] [\-d \fR\fB\fIfile\fR\fR\fB] [\-l \fR\fB\fIlimit\fR\fR\fB] [\-t \fR\fB\fIticks\fR\fR\fB]\fR +\fBradeontop [\-chv] [\-b \fR\fB\fIbus\fR\fR\fB] [\-d \fR\fB\fIfile\fR\fR\fB] [\-l \fR\fB\fIlimit\fR\fR\fB] [\-i \fR\fB\fIsecs\fR\fR\fB] [\-t \fR\fB\fIticks\fR\fR\fB]\fR .SH "DESCRIPTION" .sp RadeonTop shows the utilization of your GPU, both in general and by blocks\&. @@ -70,6 +70,11 @@ Displays help\&. .RE .PP +\fB\-i, \-\-dump\-interval \fR\fB\fIseconds\fR\fR +.RS 4 +Wait for N seconds between data output\&. +.RE +.PP \fB\-l, \-\-limit \fR\fB\fIlimit\fR\fR .RS 4 Quit after dumping diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/radeontop.asc new/radeontop-1.2/radeontop.asc --- old/radeontop-1.1/radeontop.asc 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/radeontop.asc 2019-06-03 09:59:56.000000000 +0200 @@ -8,7 +8,7 @@ SYNOPSIS -------- -*radeontop [-chv] [-b 'bus'] [-d 'file'] [-l 'limit'] [-t 'ticks']* +*radeontop [-chv] [-b 'bus'] [-d 'file'] [-l 'limit'] [-i 'secs'] [-t 'ticks']* DESCRIPTION ----------- @@ -34,6 +34,9 @@ *-h, --help*:: Displays help. +*-i, --dump-interval 'seconds'*:: + Wait for N seconds between data output. + *-l, --limit 'limit'*:: Quit after dumping 'limit' lines. Only valid in dump mode. Default is to dump until terminated; use 'SIGTERM' or 'SIGINT' for graceful termination. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/radeontop.c new/radeontop-1.2/radeontop.c --- old/radeontop-1.1/radeontop.c 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/radeontop.c 2019-06-03 09:59:56.000000000 +0200 @@ -1,5 +1,6 @@ /* Copyright (C) 2012 Lauri Kasanen + Copyright (C) 2018 Genesis Cloud Ltd. 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 @@ -30,19 +31,20 @@ exit(1); } -static void help(const char * const me, const unsigned int ticks) { +static void help(const char * const me, const unsigned int ticks, const unsigned int dumpinterval) { printf(_("\n\tRadeonTop for R600 and above.\n\n" - "\tUsage: %s [-ch] [-b bus] [-d file] [-l limit] [-t ticks]\n\n" - "-b --bus 3 Pick card from this PCI bus\n" + "\tUsage: %s [-ch] [-b bus] [-d file] [-i seconds] [-l limit] [-t ticks]\n\n" + "-b --bus 3 Pick card from this PCI bus (hexadecimal)\n" "-c --color Enable colors\n" "-d --dump file Dump data to this file, - for stdout\n" + "-i --dump-interval 1 Number of seconds between dumps (default %u)\n" "-l --limit 3 Quit after dumping N lines, default forever\n" "-m --mem Force the /dev/mem path, for the proprietary driver\n" "-t --ticks 50 Samples per second (default %u)\n" "\n" "-h --help Show this help\n" "-v --version Show the version\n"), - me, ticks); + me, dumpinterval, ticks); die(""); } @@ -76,11 +78,16 @@ // Temporarily drop privileges to do option parsing, etc. seteuid(getuid()); - unsigned int ticks = 120; + const unsigned int default_ticks = 120; + const unsigned int default_dumpinterval = 1; + + unsigned int ticks = default_ticks; unsigned char color = 0; unsigned char bus = 0, forcemem = 0; + unsigned int device_id = 0; unsigned int limit = 0; char *dump = NULL; + unsigned int dumpinterval = default_dumpinterval; // Translations #ifdef ENABLE_NLS @@ -94,6 +101,7 @@ {"bus", 1, 0, 'b'}, {"color", 0, 0, 'c'}, {"dump", 1, 0, 'd'}, + {"dump-interval", 1, 0, 'i'}, {"help", 0, 0, 'h'}, {"limit", 1, 0, 'l'}, {"mem", 0, 0, 'm'}, @@ -103,13 +111,13 @@ }; while (1) { - int c = getopt_long(argc, argv, "b:cd:hl:mt:v", opts, NULL); + int c = getopt_long(argc, argv, "b:cd:hi:l:mt:v", opts, NULL); if (c == -1) break; switch(c) { case 'h': case '?': - help(argv[0], ticks); + help(argv[0], default_ticks, default_dumpinterval); break; case 't': ticks = atoi(optarg); @@ -121,7 +129,7 @@ forcemem = 1; break; case 'b': - bus = atoi(optarg); + bus = strtoul(optarg, NULL, 16); break; case 'v': version(); @@ -132,15 +140,22 @@ case 'd': dump = optarg; break; + case 'i': + dumpinterval = atoi(optarg); + if (dumpinterval < 1) + dumpinterval = 1; + break; } } // init (regain privileges for bus initialization and ultimately drop them afterwards) seteuid(0); - const unsigned int pciaddr = init_pci(bus, forcemem); + init_pci(&bus, &device_id, forcemem); + // after init_pci we can assume that bus/device_id exists (otherwise it would die()) + setuid(getuid()); - const int family = getfamily(pciaddr); + const int family = getfamily(device_id); if (!family) puts(_("Unknown Radeon card. <= R500 won't work, new cards might.")); @@ -149,12 +164,12 @@ initbits(family); // runtime - collect(&ticks); + collect(ticks, dumpinterval); if (dump) - dumpdata(ticks, dump, limit); + dumpdata(ticks, dump, limit, bus, dumpinterval); else - present(ticks, cardname, color); + present(ticks, cardname, color, bus, dumpinterval); munmap((void *) area, MMAP_SIZE); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/ticks.c new/radeontop-1.2/ticks.c --- old/radeontop-1.1/ticks.c 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/ticks.c 2019-06-03 09:59:56.000000000 +0200 @@ -19,14 +19,21 @@ struct bits_t *results = NULL; +struct collector_args_t { + unsigned int ticks; + unsigned int dumpinterval; +}; + static void *collector(void *arg) { + struct collector_args_t *args = (struct collector_args_t *) arg; - const unsigned int ticks = * ((unsigned int *) arg); + const unsigned int ticks = args->ticks; + const unsigned int dumpinterval = args->dumpinterval; struct bits_t res[2]; // Save one second's worth of history - struct bits_t *history = calloc(ticks, sizeof(struct bits_t)); + struct bits_t *history = calloc(ticks * dumpinterval, sizeof(struct bits_t)); unsigned int cur = 0, curres = 0; const useconds_t sleeptime = 1e6 / ticks; @@ -50,11 +57,12 @@ if (stat & bits.db) history[cur].db = 1; if (stat & bits.cr) history[cur].cr = 1; if (stat & bits.cb) history[cur].cb = 1; - + history[cur].mclk = getmclk(); + history[cur].sclk = getsclk(); usleep(sleeptime); cur++; - cur %= ticks; + cur %= ticks * dumpinterval; // One second has passed, we have one sec's worth of data if (cur == 0) { @@ -62,7 +70,7 @@ memset(&res[curres], 0, sizeof(struct bits_t)); - for (i = 0; i < ticks; i++) { + for (i = 0; i < ticks * dumpinterval; i++) { res[curres].ee += history[i].ee; res[curres].vgt += history[i].vgt; res[curres].gui += history[i].gui; @@ -77,6 +85,8 @@ res[curres].db += history[i].db; res[curres].cb += history[i].cb; res[curres].cr += history[i].cr; + res[curres].mclk += history[i].mclk; + res[curres].sclk += history[i].sclk; } res[curres].vram = getvram(); @@ -93,7 +103,7 @@ return NULL; } -void collect(unsigned int *ticks) { +void collect(unsigned int ticks, unsigned int dumpinterval) { // Start a thread collecting data pthread_t tid; @@ -103,5 +113,9 @@ pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&tid, &attr, collector, ticks); + struct collector_args_t *args = malloc(sizeof(*args)); + args->ticks = ticks; + args->dumpinterval = dumpinterval; + + pthread_create(&tid, &attr, collector, args); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/translations/radeontop.pot new/radeontop-1.2/translations/radeontop.pot --- old/radeontop-1.1/translations/radeontop.pot 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/translations/radeontop.pot 2019-06-03 09:59:56.000000000 +0200 @@ -1,6 +1,6 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# This file is distributed under the same license as the radeontop package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy @@ -8,175 +8,226 @@ msgstr "" "Project-Id-Version: radeontop\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-23 15:04+0300\n" +"POT-Creation-Date: 2018-07-19 17:40+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <[email protected]>\n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: detect.c:85 +#: detect.c:39 msgid "Failed to init pciaccess" msgstr "" -#: detect.c:112 +#: detect.c:69 msgid "Can't find Radeon cards" msgstr "" -#: detect.c:114 +#: detect.c:76 msgid "Can't get the register area size" msgstr "" -#: detect.c:119 -msgid "Can't open /dev/mem, are you root?" +#: detect.c:102 +#, c-format +msgid "Forcing the /dev/mem path.\n" msgstr "" -#: detect.c:123 +#: detect.c:108 +msgid "Cannot access GPU registers, are you root?" +msgstr "" + +#: detect.c:112 msgid "mmap failed" msgstr "" -#: detect.c:133 +#: detect.c:118 #, c-format msgid "Failed to open DRM node, no VRAM support.\n" msgstr "" -#: detect.c:145 +#: detect.c:131 #, c-format msgid "Kernel too old for VRAM reporting.\n" msgstr "" -#: detect.c:156 +#: detect.c:152 +#, c-format +msgid "amdgpu DRM driver is used, but clock reporting is not enabled\n" +msgstr "" + +#: detect.c:181 +#, c-format +msgid "" +"amdgpu DRM driver is used, but amdgpu VRAM size reporting is not enabled\n" +msgstr "" + +#: detect.c:185 #, c-format msgid "Failed to get VRAM size, error %d\n" msgstr "" -#: detect.c:164 +#: detect.c:194 +#, c-format +msgid "" +"amdgpu DRM driver is used, but amdgpu VRAM usage reporting is not enabled\n" +msgstr "" + +#: detect.c:197 #, c-format msgid "Failed to get VRAM usage, kernel likely too old\n" msgstr "" -#: dump.c:46 +#: detect.c:207 +#, c-format +msgid "" +"amdgpu DRM driver is used, but amdgpu GTT usage reporting is not enabled\n" +msgstr "" + +#: detect.c:210 +#, c-format +msgid "Failed to get GTT usage, kernel likely too old\n" +msgstr "" + +#: dump.c:48 #, c-format msgid "Dumping to %s, " msgstr "" -#: dump.c:49 +#: dump.c:51 #, c-format msgid "line limit %u.\n" msgstr "" -#: dump.c:51 +#: dump.c:53 msgid "until termination." msgstr "" -#: dump.c:61 +#: dump.c:63 msgid "Can't open file for writing." msgstr "" -#: radeontop.c:33 +#: radeontop.c:35 #, c-format msgid "" "\n" "\tRadeonTop for R600 and above.\n" "\n" -"\tUsage: %s [-ch] [-b bus] [-d file] [-l limit] [-t ticks]\n" +"\tUsage: %s [-ch] [-b bus] [-d file] [-i seconds] [-l limit] [-t ticks]\n" "\n" -"-b --bus 3\t\tPick card from this PCI bus\n" +"-b --bus 3\t\tPick card from this PCI bus (hexadecimal)\n" "-c --color\t\tEnable colors\n" "-d --dump file\t\tDump data to this file, - for stdout\n" +"-i --dump-interval 1\tNumber of seconds between dumps (default %u)\n" "-l --limit 3\t\tQuit after dumping N lines, default forever\n" +"-m --mem\t\tForce the /dev/mem path, for the proprietary driver\n" "-t --ticks 50\t\tSamples per second (default %u)\n" "\n" "-h --help\t\tShow this help\n" "-v --version\t\tShow the version\n" msgstr "" -#: radeontop.c:118 +#: radeontop.c:159 msgid "Unknown Radeon card. <= R500 won't work, new cards might." msgstr "" -#: ui.c:81 +#: ui.c:82 #, c-format msgid "Collecting data, please wait....\n" msgstr "" -#: ui.c:111 +#: ui.c:118 #, c-format -msgid "radeontop %s, running on %s, %u samples/sec" +msgid "radeontop %s, running on %s bus %02x, %u samples/sec" msgstr "" -#: ui.c:145 +#: ui.c:159 #, c-format msgid "Graphics pipe %6.2f%%" msgstr "" -#: ui.c:151 +#: ui.c:165 #, c-format msgid "Event Engine %6.2f%%" msgstr "" -#: ui.c:158 +#: ui.c:172 #, c-format msgid "Vertex Grouper + Tesselator %6.2f%%" msgstr "" -#: ui.c:166 +#: ui.c:180 #, c-format msgid "Texture Addresser %6.2f%%" msgstr "" -#: ui.c:171 +#: ui.c:185 #, c-format msgid "Texture Cache %6.2f%%" msgstr "" -#: ui.c:180 +#: ui.c:194 #, c-format msgid "Shader Export %6.2f%%" msgstr "" -#: ui.c:183 +#: ui.c:197 #, c-format msgid "Sequencer Instruction Cache %6.2f%%" msgstr "" -#: ui.c:186 +#: ui.c:200 #, c-format msgid "Shader Interpolator %6.2f%%" msgstr "" -#: ui.c:191 +#: ui.c:205 #, c-format msgid "Shader Memory Exchange %6.2f%%" msgstr "" -#: ui.c:199 +#: ui.c:213 #, c-format msgid "Scan Converter %6.2f%%" msgstr "" -#: ui.c:202 +#: ui.c:216 #, c-format msgid "Primitive Assembly %6.2f%%" msgstr "" -#: ui.c:209 +#: ui.c:223 #, c-format msgid "Depth Block %6.2f%%" msgstr "" -#: ui.c:212 +#: ui.c:226 #, c-format msgid "Color Block %6.2f%%" msgstr "" -#: ui.c:217 +#: ui.c:231 #, c-format msgid "Clip Rectangle %6.2f%%" msgstr "" -#: ui.c:227 +#: ui.c:242 #, c-format msgid "%.0fM / %.0fM VRAM %6.2f%%" msgstr "" + +#: ui.c:250 +#, c-format +msgid "%.0fM / %.0fM GTT %6.2f%%" +msgstr "" + +#: ui.c:262 +#, c-format +msgid "%.2fG / %.2fG Memory Clock %6.2f%%" +msgstr "" + +#: ui.c:265 +#, c-format +msgid "%.2fG / %.2fG Shader Clock %6.2f%%" +msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/radeontop-1.1/ui.c new/radeontop-1.2/ui.c --- old/radeontop-1.1/ui.c 2018-03-25 10:28:22.000000000 +0200 +++ new/radeontop-1.2/ui.c 2019-06-03 09:59:56.000000000 +0200 @@ -76,7 +76,8 @@ attroff(A_REVERSE); } -void present(const unsigned int ticks, const char card[], unsigned int color) { +void present(const unsigned int ticks, const char card[], unsigned int color, + const unsigned char bus, const unsigned int dumpinterval) { printf(_("Collecting data, please wait....\n")); @@ -114,8 +115,8 @@ move(0,0); attron(A_REVERSE); mvhline(0, 0, ' ', w); - printcenter(0, w, _("radeontop %s, running on %s, %u samples/sec"), - VERSION, card, ticks); + printcenter(0, w, _("radeontop %s, running on %s bus %02x, %u samples/sec"), + VERSION, card, bus, ticks); attroff(A_REVERSE); move(1,0); @@ -123,26 +124,31 @@ // Again, no need to protect these. Worst that happens is a slightly // wrong number. - float ee = 100.0 * (float) results->ee / ticks; - float vgt = 100.0 * (float) results->vgt / ticks; - float gui = 100.0 * (float) results->gui / ticks; - float ta = 100.0 * (float) results->ta / ticks; - float tc = 100.0 * (float) results->tc / ticks; - float sx = 100.0 * (float) results->sx / ticks; - float sh = 100.0 * (float) results->sh / ticks; - float spi = 100.0 * (float) results->spi / ticks; - float smx = 100.0 * (float) results->smx / ticks; - float sc = 100.0 * (float) results->sc / ticks; - float pa = 100.0 * (float) results->pa / ticks; - float db = 100.0 * (float) results->db / ticks; - float cr = 100.0 * (float) results->cr / ticks; - float cb = 100.0 * (float) results->cb / ticks; - float vram = 100.0 * (float) results->vram / vramsize; + float k = 1.0f / ticks / dumpinterval; + float ee = 100 * results->ee * k; + float vgt = 100 * results->vgt * k; + float gui = 100 * results->gui * k; + float ta = 100 * results->ta * k; + float tc = 100 * results->tc * k; + float sx = 100 * results->sx * k; + float sh = 100 * results->sh * k; + float spi = 100 * results->spi * k; + float smx = 100 * results->smx * k; + float sc = 100 * results->sc * k; + float pa = 100 * results->pa * k; + float db = 100 * results->db * k; + float cr = 100 * results->cr * k; + float cb = 100 * results->cb * k; + float vram = 100.0f * results->vram / vramsize; float vrammb = results->vram / 1024.0f / 1024.0f; float vramsizemb = vramsize / 1024.0f / 1024.0f; - float gtt = 100.0 * (float) results->gtt / gttsize; + float gtt = 100.0f * results->gtt / gttsize; float gttmb = results->gtt / 1024.0f / 1024.0f; float gttsizemb = gttsize / 1024.0f / 1024.0f; + float mclk = 100.0f * (results->mclk * k) / (mclk_max / 1e3f); + float sclk = 100.0f * (results->sclk * k) / (sclk_max / 1e3f); + float mclk_ghz = results->mclk * k / 1000.0f; + float sclk_ghz = results->sclk * k / 1000.0f; mvhline(3, 0, ACS_HLINE, w); mvvline(1, (w/2) + 1, ACS_VLINE, h); @@ -226,23 +232,36 @@ } if (color) attroff(COLOR_PAIR(5)); - // Enough height? - if (h > bigh) start++; - - if (bits.vram) { - if (color) attron(COLOR_PAIR(2)); - percentage(start, w, vram); - printright(start++, hw, _("%.0fM / %.0fM VRAM %6.2f%%"), - vrammb, vramsizemb, vram); - if (color) attroff(COLOR_PAIR(2)); - } - - if (bits.gtt) { - if (color) attron(COLOR_PAIR(2)); - percentage(start, w, gtt); - printright(start++, hw, _("%.0fM / %.0fM GTT %6.2f%%"), - gttmb, gttsizemb, gtt); - if (color) attroff(COLOR_PAIR(2)); + if (bits.vram || bits.gtt) { + // Enough height? + if (h > bigh) start++; + + if (bits.vram) { + if (color) attron(COLOR_PAIR(2)); + percentage(start, w, vram); + printright(start++, hw, _("%.0fM / %.0fM VRAM %6.2f%%"), + vrammb, vramsizemb, vram); + if (color) attroff(COLOR_PAIR(2)); + } + + if (bits.gtt) { + if (color) attron(COLOR_PAIR(2)); + percentage(start, w, gtt); + printright(start++, hw, _("%.0fM / %.0fM GTT %6.2f%%"), + gttmb, gttsizemb, gtt); + if (color) attroff(COLOR_PAIR(2)); + } + } + + if (mclk_max != 0 && mclk > 0) { + if (color) attron(COLOR_PAIR(3)); + percentage(start, w, mclk); + printright(start++, hw, _("%.2fG / %.2fG Memory Clock %6.2f%%"), + mclk_ghz, mclk_max * 1e-6f, mclk); + percentage(start, w, sclk); + printright(start++, hw, _("%.2fG / %.2fG Shader Clock %6.2f%%"), + sclk_ghz, sclk_max * 1e-6f, sclk); + if (color) attroff(COLOR_PAIR(3)); } //move the cursor away to fix some resizing artifacts on some terminals ++++++ radeontop-rpmlintrc ++++++ addFilter("shlib-policy-name-error *")
