pax_global_header00006660000000000000000000000064134751515740014526gustar00rootroot0000000000000052 comment=448a872d92e8387fbe0e9434fa8f8e0f81ba8c26 radeontop-1.2/000077500000000000000000000000001347515157400133635ustar00rootroot00000000000000radeontop-1.2/.gitignore000066400000000000000000000000611347515157400153500ustar00rootroot00000000000000*.o libradeontop_xcb.so radeontop version.h *.mo radeontop-1.2/COPYING000066400000000000000000001045141347515157400144230ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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. Copyright (C) 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 . 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: Copyright (C) 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 . 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 . radeontop-1.2/Makefile000066400000000000000000000057131347515157400150310ustar00rootroot00000000000000# The make-provided flags like MAKE and CC aren't set, on purpose. # This is Linux-specific software, so we can depend on GNU make. # Options: # nls enable translations, default on # debug enable debug symbols, default off # nostrip disable stripping, default off # 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.77 PREFIX ?= /usr INSTALL ?= install LIBDIR ?= lib MANDIR ?= share/man nls ?= 1 xcb ?= 1 amdgpu ?= 0 bin = radeontop xcblib = libradeontop_xcb.so src = $(filter-out auth_xcb.c,$(wildcard *.c)) obj = $(src:.c=.o) verh = include/version.h CFLAGS_SECTIONED = -ffunction-sections -fdata-sections LDFLAGS_SECTIONED = -Wl,-gc-sections CFLAGS ?= -Os CFLAGS += -Wall -Wextra -pthread CFLAGS += -Iinclude CFLAGS += $(CFLAGS_SECTIONED) CFLAGS += $(shell pkg-config --cflags pciaccess) CFLAGS += $(shell pkg-config --cflags libdrm) ifeq ($(xcb), 1) CFLAGS += $(shell pkg-config --cflags xcb xcb-dri2) CFLAGS += -DENABLE_XCB=1 endif CFLAGS += $(shell pkg-config --cflags ncurses 2>/dev/null) # Comment this if you don't want translations ifeq ($(nls), 1) CFLAGS += -DENABLE_NLS=1 endif ifeq ($(amdgpu), 1) CFLAGS += -DENABLE_AMDGPU=1 endif ifndef plain ifdef debug CFLAGS += -g else ifndef nostrip CFLAGS += -s endif endif LDFLAGS ?= -Wl,-O1 LDFLAGS += $(LDFLAGS_SECTIONED) LIBS += $(shell pkg-config --libs pciaccess) LIBS += $(shell pkg-config --libs libdrm) ifeq ($(xcb), 1) xcb_LIBS += $(shell pkg-config --libs xcb xcb-dri2) LIBS += -ldl endif # On some distros, you might have to change this to ncursesw LIBS += $(shell pkg-config --libs ncursesw 2>/dev/null || \ shell pkg-config --libs ncurses 2>/dev/null || \ echo "-lncurses") .PHONY: all clean install man dist all: $(bin) ifeq ($(xcb), 1) all: $(xcblib) $(xcblib): auth_xcb.c $(wildcard include/*.h) $(verh) $(CC) -shared -fPIC -Wl,-soname,$@ -o $@ $< $(CFLAGS) $(LDFLAGS) $(xcb_LIBS) endif $(obj): $(wildcard include/*.h) $(verh) $(bin): $(obj) $(CC) -o $(bin) $(obj) $(CFLAGS) $(LDFLAGS) $(LIBS) clean: rm -f *.o $(bin) $(xcblib) .git: $(verh): .git ./getver.sh trans: xgettext -o translations/radeontop.pot -k_ *.c \ --package-name radeontop install: all $(INSTALL) -D -m755 $(bin) $(DESTDIR)/$(PREFIX)/sbin/$(bin) ifeq ($(xcb), 1) $(INSTALL) -D -m755 $(xcblib) $(DESTDIR)/$(PREFIX)/$(LIBDIR)/$(xcblib) endif $(INSTALL) -D -m644 radeontop.1 $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1/radeontop.1 ifeq ($(nls), 1) $(MAKE) -C translations install PREFIX=$(PREFIX) endif man: a2x -f manpage radeontop.asc dist: ver = $(shell git describe) dist: name = $(bin)-$(ver) dist: clean $(verh) sed -i '/\t\.\/getver.sh/d' Makefile cd .. && \ ln -s $(bin) $(name) && \ tar -h --numeric-owner --exclude-vcs -cvf - $(name) | pigz -9 > /tmp/$(name).tgz && \ rm $(name) advdef -z4 /tmp/$(name).tgz git checkout Makefile cd /tmp && sha1sum $(name).tgz > $(name).tgz.sha1 radeontop-1.2/README.md000066400000000000000000000034601347515157400146450ustar00rootroot00000000000000RadeonTop ========= View your GPU utilization, both for the total activity percent and individual blocks. Requires access to /dev/dri/cardN files or /dev/mem (root privileges). Supported cards --------------- R600 and up, even Southern Islands should work fine. Works with both the open drivers and AMD Catalyst. For the amdgpu driver, only the mem path is currently supported - for those cards, this means radeontop won't run on the default Ubuntu kernels that block /dev/mem. The total GPU utilization is also valid for OpenCL loads; the other blocks are only useful in GL loads. Translations ------------ 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. radeontop-1.2/auth.c000066400000000000000000000026011347515157400144670ustar00rootroot00000000000000/* Copyright (C) 2016 Peter Wu 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, version 3 of the License. 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 . */ #include "radeontop.h" #ifdef ENABLE_XCB #include #endif #ifdef ENABLE_XCB typedef void (*auth_magic_func)(drm_magic_t magic); static void call_authenticate_drm_xcb(drm_magic_t magic) { void *handle = dlopen("libradeontop_xcb.so", RTLD_NOW); if (!handle) { return; } auth_magic_func func = (auth_magic_func) dlsym(handle, "authenticate_drm_xcb"); if (func) { func(magic); } dlclose(handle); } #endif void authenticate_drm(int fd) { drm_magic_t magic; /* Obtain magic for our DRM client. */ if (drmGetMagic(fd, &magic) < 0) { return; } /* Try self-authenticate (if we are somehow the master). */ if (drmAuthMagic(fd, magic) == 0) { return; } #ifdef ENABLE_XCB call_authenticate_drm_xcb(magic); #endif } radeontop-1.2/auth_xcb.c000066400000000000000000000026141347515157400153270ustar00rootroot00000000000000/* Copyright (C) 2016 Peter Wu 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, version 3 of the License. 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 . */ #include "radeontop.h" #include #include /* Try to authenticate the DRM client with help from the X server. */ void authenticate_drm_xcb(drm_magic_t magic) { xcb_connection_t *conn = xcb_connect(NULL, NULL); if (!conn) { return; } if (xcb_connection_has_error(conn)) { xcb_disconnect(conn); return; } xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data; xcb_window_t window = screen->root; /* Authenticate our client via the X server using the magic. */ xcb_dri2_authenticate_cookie_t auth_cookie = xcb_dri2_authenticate(conn, window, magic); xcb_dri2_authenticate_reply_t *auth_reply = xcb_dri2_authenticate_reply(conn, auth_cookie, NULL); free(auth_reply); xcb_disconnect(conn); } radeontop-1.2/detect.c000066400000000000000000000221761347515157400150070ustar00rootroot00000000000000/* 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 the Free Software Foundation, version 3 of the License. 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 . */ #include "radeontop.h" #include #include #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 struct pci_device * findGPUDevice(const unsigned char bus) { struct pci_device *dev; struct pci_id_match match; match.vendor_id = 0x1002; match.device_id = PCI_MATCH_ANY; match.subvendor_id = PCI_MATCH_ANY; match.subdevice_id = PCI_MATCH_ANY; match.device_class = 0; match.device_class_mask = 0; match.match_data = 0; struct pci_device_iterator *iter = pci_id_match_iterator_create(&match); while ((dev = pci_device_next(iter))) { pci_device_probe(dev); if ((dev->device_class & 0x00ffff00) != 0x00030000 && (dev->device_class & 0x00ffff00) != 0x00038000) continue; if (!bus || bus == dev->bus) break; } pci_iterator_destroy(iter); if (!dev) die(_("Can't find Radeon cards")); 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(gpu_device->device_id) >= BONAIRE) reg = 5; 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); // DRM support for VRAM drm_fd = drmOpen(NULL, busid); if (drm_fd >= 0) { drmVersionPtr ver = drmGetVersion(drm_fd); if (strcmp(ver->name, "radeon") != 0 && strcmp(ver->name, "amdgpu") != 0) { close(drm_fd); drm_fd = -1; } strcpy(drm_name, ver->name); drmFreeVersion(ver); } if (drm_fd < 0 && access("/dev/ati/card0", F_OK) == 0) // fglrx path drm_fd = open("/dev/ati/card0", O_RDWR); use_ioctl = 0; if (drm_fd >= 0) { authenticate_drm(drm_fd); uint32_t rreg = 0x8010; use_ioctl = get_drm_value(drm_fd, RADEON_INFO_READ_REG, &rreg); } if (forcemem) { printf(_("Forcing the /dev/mem path.\n")); use_ioctl = 0; } if (!use_ioctl) { int mem = open("/dev/mem", O_RDONLY); if (mem < 0) die(_("Cannot access GPU registers, are you root?")); area = mmap(NULL, MMAP_SIZE, PROT_READ, MAP_PRIVATE, mem, gpu_device->regions[reg].base_addr + 0x8000); if (area == MAP_FAILED) die(_("mmap failed")); } bits.vram = 0; bits.gtt = 0; if (drm_fd < 0) { printf(_("Failed to open DRM node, no VRAM support.\n")); } else { drmDropMaster(drm_fd); drmVersionPtr ver = drmGetVersion(drm_fd); /* printf("Version %u.%u.%u, name %s\n", ver->version_major, ver->version_minor, ver->version_patchlevel, ver->name);*/ if (ver->version_major < 2 || (ver->version_major == 2 && ver->version_minor < 36)) { printf(_("Kernel too old for VRAM reporting.\n")); drmFreeVersion(ver); goto out; } 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 if (strcmp(drm_name, "radeon") == 0) { struct drm_radeon_gem_info gem; ret = drmCommandWriteRead(drm_fd, DRM_RADEON_GEM_INFO, &gem, sizeof(gem)); vramsize = gem.vram_size; gttsize = gem.gart_size; } else if (strcmp(drm_name, "amdgpu") == 0) { #ifdef ENABLE_AMDGPU struct drm_amdgpu_info_vram_gtt vram_gtt = {}; struct drm_amdgpu_info request; memset(&request, 0, sizeof(request)); request.return_pointer = (unsigned long) &vram_gtt; request.return_size = sizeof(vram_gtt); request.query = AMDGPU_INFO_VRAM_GTT; ret = drmCommandWrite(drm_fd, DRM_AMDGPU_INFO, &request, sizeof(request)); vramsize = vram_gtt.vram_size; gttsize = vram_gtt.gtt_size; #else printf(_("amdgpu DRM driver is used, but amdgpu VRAM size reporting is not enabled\n")); #endif } if (ret) { printf(_("Failed to get VRAM size, error %d\n"), ret); goto out; } ret = getvram(); if (ret == 0) { if (strcmp(drm_name, "amdgpu") == 0) { #ifndef ENABLE_AMDGPU printf(_("amdgpu DRM driver is used, but amdgpu VRAM usage reporting is not enabled\n")); #endif } printf(_("Failed to get VRAM usage, kernel likely too old\n")); goto out; } bits.vram = 1; ret = getgtt(); if (ret == 0) { if (strcmp(drm_name, "amdgpu") == 0) { #ifndef ENABLE_AMDGPU printf(_("amdgpu DRM driver is used, but amdgpu GTT usage reporting is not enabled\n")); #endif } printf(_("Failed to get GTT usage, kernel likely too old\n")); goto out; } bits.gtt = 1; } out: *bus = gpu_device->bus; *device_id = gpu_device->device_id; pci_system_cleanup(); } unsigned long long getvram() { int ret = -1; unsigned long long val = 0; if (strcmp(drm_name, "radeon") == 0) { struct drm_radeon_info info; memset(&info, 0, sizeof(info)); info.value = (unsigned long) &val; info.request = RADEON_INFO_VRAM_USAGE; ret = drmCommandWriteRead(drm_fd, DRM_RADEON_INFO, &info, sizeof(info)); } else if (strcmp(drm_name, "amdgpu") == 0) { #ifdef ENABLE_AMDGPU struct drm_amdgpu_info request; memset(&request, 0, sizeof(request)); request.return_pointer = (unsigned long) &val; request.return_size = sizeof(val); request.query = AMDGPU_INFO_VRAM_USAGE; ret = drmCommandWrite(drm_fd, DRM_AMDGPU_INFO, &request, sizeof(request)); #endif } if (ret) return 0; return val; } unsigned long long getgtt() { int ret = -1; unsigned long long val = 0; if (strcmp(drm_name, "radeon") == 0) { struct drm_radeon_info info; memset(&info, 0, sizeof(info)); info.value = (unsigned long) &val; info.request = RADEON_INFO_GTT_USAGE; ret = drmCommandWriteRead(drm_fd, DRM_RADEON_INFO, &info, sizeof(info)); } else if (strcmp(drm_name, "amdgpu") == 0) { #ifdef ENABLE_AMDGPU struct drm_amdgpu_info info; memset(&info, 0, sizeof(struct drm_amdgpu_info)); info.query = AMDGPU_INFO_GTT_USAGE; info.return_pointer = (unsigned long)&val; info.return_size = sizeof(val); ret = drmCommandWriteRead(drm_fd, DRM_AMDGPU_INFO, &info, sizeof(info)); #endif } if (ret) return 0; 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) { switch(id) { #define CHIPSET(a,b,c) case a: return c; #include "r600_pci_ids.h" #undef CHIPSET } return 0; } void initbits(int fam) { // The majority of these is the same from R600 to Southern Islands. bits.ee = (1U << 10); bits.vgt = (1U << 16) | (1U << 17); bits.ta = (1U << 14); bits.tc = (1U << 19); bits.sx = (1U << 20); bits.sh = (1U << 21); bits.spi = (1U << 22); bits.smx = (1U << 23); bits.sc = (1U << 24); bits.pa = (1U << 25); bits.db = (1U << 26); bits.cr = (1U << 27); bits.cb = (1U << 30); bits.gui = (1U << 31); // R600 has a different texture bit, and only R600 has the TC, CR, SMX bits if (fam < RV770) { bits.ta = (1U << 18); } else { bits.tc = 0; bits.cr = 0; bits.smx = 0; } } radeontop-1.2/dump.c000066400000000000000000000077561347515157400145130ustar00rootroot00000000000000/* 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 the Free Software Foundation, version 3 of the License. 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 . */ #include "radeontop.h" static unsigned char quit = 0; static void sighandler(int sig) { switch (sig) { case SIGTERM: case SIGINT: quit = 1; break; } } 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 setlocale(LC_NUMERIC, "C"); #endif // Set up signals to exit gracefully when terminated struct sigaction sig; sig.sa_handler = sighandler; sigaction(SIGTERM, &sig, NULL); sigaction(SIGINT, &sig, NULL); printf(_("Dumping to %s, "), file); if (limit) printf(_("line limit %u.\n"), limit); else puts(_("until termination.")); // Check the file can be output to FILE *f = NULL; if (file[0] == '-') f = stdout; else f = fopen(file, "a"); if (!f) die(_("Can't open file for writing.")); // This does not need to be atomic. A delay here is acceptable. while(!results) usleep(16000); // Action unsigned int count; for (count = limit; !limit || count; count--) { struct timeval t; gettimeofday(&t, NULL); 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 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.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); fprintf(f, "vgt %.2f%%, ", vgt); fprintf(f, "ta %.2f%%, ", ta); if (bits.tc) fprintf(f, "tc %.2f%%, ", tc); fprintf(f, "sx %.2f%%, ", sx); fprintf(f, "sh %.2f%%, ", sh); fprintf(f, "spi %.2f%%, ", spi); if (bits.smx) fprintf(f, "smx %.2f%%, ", smx); if (bits.cr) fprintf(f, "cr %.2f%%, ", cr); fprintf(f, "sc %.2f%%, ", sc); fprintf(f, "pa %.2f%%, ", pa); fprintf(f, "db %.2f%%, ", db); fprintf(f, "cb %.2f%%", cb); if (bits.vram) fprintf(f, ", vram %.2f%% %.2fmb", vram, vrammb); if (bits.gtt) 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; // No sleeping on the last line. if (!limit || count > 1) sleep(dumpinterval); } fflush(f); if (f != stdout) { fsync(fileno(f)); fclose(f); } } radeontop-1.2/family_str.c000066400000000000000000000026011347515157400156770ustar00rootroot00000000000000/* Copyright (C) 2012 Lauri Kasanen 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, version 3 of the License. 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 . */ #include "radeontop.h" #define str(a) #a const char * const family_str[] = { str(UNKNOWN_CHIP), str(R600), str(RV610), str(RV630), str(RV670), str(RV620), str(RV635), str(RS780), str(RS880), str(RV770), str(RV730), str(RV710), str(RV740), str(CEDAR), str(REDWOOD), str(JUNIPER), str(CYPRESS), str(HEMLOCK), str(PALM), str(SUMO), str(SUMO2), str(BARTS), str(TURKS), str(CAICOS), str(CAYMAN), str(ARUBA), str(TAHITI), str(PITCAIRN), str(VERDE), str(OLAND), str(HAINAN), str(BONAIRE), str(KABINI), str(MULLINS), str(KAVERI), str(HAWAII), str(TOPAZ), str(TONGA), str(FIJI), str(CARRIZO), str(STONEY), str(POLARIS11), str(POLARIS10), str(POLARIS12), str(VEGAM), str(VEGA10), str(VEGA12), str(VEGA20), str(RAVEN), }; radeontop-1.2/familycheck.sh000077500000000000000000000006031347515157400162000ustar00rootroot00000000000000#!/bin/sh # Check that the two places with family enums are in good condition. # The next-best thing to the compiler enforcing it. fam=`cut -d, -f3 include/r600_pci_ids.h | cut -d\) -f1 | sed -e 's@^ *@@' -e '/^$/d' | uniq` for i in $fam; do grep -q $i family_str.c || echo $i missing from family_str.c grep -q $i include/radeontop.h || echo $i missing from include/radeontop.h done radeontop-1.2/getamdgpuids.sh000077500000000000000000000012061347515157400163760ustar00rootroot00000000000000#!/bin/sh -e # # Extract the amdgpu pci ids from the kernel source. # Too bad no more easy libdrm list. # quit() { echo "Usage: $0 /path/to/kernel/src" exit } [ "$#" -lt 1 ] && quit [ ! -d "$1" ] && quit dir=$1/drivers/gpu/drm/amd/amdgpu ids=`cpp $dir/amdgpu_drv.c 2>/dev/null | grep 0x1002 | sed -e 's@PCI_AN.*CHIP@CHIP@' \ -e 's@|.*@@' -e 's@[{,}]@@g' -e 's@^ @@' -e 's@0x1002 @@' -e 's@CHIP_@@'` fams=`echo "$ids" | awk '{print $2}' | uniq` # clear previous ones for i in $fams; do sed -i "/$i/d" include/r600_pci_ids.h done ids=`echo "$ids" | awk '{print "CHIPSET(" $1 ", " $1 ", " $2 ")"}'` echo "$ids" >> include/r600_pci_ids.h radeontop-1.2/getver.sh000077500000000000000000000003201347515157400152110ustar00rootroot00000000000000#!/bin/sh ver=unknown if [ -n "`which git`" ] && git rev-parse HEAD 2>/dev/null; then ver=`git describe` fi cat > include/version.h << EOF #ifndef VER_H #define VER_H #define VERSION "$ver" #endif EOF radeontop-1.2/include/000077500000000000000000000000001347515157400150065ustar00rootroot00000000000000radeontop-1.2/include/gettext.h000066400000000000000000000216071347515157400166510ustar00rootroot00000000000000/* Convenience header for conditional use of GNU . Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc. 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 2, 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 #define _(string) gettext(string) /* NLS can be disabled through the configure --disable-nls option. */ #if ENABLE_NLS /* Get declarations of GNU message catalog functions. */ # include /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by the gettext() and ngettext() macros. This is an alternative to calling textdomain(), and is useful for libraries. */ # ifdef DEFAULT_TEXT_DOMAIN # undef gettext # define gettext(Msgid) \ dgettext (DEFAULT_TEXT_DOMAIN, Msgid) # undef ngettext # define ngettext(Msgid1, Msgid2, N) \ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) # endif #else /* Many header files from the libstdc++ coming with g++ 3.3 or newer include , which chokes if dcgettext is defined as a macro. So include it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif /* Disabled NLS. The casts to 'const char *' serve the purpose of producing warnings for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ # define gettext(Msgid) ((const char *) (Msgid)) # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) # define dcgettext(Domainname, Msgid, Category) \ ((void) (Category), dgettext (Domainname, Msgid)) # define ngettext(Msgid1, Msgid2, N) \ ((N) == 1 \ ? ((void) (Msgid2), (const char *) (Msgid1)) \ : ((void) (Msgid1), (const char *) (Msgid2))) # define dngettext(Domainname, Msgid1, Msgid2, N) \ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) # define textdomain(Domainname) ((const char *) (Domainname)) # define bindtextdomain(Domainname, Dirname) \ ((void) (Domainname), (const char *) (Dirname)) # define bind_textdomain_codeset(Domainname, Codeset) \ ((void) (Domainname), (const char *) (Codeset)) #endif /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. The argument, String, should be a literal string. Concatenated strings and other string expressions won't work. The macro's expansion is not parenthesized, so that it is suitable as initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String /* The separator between msgctxt and msgid in a .mo file. */ #define GETTEXT_CONTEXT_GLUE "\004" /* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be short and rarely need to change. The letter 'p' stands for 'particular' or 'special'. */ #ifdef DEFAULT_TEXT_DOMAIN # define pgettext(Msgctxt, Msgid) \ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #else # define pgettext(Msgctxt, Msgid) \ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #endif #define dpgettext(Domainname, Msgctxt, Msgid) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) #ifdef DEFAULT_TEXT_DOMAIN # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #else # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #endif #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * pgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, int category) { const char *translation = dcgettext (domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) return msgid; else return translation; } #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * npgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { const char *translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); if (translation == msg_ctxt_id || translation == msgid_plural) return (n == 1 ? msgid : msgid_plural); else return translation; } /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID can be arbitrary expressions. But for string literals these macros are less efficient than those above. */ #include #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ /* || __STDC_VERSION__ >= 199901L */ ) #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS #include #endif #define pgettext_expr(Msgctxt, Msgid) \ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) #define dpgettext_expr(Domainname, Msgctxt, Msgid) \ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (translation != msg_ctxt_id) return translation; } return msgid; } #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static const char * dcnpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, const char *msgid_plural, unsigned long int n, int category) { size_t msgctxt_len = strlen (msgctxt) + 1; size_t msgid_len = strlen (msgid) + 1; const char *translation; #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS char msg_ctxt_id[msgctxt_len + msgid_len]; #else char buf[1024]; char *msg_ctxt_id = (msgctxt_len + msgid_len <= sizeof (buf) ? buf : (char *) malloc (msgctxt_len + msgid_len)); if (msg_ctxt_id != NULL) #endif { memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif if (!(translation == msg_ctxt_id || translation == msgid_plural)) return translation; } return (n == 1 ? msgid : msgid_plural); } #endif /* _LIBGETTEXT_H */ radeontop-1.2/include/r600_pci_ids.h000066400000000000000000000452531347515157400173510ustar00rootroot00000000000000CHIPSET(0x9400, R600_9400, R600) CHIPSET(0x9401, R600_9401, R600) CHIPSET(0x9402, R600_9402, R600) CHIPSET(0x9403, R600_9403, R600) CHIPSET(0x9405, R600_9405, R600) CHIPSET(0x940A, R600_940A, R600) CHIPSET(0x940B, R600_940B, R600) CHIPSET(0x940F, R600_940F, R600) CHIPSET(0x94C0, RV610_94C0, RV610) CHIPSET(0x94C1, RV610_94C1, RV610) CHIPSET(0x94C3, RV610_94C3, RV610) CHIPSET(0x94C4, RV610_94C4, RV610) CHIPSET(0x94C5, RV610_94C5, RV610) CHIPSET(0x94C6, RV610_94C6, RV610) CHIPSET(0x94C7, RV610_94C7, RV610) CHIPSET(0x94C8, RV610_94C8, RV610) CHIPSET(0x94C9, RV610_94C9, RV610) CHIPSET(0x94CB, RV610_94CB, RV610) CHIPSET(0x94CC, RV610_94CC, RV610) CHIPSET(0x94CD, RV610_94CD, RV610) CHIPSET(0x9580, RV630_9580, RV630) CHIPSET(0x9581, RV630_9581, RV630) CHIPSET(0x9583, RV630_9583, RV630) CHIPSET(0x9586, RV630_9586, RV630) CHIPSET(0x9587, RV630_9587, RV630) CHIPSET(0x9588, RV630_9588, RV630) CHIPSET(0x9589, RV630_9589, RV630) CHIPSET(0x958A, RV630_958A, RV630) CHIPSET(0x958B, RV630_958B, RV630) CHIPSET(0x958C, RV630_958C, RV630) CHIPSET(0x958D, RV630_958D, RV630) CHIPSET(0x958E, RV630_958E, RV630) CHIPSET(0x958F, RV630_958F, RV630) CHIPSET(0x9500, RV670_9500, RV670) CHIPSET(0x9501, RV670_9501, RV670) CHIPSET(0x9504, RV670_9504, RV670) CHIPSET(0x9505, RV670_9505, RV670) CHIPSET(0x9506, RV670_9506, RV670) CHIPSET(0x9507, RV670_9507, RV670) CHIPSET(0x9508, RV670_9508, RV670) CHIPSET(0x9509, RV670_9509, RV670) CHIPSET(0x950F, RV670_950F, RV670) CHIPSET(0x9511, RV670_9511, RV670) CHIPSET(0x9515, RV670_9515, RV670) CHIPSET(0x9517, RV670_9517, RV670) CHIPSET(0x9519, RV670_9519, RV670) CHIPSET(0x95C0, RV620_95C0, RV620) CHIPSET(0x95C2, RV620_95C2, RV620) CHIPSET(0x95C4, RV620_95C4, RV620) CHIPSET(0x95C5, RV620_95C5, RV620) CHIPSET(0x95C6, RV620_95C6, RV620) CHIPSET(0x95C7, RV620_95C7, RV620) CHIPSET(0x95C9, RV620_95C9, RV620) CHIPSET(0x95CC, RV620_95CC, RV620) CHIPSET(0x95CD, RV620_95CD, RV620) CHIPSET(0x95CE, RV620_95CE, RV620) CHIPSET(0x95CF, RV620_95CF, RV620) CHIPSET(0x9590, RV635_9590, RV635) CHIPSET(0x9591, RV635_9591, RV635) CHIPSET(0x9593, RV635_9593, RV635) CHIPSET(0x9595, RV635_9595, RV635) CHIPSET(0x9596, RV635_9596, RV635) CHIPSET(0x9597, RV635_9597, RV635) CHIPSET(0x9598, RV635_9598, RV635) CHIPSET(0x9599, RV635_9599, RV635) CHIPSET(0x959B, RV635_959B, RV635) CHIPSET(0x9610, RS780_9610, RS780) CHIPSET(0x9611, RS780_9611, RS780) CHIPSET(0x9612, RS780_9612, RS780) CHIPSET(0x9613, RS780_9613, RS780) CHIPSET(0x9614, RS780_9614, RS780) CHIPSET(0x9615, RS780_9615, RS780) CHIPSET(0x9616, RS780_9616, RS780) CHIPSET(0x9710, RS880_9710, RS880) CHIPSET(0x9711, RS880_9711, RS880) CHIPSET(0x9712, RS880_9712, RS880) CHIPSET(0x9713, RS880_9713, RS880) CHIPSET(0x9714, RS880_9714, RS880) CHIPSET(0x9715, RS880_9715, RS880) CHIPSET(0x9440, RV770_9440, RV770) CHIPSET(0x9441, RV770_9441, RV770) CHIPSET(0x9442, RV770_9442, RV770) CHIPSET(0x9443, RV770_9443, RV770) CHIPSET(0x9444, RV770_9444, RV770) CHIPSET(0x9446, RV770_9446, RV770) CHIPSET(0x944A, RV770_944A, RV770) CHIPSET(0x944B, RV770_944B, RV770) CHIPSET(0x944C, RV770_944C, RV770) CHIPSET(0x944E, RV770_944E, RV770) CHIPSET(0x9450, RV770_9450, RV770) CHIPSET(0x9452, RV770_9452, RV770) CHIPSET(0x9456, RV770_9456, RV770) CHIPSET(0x945A, RV770_945A, RV770) CHIPSET(0x945B, RV770_945B, RV770) CHIPSET(0x945E, RV770_945E, RV770) CHIPSET(0x9460, RV790_9460, RV770) CHIPSET(0x9462, RV790_9462, RV770) CHIPSET(0x946A, RV770_946A, RV770) CHIPSET(0x946B, RV770_946B, RV770) CHIPSET(0x947A, RV770_947A, RV770) CHIPSET(0x947B, RV770_947B, RV770) CHIPSET(0x9480, RV730_9480, RV730) CHIPSET(0x9487, RV730_9487, RV730) CHIPSET(0x9488, RV730_9488, RV730) CHIPSET(0x9489, RV730_9489, RV730) CHIPSET(0x948A, RV730_948A, RV730) CHIPSET(0x948F, RV730_948F, RV730) CHIPSET(0x9490, RV730_9490, RV730) CHIPSET(0x9491, RV730_9491, RV730) CHIPSET(0x9495, RV730_9495, RV730) CHIPSET(0x9498, RV730_9498, RV730) CHIPSET(0x949C, RV730_949C, RV730) CHIPSET(0x949E, RV730_949E, RV730) CHIPSET(0x949F, RV730_949F, RV730) CHIPSET(0x9540, RV710_9540, RV710) CHIPSET(0x9541, RV710_9541, RV710) CHIPSET(0x9542, RV710_9542, RV710) CHIPSET(0x954E, RV710_954E, RV710) CHIPSET(0x954F, RV710_954F, RV710) CHIPSET(0x9552, RV710_9552, RV710) CHIPSET(0x9553, RV710_9553, RV710) CHIPSET(0x9555, RV710_9555, RV710) CHIPSET(0x9557, RV710_9557, RV710) CHIPSET(0x955F, RV710_955F, RV710) CHIPSET(0x94A0, RV740_94A0, RV740) CHIPSET(0x94A1, RV740_94A1, RV740) CHIPSET(0x94A3, RV740_94A3, RV740) CHIPSET(0x94B1, RV740_94B1, RV740) CHIPSET(0x94B3, RV740_94B3, RV740) CHIPSET(0x94B4, RV740_94B4, RV740) CHIPSET(0x94B5, RV740_94B5, RV740) CHIPSET(0x94B9, RV740_94B9, RV740) CHIPSET(0x68E0, CEDAR_68E0, CEDAR) CHIPSET(0x68E1, CEDAR_68E1, CEDAR) CHIPSET(0x68E4, CEDAR_68E4, CEDAR) CHIPSET(0x68E5, CEDAR_68E5, CEDAR) CHIPSET(0x68E8, CEDAR_68E8, CEDAR) CHIPSET(0x68E9, CEDAR_68E9, CEDAR) CHIPSET(0x68F1, CEDAR_68F1, CEDAR) CHIPSET(0x68F2, CEDAR_68F2, CEDAR) CHIPSET(0x68F8, CEDAR_68F8, CEDAR) CHIPSET(0x68F9, CEDAR_68F9, CEDAR) CHIPSET(0x68FA, CEDAR_68FA, CEDAR) CHIPSET(0x68FE, CEDAR_68FE, CEDAR) CHIPSET(0x68C0, REDWOOD_68C0, REDWOOD) CHIPSET(0x68C1, REDWOOD_68C1, REDWOOD) CHIPSET(0x68C7, REDWOOD_68C7, REDWOOD) CHIPSET(0x68C8, REDWOOD_68C8, REDWOOD) CHIPSET(0x68C9, REDWOOD_68C9, REDWOOD) CHIPSET(0x68D8, REDWOOD_68D8, REDWOOD) CHIPSET(0x68D9, REDWOOD_68D9, REDWOOD) CHIPSET(0x68DA, REDWOOD_68DA, REDWOOD) CHIPSET(0x68DE, REDWOOD_68DE, REDWOOD) CHIPSET(0x68A0, JUNIPER_68A0, JUNIPER) CHIPSET(0x68A1, JUNIPER_68A1, JUNIPER) CHIPSET(0x68A8, JUNIPER_68A8, JUNIPER) CHIPSET(0x68A9, JUNIPER_68A9, JUNIPER) CHIPSET(0x68B0, JUNIPER_68B0, JUNIPER) CHIPSET(0x68B8, JUNIPER_68B8, JUNIPER) CHIPSET(0x68B9, JUNIPER_68B9, JUNIPER) CHIPSET(0x68BA, JUNIPER_68BA, JUNIPER) CHIPSET(0x68BE, JUNIPER_68BE, JUNIPER) CHIPSET(0x68BF, JUNIPER_68BF, JUNIPER) CHIPSET(0x6880, CYPRESS_6880, CYPRESS) CHIPSET(0x6888, CYPRESS_6888, CYPRESS) CHIPSET(0x6889, CYPRESS_6889, CYPRESS) CHIPSET(0x688A, CYPRESS_688A, CYPRESS) CHIPSET(0x688C, CYPRESS_688C, CYPRESS) CHIPSET(0x688D, CYPRESS_688D, CYPRESS) CHIPSET(0x6898, CYPRESS_6898, CYPRESS) CHIPSET(0x6899, CYPRESS_6899, CYPRESS) CHIPSET(0x689B, CYPRESS_689B, CYPRESS) CHIPSET(0x689E, CYPRESS_689E, CYPRESS) CHIPSET(0x689C, HEMLOCK_689C, HEMLOCK) CHIPSET(0x689D, HEMLOCK_689D, HEMLOCK) CHIPSET(0x9802, PALM_9802, PALM) CHIPSET(0x9803, PALM_9803, PALM) CHIPSET(0x9804, PALM_9804, PALM) CHIPSET(0x9805, PALM_9805, PALM) CHIPSET(0x9806, PALM_9806, PALM) CHIPSET(0x9807, PALM_9807, PALM) CHIPSET(0x9808, PALM_9808, PALM) CHIPSET(0x9809, PALM_9809, PALM) CHIPSET(0x980A, PALM_980A, PALM) CHIPSET(0x9640, SUMO_9640, SUMO) CHIPSET(0x9641, SUMO_9641, SUMO) CHIPSET(0x9642, SUMO2_9642, SUMO2) CHIPSET(0x9643, SUMO2_9643, SUMO2) CHIPSET(0x9644, SUMO2_9644, SUMO2) CHIPSET(0x9645, SUMO2_9645, SUMO2) CHIPSET(0x9647, SUMO_9647, SUMO) CHIPSET(0x9648, SUMO_9648, SUMO) CHIPSET(0x9649, SUMO2_9649, SUMO2) CHIPSET(0x964a, SUMO_964A, SUMO) CHIPSET(0x964b, SUMO_964B, SUMO) CHIPSET(0x964c, SUMO_964C, SUMO) CHIPSET(0x964e, SUMO_964E, SUMO) CHIPSET(0x964f, SUMO_964F, SUMO) CHIPSET(0x6700, CAYMAN_6700, CAYMAN) CHIPSET(0x6701, CAYMAN_6701, CAYMAN) CHIPSET(0x6702, CAYMAN_6702, CAYMAN) CHIPSET(0x6703, CAYMAN_6703, CAYMAN) CHIPSET(0x6704, CAYMAN_6704, CAYMAN) CHIPSET(0x6705, CAYMAN_6705, CAYMAN) CHIPSET(0x6706, CAYMAN_6706, CAYMAN) CHIPSET(0x6707, CAYMAN_6707, CAYMAN) CHIPSET(0x6708, CAYMAN_6708, CAYMAN) CHIPSET(0x6709, CAYMAN_6709, CAYMAN) CHIPSET(0x6718, CAYMAN_6718, CAYMAN) CHIPSET(0x6719, CAYMAN_6719, CAYMAN) CHIPSET(0x671C, CAYMAN_671C, CAYMAN) CHIPSET(0x671D, CAYMAN_671D, CAYMAN) CHIPSET(0x671F, CAYMAN_671F, CAYMAN) CHIPSET(0x6720, BARTS_6720, BARTS) CHIPSET(0x6721, BARTS_6721, BARTS) CHIPSET(0x6722, BARTS_6722, BARTS) CHIPSET(0x6723, BARTS_6723, BARTS) CHIPSET(0x6724, BARTS_6724, BARTS) CHIPSET(0x6725, BARTS_6725, BARTS) CHIPSET(0x6726, BARTS_6726, BARTS) CHIPSET(0x6727, BARTS_6727, BARTS) CHIPSET(0x6728, BARTS_6728, BARTS) CHIPSET(0x6729, BARTS_6729, BARTS) CHIPSET(0x6738, BARTS_6738, BARTS) CHIPSET(0x6739, BARTS_6739, BARTS) CHIPSET(0x673E, BARTS_673E, BARTS) CHIPSET(0x6740, TURKS_6740, TURKS) CHIPSET(0x6741, TURKS_6741, TURKS) CHIPSET(0x6742, TURKS_6742, TURKS) CHIPSET(0x6743, TURKS_6743, TURKS) CHIPSET(0x6744, TURKS_6744, TURKS) CHIPSET(0x6745, TURKS_6745, TURKS) CHIPSET(0x6746, TURKS_6746, TURKS) CHIPSET(0x6747, TURKS_6747, TURKS) CHIPSET(0x6748, TURKS_6748, TURKS) CHIPSET(0x6749, TURKS_6749, TURKS) CHIPSET(0x674A, TURKS_674A, TURKS) CHIPSET(0x6750, TURKS_6750, TURKS) CHIPSET(0x6751, TURKS_6751, TURKS) CHIPSET(0x6758, TURKS_6758, TURKS) CHIPSET(0x6759, TURKS_6759, TURKS) CHIPSET(0x675B, TURKS_675B, TURKS) CHIPSET(0x675D, TURKS_675D, TURKS) CHIPSET(0x675F, TURKS_675F, TURKS) CHIPSET(0x6840, TURKS_6840, TURKS) CHIPSET(0x6841, TURKS_6841, TURKS) CHIPSET(0x6842, TURKS_6842, TURKS) CHIPSET(0x6843, TURKS_6843, TURKS) CHIPSET(0x6849, TURKS_6849, TURKS) CHIPSET(0x6850, TURKS_6850, TURKS) CHIPSET(0x6858, TURKS_6858, TURKS) CHIPSET(0x6859, TURKS_6859, TURKS) CHIPSET(0x6760, CAICOS_6760, CAICOS) CHIPSET(0x6761, CAICOS_6761, CAICOS) CHIPSET(0x6762, CAICOS_6762, CAICOS) CHIPSET(0x6763, CAICOS_6763, CAICOS) CHIPSET(0x6764, CAICOS_6764, CAICOS) CHIPSET(0x6765, CAICOS_6765, CAICOS) CHIPSET(0x6766, CAICOS_6766, CAICOS) CHIPSET(0x6767, CAICOS_6767, CAICOS) CHIPSET(0x6768, CAICOS_6768, CAICOS) CHIPSET(0x6770, CAICOS_6770, CAICOS) CHIPSET(0x6771, CAICOS_6771, CAICOS) CHIPSET(0x6772, CAICOS_6772, CAICOS) CHIPSET(0x6778, CAICOS_6778, CAICOS) CHIPSET(0x6779, CAICOS_6779, CAICOS) CHIPSET(0x677B, CAICOS_677B, CAICOS) CHIPSET(0x9900, ARUBA_9900, ARUBA) CHIPSET(0x9901, ARUBA_9901, ARUBA) CHIPSET(0x9903, ARUBA_9903, ARUBA) CHIPSET(0x9904, ARUBA_9904, ARUBA) CHIPSET(0x9905, ARUBA_9905, ARUBA) CHIPSET(0x9906, ARUBA_9906, ARUBA) CHIPSET(0x9907, ARUBA_9907, ARUBA) CHIPSET(0x9908, ARUBA_9908, ARUBA) CHIPSET(0x9909, ARUBA_9909, ARUBA) CHIPSET(0x990A, ARUBA_990A, ARUBA) CHIPSET(0x990B, ARUBA_990B, ARUBA) CHIPSET(0x990C, ARUBA_990C, ARUBA) CHIPSET(0x990D, ARUBA_990D, ARUBA) CHIPSET(0x990E, ARUBA_990E, ARUBA) CHIPSET(0x990F, ARUBA_990F, ARUBA) CHIPSET(0x9910, ARUBA_9910, ARUBA) CHIPSET(0x9913, ARUBA_9913, ARUBA) CHIPSET(0x9917, ARUBA_9917, ARUBA) CHIPSET(0x9918, ARUBA_9918, ARUBA) CHIPSET(0x9919, ARUBA_9919, ARUBA) CHIPSET(0x9990, ARUBA_9990, ARUBA) CHIPSET(0x9991, ARUBA_9991, ARUBA) CHIPSET(0x9992, ARUBA_9992, ARUBA) CHIPSET(0x9993, ARUBA_9993, ARUBA) CHIPSET(0x9994, ARUBA_9994, ARUBA) CHIPSET(0x9995, ARUBA_9995, ARUBA) CHIPSET(0x9996, ARUBA_9996, ARUBA) CHIPSET(0x9997, ARUBA_9997, ARUBA) CHIPSET(0x9998, ARUBA_9998, ARUBA) CHIPSET(0x9999, ARUBA_9999, ARUBA) CHIPSET(0x999A, ARUBA_999A, ARUBA) CHIPSET(0x999B, ARUBA_999B, ARUBA) CHIPSET(0x999C, ARUBA_999C, ARUBA) CHIPSET(0x999D, ARUBA_999D, ARUBA) CHIPSET(0x99A0, ARUBA_99A0, ARUBA) CHIPSET(0x99A2, ARUBA_99A2, ARUBA) CHIPSET(0x99A4, ARUBA_99A4, ARUBA) CHIPSET(0x6780, TAHITI_6780, TAHITI) CHIPSET(0x6784, TAHITI_6784, TAHITI) CHIPSET(0x6788, TAHITI_6788, TAHITI) CHIPSET(0x678A, TAHITI_678A, TAHITI) CHIPSET(0x6790, TAHITI_6790, TAHITI) CHIPSET(0x6791, TAHITI_6791, TAHITI) CHIPSET(0x6792, TAHITI_6792, TAHITI) CHIPSET(0x6798, TAHITI_6798, TAHITI) CHIPSET(0x6799, TAHITI_6799, TAHITI) CHIPSET(0x679A, TAHITI_679A, TAHITI) CHIPSET(0x679B, TAHITI_679B, TAHITI) CHIPSET(0x679E, TAHITI_679E, TAHITI) CHIPSET(0x679F, TAHITI_679F, TAHITI) CHIPSET(0x6800, PITCAIRN_6800, PITCAIRN) CHIPSET(0x6801, PITCAIRN_6801, PITCAIRN) CHIPSET(0x6802, PITCAIRN_6802, PITCAIRN) CHIPSET(0x6806, PITCAIRN_6806, PITCAIRN) CHIPSET(0x6808, PITCAIRN_6808, PITCAIRN) CHIPSET(0x6809, PITCAIRN_6809, PITCAIRN) CHIPSET(0x6810, PITCAIRN_6810, PITCAIRN) CHIPSET(0x6811, PITCAIRN_6811, PITCAIRN) CHIPSET(0x6816, PITCAIRN_6816, PITCAIRN) CHIPSET(0x6817, PITCAIRN_6817, PITCAIRN) CHIPSET(0x6818, PITCAIRN_6818, PITCAIRN) CHIPSET(0x6819, PITCAIRN_6819, PITCAIRN) CHIPSET(0x684C, PITCAIRN_684C, PITCAIRN) CHIPSET(0x6820, VERDE_6820, VERDE) CHIPSET(0x6821, VERDE_6821, VERDE) CHIPSET(0x6822, VERDE_6822, VERDE) CHIPSET(0x6823, VERDE_6823, VERDE) CHIPSET(0x6824, VERDE_6824, VERDE) CHIPSET(0x6825, VERDE_6825, VERDE) CHIPSET(0x6826, VERDE_6826, VERDE) CHIPSET(0x6827, VERDE_6827, VERDE) CHIPSET(0x6828, VERDE_6828, VERDE) CHIPSET(0x6829, VERDE_6829, VERDE) CHIPSET(0x682A, VERDE_682A, VERDE) CHIPSET(0x682B, VERDE_682B, VERDE) CHIPSET(0x682C, VERDE_682C, VERDE) CHIPSET(0x682D, VERDE_682D, VERDE) CHIPSET(0x682F, VERDE_682F, VERDE) CHIPSET(0x6830, VERDE_6830, VERDE) CHIPSET(0x6831, VERDE_6831, VERDE) CHIPSET(0x6835, VERDE_6835, VERDE) CHIPSET(0x6837, VERDE_6837, VERDE) CHIPSET(0x6838, VERDE_6838, VERDE) CHIPSET(0x6839, VERDE_6839, VERDE) CHIPSET(0x683B, VERDE_683B, VERDE) CHIPSET(0x683D, VERDE_683D, VERDE) CHIPSET(0x683F, VERDE_683F, VERDE) CHIPSET(0x6600, OLAND_6600, OLAND) CHIPSET(0x6601, OLAND_6601, OLAND) CHIPSET(0x6602, OLAND_6602, OLAND) CHIPSET(0x6603, OLAND_6603, OLAND) CHIPSET(0x6604, OLAND_6604, OLAND) CHIPSET(0x6605, OLAND_6605, OLAND) CHIPSET(0x6606, OLAND_6606, OLAND) CHIPSET(0x6607, OLAND_6607, OLAND) CHIPSET(0x6608, OLAND_6608, OLAND) CHIPSET(0x6610, OLAND_6610, OLAND) CHIPSET(0x6611, OLAND_6611, OLAND) CHIPSET(0x6613, OLAND_6613, OLAND) CHIPSET(0x6620, OLAND_6620, OLAND) CHIPSET(0x6621, OLAND_6621, OLAND) CHIPSET(0x6623, OLAND_6623, OLAND) CHIPSET(0x6631, OLAND_6631, OLAND) CHIPSET(0x6660, HAINAN_6660, HAINAN) CHIPSET(0x6663, HAINAN_6663, HAINAN) CHIPSET(0x6664, HAINAN_6664, HAINAN) CHIPSET(0x6665, HAINAN_6665, HAINAN) CHIPSET(0x6667, HAINAN_6667, HAINAN) CHIPSET(0x666F, HAINAN_666F, HAINAN) CHIPSET(0x6640, BONAIRE_6640, BONAIRE) CHIPSET(0x6641, BONAIRE_6641, BONAIRE) CHIPSET(0x6646, BONAIRE_6646, BONAIRE) CHIPSET(0x6647, BONAIRE_6647, BONAIRE) CHIPSET(0x6649, BONAIRE_6649, BONAIRE) CHIPSET(0x6650, BONAIRE_6650, BONAIRE) CHIPSET(0x6651, BONAIRE_6651, BONAIRE) CHIPSET(0x6658, BONAIRE_6658, BONAIRE) CHIPSET(0x665C, BONAIRE_665C, BONAIRE) CHIPSET(0x665D, BONAIRE_665D, BONAIRE) CHIPSET(0x665F, BONAIRE_665F, BONAIRE) CHIPSET(0x9830, KABINI_9830, KABINI) CHIPSET(0x9831, KABINI_9831, KABINI) CHIPSET(0x9832, KABINI_9832, KABINI) CHIPSET(0x9833, KABINI_9833, KABINI) CHIPSET(0x9834, KABINI_9834, KABINI) CHIPSET(0x9835, KABINI_9835, KABINI) CHIPSET(0x9836, KABINI_9836, KABINI) CHIPSET(0x9837, KABINI_9837, KABINI) CHIPSET(0x9838, KABINI_9838, KABINI) CHIPSET(0x9839, KABINI_9839, KABINI) CHIPSET(0x983A, KABINI_983A, KABINI) CHIPSET(0x983B, KABINI_983B, KABINI) CHIPSET(0x983C, KABINI_983C, KABINI) CHIPSET(0x983D, KABINI_983D, KABINI) CHIPSET(0x983E, KABINI_983E, KABINI) CHIPSET(0x983F, KABINI_983F, KABINI) CHIPSET(0x9850, MULLINS_9850, MULLINS) CHIPSET(0x9851, MULLINS_9851, MULLINS) CHIPSET(0x9852, MULLINS_9852, MULLINS) CHIPSET(0x9853, MULLINS_9853, MULLINS) CHIPSET(0x9854, MULLINS_9854, MULLINS) CHIPSET(0x9855, MULLINS_9855, MULLINS) CHIPSET(0x9856, MULLINS_9856, MULLINS) CHIPSET(0x9857, MULLINS_9857, MULLINS) CHIPSET(0x9858, MULLINS_9858, MULLINS) CHIPSET(0x9859, MULLINS_9859, MULLINS) CHIPSET(0x985A, MULLINS_985A, MULLINS) CHIPSET(0x985B, MULLINS_985B, MULLINS) CHIPSET(0x985C, MULLINS_985C, MULLINS) CHIPSET(0x985D, MULLINS_985D, MULLINS) CHIPSET(0x985E, MULLINS_985E, MULLINS) CHIPSET(0x985F, MULLINS_985F, MULLINS) CHIPSET(0x1304, KAVERI_1304, KAVERI) CHIPSET(0x1305, KAVERI_1305, KAVERI) CHIPSET(0x1306, KAVERI_1306, KAVERI) CHIPSET(0x1307, KAVERI_1307, KAVERI) CHIPSET(0x1309, KAVERI_1309, KAVERI) CHIPSET(0x130A, KAVERI_130A, KAVERI) CHIPSET(0x130B, KAVERI_130B, KAVERI) CHIPSET(0x130C, KAVERI_130C, KAVERI) CHIPSET(0x130D, KAVERI_130D, KAVERI) CHIPSET(0x130E, KAVERI_130E, KAVERI) CHIPSET(0x130F, KAVERI_130F, KAVERI) CHIPSET(0x1310, KAVERI_1310, KAVERI) CHIPSET(0x1311, KAVERI_1311, KAVERI) CHIPSET(0x1312, KAVERI_1312, KAVERI) CHIPSET(0x1313, KAVERI_1313, KAVERI) CHIPSET(0x1315, KAVERI_1315, KAVERI) CHIPSET(0x1316, KAVERI_1316, KAVERI) CHIPSET(0x1317, KAVERI_1317, KAVERI) CHIPSET(0x1318, KAVERI_1318, KAVERI) CHIPSET(0x131B, KAVERI_131B, KAVERI) CHIPSET(0x131C, KAVERI_131C, KAVERI) CHIPSET(0x131D, KAVERI_131D, KAVERI) CHIPSET(0x67A0, HAWAII_67A0, HAWAII) CHIPSET(0x67A1, HAWAII_67A1, HAWAII) CHIPSET(0x67A2, HAWAII_67A2, HAWAII) CHIPSET(0x67A8, HAWAII_67A8, HAWAII) CHIPSET(0x67A9, HAWAII_67A9, HAWAII) CHIPSET(0x67AA, HAWAII_67AA, HAWAII) CHIPSET(0x67B0, HAWAII_67B0, HAWAII) CHIPSET(0x67B1, HAWAII_67B1, HAWAII) CHIPSET(0x67B8, HAWAII_67B8, HAWAII) CHIPSET(0x67B9, HAWAII_67B9, HAWAII) CHIPSET(0x67BA, HAWAII_67BA, HAWAII) CHIPSET(0x67BE, HAWAII_67BE, HAWAII) CHIPSET(0x6900, 0x6900, TOPAZ) CHIPSET(0x6901, 0x6901, TOPAZ) CHIPSET(0x6902, 0x6902, TOPAZ) CHIPSET(0x6903, 0x6903, TOPAZ) CHIPSET(0x6907, 0x6907, TOPAZ) CHIPSET(0x6920, 0x6920, TONGA) CHIPSET(0x6921, 0x6921, TONGA) CHIPSET(0x6928, 0x6928, TONGA) CHIPSET(0x6929, 0x6929, TONGA) CHIPSET(0x692B, 0x692B, TONGA) CHIPSET(0x692F, 0x692F, TONGA) CHIPSET(0x6930, 0x6930, TONGA) CHIPSET(0x6938, 0x6938, TONGA) CHIPSET(0x6939, 0x6939, TONGA) CHIPSET(0x7300, 0x7300, FIJI) CHIPSET(0x730F, 0x730F, FIJI) CHIPSET(0x9870, 0x9870, CARRIZO) CHIPSET(0x9874, 0x9874, CARRIZO) CHIPSET(0x9875, 0x9875, CARRIZO) CHIPSET(0x9876, 0x9876, CARRIZO) CHIPSET(0x9877, 0x9877, CARRIZO) CHIPSET(0x98E4, 0x98E4, STONEY) CHIPSET(0x67E0, 0x67E0, POLARIS11) CHIPSET(0x67E3, 0x67E3, POLARIS11) CHIPSET(0x67E8, 0x67E8, POLARIS11) CHIPSET(0x67EB, 0x67EB, POLARIS11) CHIPSET(0x67EF, 0x67EF, POLARIS11) CHIPSET(0x67FF, 0x67FF, POLARIS11) CHIPSET(0x67E1, 0x67E1, POLARIS11) CHIPSET(0x67E7, 0x67E7, POLARIS11) CHIPSET(0x67E9, 0x67E9, POLARIS11) CHIPSET(0x67C0, 0x67C0, POLARIS10) CHIPSET(0x67C1, 0x67C1, POLARIS10) CHIPSET(0x67C2, 0x67C2, POLARIS10) CHIPSET(0x67C4, 0x67C4, POLARIS10) CHIPSET(0x67C7, 0x67C7, POLARIS10) CHIPSET(0x67D0, 0x67D0, POLARIS10) CHIPSET(0x67DF, 0x67DF, POLARIS10) CHIPSET(0x67C8, 0x67C8, POLARIS10) CHIPSET(0x67C9, 0x67C9, POLARIS10) 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) CHIPSET(0x6986, 0x6986, POLARIS12) CHIPSET(0x6987, 0x6987, POLARIS12) 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) CHIPSET(0x6863, 0x6863, VEGA10) 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) radeontop-1.2/include/radeontop.h000066400000000000000000000063521347515157400171600ustar00rootroot00000000000000/* 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 the Free Software Foundation, version 3 of the License. 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 . */ #ifndef RADEONTOP_H #define RADEONTOP_H #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include "version.h" #include "gettext.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef ENABLE_AMDGPU #include #endif enum { GRBM_STATUS = 0x8010, MMAP_SIZE = 0x14 }; #ifndef RADEON_INFO_VRAM_USAGE #define RADEON_INFO_VRAM_USAGE 0x1e #endif #ifndef RADEON_INFO_READ_REG #define RADEON_INFO_READ_REG 0x24 #endif // auth.c void authenticate_drm(int fd); // radeontop.c void die(const char *why); int get_drm_value(int fd, unsigned request, uint32_t *out); unsigned int readgrbm(); extern const void *area; extern int use_ioctl; // detect.c 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, unsigned int dumpinterval); extern struct bits_t *results; // ui.c 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, const unsigned char bus, const unsigned int dumpinterval); // chips enum radeon_family { UNKNOWN_CHIP, R600, RV610, RV630, RV670, RV620, RV635, RS780, RS880, RV770, RV730, RV710, RV740, CEDAR, REDWOOD, JUNIPER, CYPRESS, HEMLOCK, PALM, SUMO, SUMO2, BARTS, TURKS, CAICOS, CAYMAN, ARUBA, TAHITI, PITCAIRN, VERDE, OLAND, HAINAN, BONAIRE, KABINI, MULLINS, KAVERI, HAWAII, TOPAZ, TONGA, FIJI, CARRIZO, STONEY, POLARIS11, POLARIS10, POLARIS12, VEGAM, VEGA10, VEGA12, VEGA20, RAVEN, }; extern const char * const family_str[]; // bits struct bits_t { unsigned int ee; unsigned int vgt; unsigned int gui; unsigned int ta; unsigned int tc; unsigned int sx; unsigned int sh; unsigned int spi; unsigned int smx; unsigned int sc; unsigned int pa; unsigned int db; unsigned int cb; 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 radeontop-1.2/radeontop.1000066400000000000000000000060361347515157400154450ustar00rootroot00000000000000'\" t .\" Title: radeontop .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 07/13/2018 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "RADEONTOP" "1" "07/13/2018" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" 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] [\-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\&. .sp Supported cards are R600 and up\&. .SH "OPTIONS" .PP \fB\-b, \-\-bus \fR\fB\fIbus\fR\fR .RS 4 If you have multiple cards, use this parameter to select a specific one\&. For lspci output \fI01:00\&.0 VGA compatible controller\fR, bus would be \fI1\fR\&. .RE .PP \fB\-c, \-\-color\fR .RS 4 Enables colorized output\&. .RE .PP \fB\-d, \-\-dump \fR\fB\fIfile\fR\fR .RS 4 Instead of displaying the data, dump it to \fIfile\fR\&. Use \fI\-\fR for stdout\&. The file is appended to, so it\(cqs safe to specify the same filename for consecutive runs\&. Use \fISIGTERM\fR or \fISIGINT\fR for graceful termination\&. .RE .PP \fB\-h, \-\-help\fR .RS 4 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 \fIlimit\fR lines\&. Only valid in dump mode\&. Default is to dump until terminated; use \fISIGTERM\fR or \fISIGINT\fR for graceful termination\&. .RE .PP \fB\-m, \-\-mem\fR .RS 4 Forces the use of the /dev/mem path, in case autodetection fails\&. Useful for the proprietary driver\&. .RE .PP \fB\-t, \-\-ticks \fR\fB\fIticks\fR\fR .RS 4 How many times per second to sample the data\&. The default is 120\&. Higher numbers mean more accurate output and more overhead\&. .RE .PP \fB\-v, \-\-version\fR .RS 4 Displays the program version\&. .RE .SH "INTERACTIVE COMMANDS" .PP \fBC, c\fR .RS 4 Toggle colorized output\&. .RE .PP \fBQ, q\fR .RS 4 Quit\&. .RE .SH "RESOURCES" .sp See http://github\&.com/clbr/radeontop radeontop-1.2/radeontop.asc000066400000000000000000000030031347515157400160420ustar00rootroot00000000000000radeontop(1) ============ NAME ---- radeontop - tool to show GPU utilization SYNOPSIS -------- *radeontop [-chv] [-b 'bus'] [-d 'file'] [-l 'limit'] [-i 'secs'] [-t 'ticks']* DESCRIPTION ----------- RadeonTop shows the utilization of your GPU, both in general and by blocks. Supported cards are R600 and up. OPTIONS ------- *-b, --bus 'bus'*:: If you have multiple cards, use this parameter to select a specific one. For lspci output '01:00.0 VGA compatible controller', bus would be '1'. *-c, --color*:: Enables colorized output. *-d, --dump 'file'*:: Instead of displaying the data, dump it to 'file'. Use '-' for stdout. The file is appended to, so it's safe to specify the same filename for consecutive runs. + Use 'SIGTERM' or 'SIGINT' for graceful termination. *-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. *-m, --mem*:: Forces the use of the /dev/mem path, in case autodetection fails. Useful for the proprietary driver. *-t, --ticks 'ticks'*:: How many times per second to sample the data. The default is 120. Higher numbers mean more accurate output and more overhead. *-v, --version*:: Displays the program version. INTERACTIVE COMMANDS -------------------- *C, c*:: Toggle colorized output. *Q, q*:: Quit. RESOURCES --------- See http://github.com/clbr/radeontop radeontop-1.2/radeontop.c000066400000000000000000000104031347515157400155200ustar00rootroot00000000000000/* 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 the Free Software Foundation, version 3 of the License. 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 . */ #include "radeontop.h" #include const void *area; int use_ioctl; void die(const char * const why) { puts(why); exit(1); } static void version() { printf("RadeonTop %s\n", VERSION); exit(1); } 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] [-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, dumpinterval, ticks); die(""); } int get_drm_value(int fd, unsigned request, uint32_t *out) { struct drm_radeon_info info; int retval; memset(&info, 0, sizeof(info)); info.value = (unsigned long)out; info.request = request; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); return !retval; } unsigned int readgrbm() { if (use_ioctl) { uint32_t reg = 0x8010; get_drm_value(drm_fd, RADEON_INFO_READ_REG, ®); return reg; } else { const void *ptr = (const char *) area + 0x10; const unsigned int *inta = ptr; return *inta; } } int main(int argc, char **argv) { // Temporarily drop privileges to do option parsing, etc. seteuid(getuid()); 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 setlocale(LC_ALL, ""); bindtextdomain("radeontop", "/usr/share/locale"); textdomain("radeontop"); #endif // opts const struct option opts[] = { {"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'}, {"ticks", 1, 0, 't'}, {"version", 0, 0, 'v'}, {0, 0, 0, 0} }; while (1) { 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], default_ticks, default_dumpinterval); break; case 't': ticks = atoi(optarg); break; case 'c': color = 1; break; case 'm': forcemem = 1; break; case 'b': bus = strtoul(optarg, NULL, 16); break; case 'v': version(); break; case 'l': limit = atoi(optarg); break; 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); 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(device_id); if (!family) puts(_("Unknown Radeon card. <= R500 won't work, new cards might.")); const char * const cardname = family_str[family]; initbits(family); // runtime collect(ticks, dumpinterval); if (dump) dumpdata(ticks, dump, limit, bus, dumpinterval); else present(ticks, cardname, color, bus, dumpinterval); munmap((void *) area, MMAP_SIZE); return 0; } radeontop-1.2/radeontop.metainfo.xml000066400000000000000000000011721347515157400177020ustar00rootroot00000000000000 com.clbr.radeontop radeontop Graphic card usage viewer for AMD Radeon series.

View AMD Radeon graphic card utilization, both for the total activity percent and individual blocks

System https://github.com/clbr/radeontop https://github.com/clbr/radeontop/issues CC0-1.0 GPL-3.0
radeontop-1.2/ticks.c000066400000000000000000000067141347515157400146540ustar00rootroot00000000000000/* Copyright (C) 2012 Lauri Kasanen 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, version 3 of the License. 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 . */ #include "radeontop.h" #include 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 = 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 * dumpinterval, sizeof(struct bits_t)); unsigned int cur = 0, curres = 0; const useconds_t sleeptime = 1e6 / ticks; while (1) { unsigned int stat = readgrbm(); memset(&history[cur], 0, sizeof(struct bits_t)); if (stat & bits.ee) history[cur].ee = 1; if (stat & bits.vgt) history[cur].vgt = 1; if (stat & bits.gui) history[cur].gui = 1; if (stat & bits.ta) history[cur].ta = 1; if (stat & bits.tc) history[cur].tc = 1; if (stat & bits.sx) history[cur].sx = 1; if (stat & bits.sh) history[cur].sh = 1; if (stat & bits.spi) history[cur].spi = 1; if (stat & bits.smx) history[cur].smx = 1; if (stat & bits.sc) history[cur].sc = 1; if (stat & bits.pa) history[cur].pa = 1; 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 * dumpinterval; // One second has passed, we have one sec's worth of data if (cur == 0) { unsigned int i; memset(&res[curres], 0, sizeof(struct bits_t)); 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; res[curres].ta += history[i].ta; res[curres].tc += history[i].tc; res[curres].sx += history[i].sx; res[curres].sh += history[i].sh; res[curres].spi += history[i].spi; res[curres].smx += history[i].smx; res[curres].sc += history[i].sc; res[curres].pa += history[i].pa; 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(); res[curres].gtt = getgtt(); // Atomically write it to the pointer __sync_bool_compare_and_swap(&results, results, &res[curres]); curres++; curres %= 2; } } return NULL; } void collect(unsigned int ticks, unsigned int dumpinterval) { // Start a thread collecting data pthread_t tid; pthread_attr_t attr; // We don't care to join this thread pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); struct collector_args_t *args = malloc(sizeof(*args)); args->ticks = ticks; args->dumpinterval = dumpinterval; pthread_create(&tid, &attr, collector, args); } radeontop-1.2/translations/000077500000000000000000000000001347515157400161045ustar00rootroot00000000000000radeontop-1.2/translations/Makefile000066400000000000000000000004661347515157400175520ustar00rootroot00000000000000INSTALL ?= install MSGFMT ?= msgfmt src = $(wildcard *.po) obj = $(src:.po=.mo) inst = $(src:.po=.inst) .PHONY: all install all: $(obj) $(obj): $(src) %.mo: %.po $(MSGFMT) -o $@ $< %.inst: %.mo $(INSTALL) -D -m 644 $< $(DESTDIR)/$(PREFIX)/share/locale/$*/LC_MESSAGES/radeontop.mo install: all $(inst) radeontop-1.2/translations/radeontop.pot000066400000000000000000000103331347515157400206230ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the radeontop package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: radeontop\n" "Report-Msgid-Bugs-To: \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 \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: detect.c:39 msgid "Failed to init pciaccess" msgstr "" #: detect.c:69 msgid "Can't find Radeon cards" msgstr "" #: detect.c:76 msgid "Can't get the register area size" msgstr "" #: detect.c:102 #, c-format msgid "Forcing the /dev/mem path.\n" msgstr "" #: detect.c:108 msgid "Cannot access GPU registers, are you root?" msgstr "" #: detect.c:112 msgid "mmap failed" msgstr "" #: detect.c:118 #, c-format msgid "Failed to open DRM node, no VRAM support.\n" msgstr "" #: detect.c:131 #, c-format msgid "Kernel too old for VRAM reporting.\n" msgstr "" #: 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: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 "" #: 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:51 #, c-format msgid "line limit %u.\n" msgstr "" #: dump.c:53 msgid "until termination." msgstr "" #: dump.c:63 msgid "Can't open file for writing." msgstr "" #: radeontop.c:35 #, c-format msgid "" "\n" "\tRadeonTop for R600 and above.\n" "\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 (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:159 msgid "Unknown Radeon card. <= R500 won't work, new cards might." msgstr "" #: ui.c:82 #, c-format msgid "Collecting data, please wait....\n" msgstr "" #: ui.c:118 #, c-format msgid "radeontop %s, running on %s bus %02x, %u samples/sec" msgstr "" #: ui.c:159 #, c-format msgid "Graphics pipe %6.2f%%" msgstr "" #: ui.c:165 #, c-format msgid "Event Engine %6.2f%%" msgstr "" #: ui.c:172 #, c-format msgid "Vertex Grouper + Tesselator %6.2f%%" msgstr "" #: ui.c:180 #, c-format msgid "Texture Addresser %6.2f%%" msgstr "" #: ui.c:185 #, c-format msgid "Texture Cache %6.2f%%" msgstr "" #: ui.c:194 #, c-format msgid "Shader Export %6.2f%%" msgstr "" #: ui.c:197 #, c-format msgid "Sequencer Instruction Cache %6.2f%%" msgstr "" #: ui.c:200 #, c-format msgid "Shader Interpolator %6.2f%%" msgstr "" #: ui.c:205 #, c-format msgid "Shader Memory Exchange %6.2f%%" msgstr "" #: ui.c:213 #, c-format msgid "Scan Converter %6.2f%%" msgstr "" #: ui.c:216 #, c-format msgid "Primitive Assembly %6.2f%%" msgstr "" #: ui.c:223 #, c-format msgid "Depth Block %6.2f%%" msgstr "" #: ui.c:226 #, c-format msgid "Color Block %6.2f%%" msgstr "" #: ui.c:231 #, c-format msgid "Clip Rectangle %6.2f%%" msgstr "" #: 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 "" radeontop-1.2/translations/ru.po000066400000000000000000000115001347515157400170670ustar00rootroot00000000000000# Russian translation for radeontop # Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 # This file is distributed under the same license as the radeontop package. # FIRST AUTHOR , 2012. # msgid "" msgstr "" "Project-Id-Version: radeontop\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2012-07-11 15:00+0300\n" "PO-Revision-Date: 2013-12-07 13:32+0000\n" "Last-Translator: Nikoli \n" "Language-Team: Russian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2013-12-07 14:24+0000\n" "X-Generator: Launchpad (build 16869)\n" #: detect.c:26 msgid "Failed to init pciaccess" msgstr "Не удалось инициализировать pciaccess" #: detect.c:53 msgid "Can't find Radeon cards" msgstr "Не удалось найти карты Radeon" #: detect.c:55 msgid "Can't get the register area size" msgstr "Не удалось получить размер register area" #: detect.c:60 msgid "Can't open /dev/mem, are you root?" msgstr "Не удалось открыть /dev/mem, имеете ли вы права root?" #: detect.c:64 msgid "mmap failed" msgstr "mmap не удался" #: dump.c:44 #, c-format msgid "Dumping to %s, " msgstr "Сбрасываем в %s, " #: dump.c:47 #, c-format msgid "line limit %u.\n" msgstr "ограничение строк %u.\n" #: dump.c:49 msgid "until termination." msgstr "до завершения." #: dump.c:59 msgid "Can't open file for writing." msgstr "Не удалось открыть файл для записи." #: radeontop.c:37 #, c-format msgid "" "\n" "\tRadeonTop for R600 and above.\n" "\n" "\tUsage: %s [-ch] [-b bus] [-d file] [-l limit] [-t ticks]\n" "\n" "-b --bus 3\t\tPick card from this PCI bus\n" "-c --color\t\tEnable colors\n" "-d --dump file\t\tDump data to this file, - for stdout\n" "-l --limit 3\t\tQuit after dumping N lines, default forever\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 "" "\n" "\tRadeonTop для r600 и выше.\n" "\n" "\tИспользование: %s [-ch] [-b шина] [-d файл] [-l лимит] [-t тики]\n" "\n" "-b --bus 3\t\tВыбрать видеокарту на этой PCI шине\n" "-c --color\t\tВключить цвета\n" "-d --dump file\t\tСбросить данные в файл, - для стандартного вывода\n" "-l --limit 3\t\tВыйти после сброса N строк, по-умолчанию бесконечно\n" "-t --ticks 50\t\tСэмплов в секунду (по-умолчанию %u)\n" "\n" "-h --help\t\tПоказать помощь\n" "-v --version\t\tПоказать версию\n" #: radeontop.c:122 msgid "Unknown Radeon card. <= R500 won't work, new cards might." msgstr "" "Неизвестная видеокарта Radeon. <= R500 не будут работать, новые могут." #: ui.c:71 #, c-format msgid "Collecting data, please wait....\n" msgstr "Сбор данных, пожалуйста, ждите....\n" #: ui.c:101 #, c-format msgid "radeontop %s, running on %s, %u samples/sec" msgstr "radeontop %s запущен на %s, %u сэмплов/сек" #: ui.c:133 #, c-format msgid "Graphics pipe %6.2f%%" msgstr "Графический канал %6.2f%%" #: ui.c:139 #, c-format msgid "Event Engine %6.2f%%" msgstr "Обработка событий %6.2f%%" #: ui.c:146 #, c-format msgid "Vertex Grouper + Tesselator %6.2f%%" msgstr "Вертексный группировщик + Тесселятор %6.2f%%" #: ui.c:154 #, c-format msgid "Texture Addresser %6.2f%%" msgstr "Адрессовщик текстур %6.2f%%" #: ui.c:159 #, c-format msgid "Texture Cache %6.2f%%" msgstr "Кэш текстур %6.2f%%" #: ui.c:168 #, c-format msgid "Shader Export %6.2f%%" msgstr "Экспорт шейдеров %6.2f%%" #: ui.c:171 #, c-format msgid "Sequencer Instruction Cache %6.2f%%" msgstr "Кэш секвенсора инструкций %6.2f%%" #: ui.c:174 #, c-format msgid "Shader Interpolator %6.2f%%" msgstr "Интерполятор шейдеров %6.2f%%" #: ui.c:179 #, c-format msgid "Shader Memory Exchange %6.2f%%" msgstr "Обмен шейдерной памяти %6.2f%%" #: ui.c:187 #, c-format msgid "Scan Converter %6.2f%%" msgstr "Конвертер сканирования %6.2f%%" #: ui.c:190 #, c-format msgid "Primitive Assembly %6.2f%%" msgstr "Сборщик примитивов %6.2f%%" #: ui.c:197 #, c-format msgid "Depth Block %6.2f%%" msgstr "Блок глубины %6.2f%%" #: ui.c:200 #, c-format msgid "Color Block %6.2f%%" msgstr "Блок цвета %6.2f%%" #: ui.c:205 #, c-format msgid "Clip Rectangle %6.2f%%" msgstr "Обрезка прямоугольников %6.2f%%" radeontop-1.2/ui.c000066400000000000000000000163301347515157400141470ustar00rootroot00000000000000/* Copyright (C) 2012 Lauri Kasanen 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, version 3 of the License. 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 . */ #include "radeontop.h" #include #include static void printcenter(const unsigned int y, const unsigned int width, const char * const fmt, ...) { char *ptr; va_list ap; va_start(ap, fmt); #ifdef ENABLE_NLS vasprintf(&ptr, fmt, ap); const unsigned int len = mbstowcs(NULL, ptr, 0); #else const unsigned int len = vasprintf(&ptr, fmt, ap); #endif unsigned x = (width - len)/2; if (len > width) x = 0; mvprintw(y, x, "%s", ptr); va_end(ap); free(ptr); } static void printright(const unsigned int y, const unsigned int width, const char * const fmt, ...) { char *ptr; va_list ap; va_start(ap, fmt); #ifdef ENABLE_NLS vasprintf(&ptr, fmt, ap); const unsigned int len = mbstowcs(NULL, ptr, 0); #else const unsigned int len = vasprintf(&ptr, fmt, ap); #endif unsigned x = (width - len); if (len > width) x = 0; mvprintw(y, x, "%s", ptr); va_end(ap); free(ptr); } static void percentage(const unsigned int y, const unsigned int w, const float p) { const unsigned int x = (w/2) + 2; unsigned int len = w - x - 1; len = len * (p / 100.0); attron(A_REVERSE); mvhline(y, x, ' ', len); attroff(A_REVERSE); } 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")); // This does not need to be atomic. A delay here is acceptable. while(!results) usleep(16000); initscr(); noecho(); halfdelay(10); curs_set(0); clear(); start_color(); init_pair(1, COLOR_GREEN, COLOR_BLACK); init_pair(2, COLOR_RED, COLOR_BLACK); init_pair(3, COLOR_CYAN, COLOR_BLACK); init_pair(4, COLOR_MAGENTA, COLOR_BLACK); init_pair(5, COLOR_YELLOW, COLOR_BLACK); const unsigned int bigh = 23; // Screen dimensions. (Re)calculated only when resize is non-zero. unsigned int h = 1, w = 1, hw = 1; int resize = 1; while(1) { if (resize) { resize = 0; getmaxyx(stdscr, h, w); hw = w/2; } //draw the header move(0,0); attron(A_REVERSE); mvhline(0, 0, ' ', w); printcenter(0, w, _("radeontop %s, running on %s bus %02x, %u samples/sec"), VERSION, card, bus, ticks); attroff(A_REVERSE); move(1,0); clrtobot(); // Again, no need to protect these. Worst that happens is a slightly // wrong number. 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.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); mvaddch(3, (w/2) + 1, ACS_PLUS); if (color) attron(COLOR_PAIR(1)); percentage(2, w, gui); printright(2, hw, _("Graphics pipe %6.2f%%"), gui); if (color) attroff(COLOR_PAIR(1)); unsigned int start = 4; percentage(start, w, ee); printright(start++, hw, _("Event Engine %6.2f%%"), ee); // Enough height? if (h > bigh) start++; if (color) attron(COLOR_PAIR(2)); percentage(start, w, vgt); printright(start++, hw, _("Vertex Grouper + Tesselator %6.2f%%"), vgt); if (color) attroff(COLOR_PAIR(2)); // Enough height? if (h > bigh) start++; if (color) attron(COLOR_PAIR(3)); percentage(start, w, ta); printright(start++, hw, _("Texture Addresser %6.2f%%"), ta); // This is only present on R600 if (bits.tc) { percentage(start, w, tc); printright(start++, hw, _("Texture Cache %6.2f%%"), tc); } if (color) attroff(COLOR_PAIR(3)); // Enough height? if (h > bigh) start++; if (color) attron(COLOR_PAIR(4)); percentage(start, w, sx); printright(start++, hw, _("Shader Export %6.2f%%"), sx); percentage(start, w, sh); printright(start++, hw, _("Sequencer Instruction Cache %6.2f%%"), sh); percentage(start, w, spi); printright(start++, hw, _("Shader Interpolator %6.2f%%"), spi); // only on R600 if (bits.smx) { percentage(start, w, smx); printright(start++, hw, _("Shader Memory Exchange %6.2f%%"), smx); } if (color) attroff(COLOR_PAIR(4)); // Enough height? if (h > bigh) start++; percentage(start, w, sc); printright(start++, hw, _("Scan Converter %6.2f%%"), sc); percentage(start, w, pa); printright(start++, hw, _("Primitive Assembly %6.2f%%"), pa); // Enough height? if (h > bigh) start++; if (color) attron(COLOR_PAIR(5)); percentage(start, w, db); printright(start++, hw, _("Depth Block %6.2f%%"), db); percentage(start, w, cb); printright(start++, hw, _("Color Block %6.2f%%"), cb); // Only present on R600 if (bits.cr) { percentage(start, w, cr); printright(start++, hw, _("Clip Rectangle %6.2f%%"), cr); } if (color) attroff(COLOR_PAIR(5)); 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 move(0,0); refresh(); int c = getch(); if (c == 'q' || c == 'Q') break; if (c == 'c' || c == 'C') color = !color; if (c == KEY_RESIZE) resize = 1; } endwin(); }