g15stats-1.9.2/0000777000000000000000000000000011222743734011705 5ustar rootrootg15stats-1.9.2/config/0000777000000000000000000000000011222743533013147 5ustar rootrootg15stats-1.9.2/AUTHORS0000644000175100001440000000024111212573005013106 0ustar artausersMike Lampard Antonio Bartolini - patch for relative scaling of net graph. Piotr Czarnecki g15stats-1.9.2/COPYING0000644000175100001440000004312211205046533013101 0ustar artausers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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. 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 convey 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This 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 Library General Public License instead of this License. g15stats-1.9.2/ChangeLog0000644000175100017530000000556511231710637013430 0ustar artaarta0.1 Initial release 1.0 - Change net scale from absolute to relative, with option to revert to absolute (-nsa --net-scale-absolute). SVN: - Improve response time when switching screens. - Battery status monitoring courtesy of Pieter De Wit - Detect if Network interface is incorrect and disable netscreen. Resolves 100% cpu issue reported by Guy Dierx. SVN 504: - Bottom row information rotation switched with the L5 key - 3 additional CPU graph variants switched with the L4 key (at this moment for multi core processors only) - New default CPU Screen (at this moment for multi core processors only) - Display unicore graphs only on the CPU screen with the option -u (--unicore) SVN 505: - Bugfix: Render bottom line on the Memory Screen once SVN 509: - Temperature sensors depends on the lmsensors sysfs filesystem SVN 510: - Temperature sensor's autodetect - Force user sensor id with the option -s id (The id should point to sysfs path /sys/class/hwmon/hwmon[id]/device/temp1_input) SVN 511: - Improve sensor's autodetect - Clean up SVN 512: - CPU Screens variants for uni core processors - CPU frequency info (if available) - Battery Screen is enabled if available - Clean up SVN 513: - Improve bottom line and keywatch logic SVN 514: - Many fixes, clean up - Changed version to 1.90 - CPU Frequency use proper sysfs variable - New Summary Screen indicators - Network current traffic info in the bottom line - Refactor CPU variants into separates additional screens: Summary, CPU and CPU Freq. - New Fan Speed Screen - After change screen cycle the info bar content is set to the screen default one. - Net Screen scaling is now controlled with the L4 key - Force start temperature sensor id with the option -t id (The id should point to sysfs path /sys/class/hwmon/hwmon[id]/...) - Force start fan speed sensor id with the option -f id (The id should point to sysfs path /sys/class/hwmon/hwmon[id]/...) - Force to show temperature [id] in place of the maximal one on the Summary Screen with the option ie -gt 1 (the id should point to sysfs path /sys/class/hwmon/hwmon../device/temp[id]_input) - On the Fan / Temp Screen Current sensor is controlled with the L4 key (on systems with more then one sensor only). - Every Screen has his own mode now (except Swap, Memory and Battery Screen) SVN 515 (1.90): - Fixed temperature / fan sensor lost - Fixed screen cycle SVN 516: - Refactored temperature and fan speed - share the logic SVN 517: - Improve Bat Screen deactivation logic (now is it similar to SVN 515: Fixed temperature / fan sensor lost) SVN 518 (1.91): - Fix Summary, Freq and CPU Screens for some variants of the cpu cores number - Improve Summary Screen SVN 519 - Change default mode for Freq and Summary Screen - Improve Summary Screen for cpus with more then 7 cores SVN 520 (1.9.2) - Disable monitoring CPUs frequencies with the option -df - Improve Summary Screen without CPUs frequencies g15stats-1.9.2/INSTALL0000644000175100001440000002231011205046533013073 0ustar artausersInstallation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. g15stats-1.9.2/Makefile.am0000644000175100001440000000056311205046533014104 0ustar artausers AM_CFLAGS = -O3 -Wall @CFLAGS@ -I$(top_builddir) -I$(top_srcdir) METASOURCES = AUTO bin_PROGRAMS = g15stats noinst_HEADERS = g15stats.h docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION) doc_DATA = README ChangeLog AUTHORS NEWS COPYING LIBS = -lg15daemon_client -lg15render IMCLUDES = -I g15stats_LDFLAGS = -avoid-version g15stats_SOURCES = g15stats.c g15stats.h g15stats-1.9.2/NEWS0000644000175100001440000000000011205046533012531 0ustar artausersg15stats-1.9.2/README0000644000175100001440000000422411231411274012723 0ustar artausersG15Stats - a CPU/Memory/Swap/Network/Battery/Temperature/Fan Speed/CPU Frequencies usage meter for G15Daemon. The G15Stats requires libgtop development packages to be installed before compilation. Features: Summary Screen displays 4 or 5 indicators from CPU/Frequency/Memory/NET/Temperature/Fan Speed/Swap, along with current time. CPU Screen displays graphs of User/System/Nice and Idle time, along with LoadAVG and Uptime. Frequency Screen displays all CPU cores frequency with the total Memory Screen displays Memory Total & Free, and graph of Used vs Buffered+Cached Memory. Swap Screen displays Used, Free and Total swap space, along with the number of pages currently paged in/out. Network Screen displays Total bytes In/Out, history graph, Peak speed. Battery Status Screen displays battery charge data for up to three batteries Temperature Screen displays temperature status for available sensors Fan Speed Screen displays fan current speed for the available sensors Options: -i interface Gather statistics from named interface (ie -i eth0) -d Run in background (daemonise) -nsa Scale network graphs against highest speed recorded. The default is to scale against the highest peak in the current graph. -h Show help -u Display unicore graphs only on the CPU screen -t id Force to monitor temperature sensor id on start (ie -t 1) The id should point to sysfs path /sys/class/hwmon/hwmon[id]/device/temp1_input Default the sensor id is auto-detected. -f id Force to monitor fan speed sensor id on start (ie -f 1) The id should point to sysfs path /sys/class/hwmon/hwmon[id]/device/fan1_input Default the sensor id is auto-detected. -gt id Show temperature [id] in place of the maximal one on the Summary Screen with the option -gt id ie -gt 1 The id should point to sysfs path /sys/class/hwmon/hwmon../device/temp[id]_input -df Disable monitoring CPUs frequencies. Usage: $> g15stats Once running, the separate screens can be switched to as follows: L2: Previous Screen L3: Next Screen L4: Alternative Screen (Doesn't work on Swap, Memory and Battery Screen) L5: Bottom Info bar mode BUGS: none currently known. g15stats-1.9.2/autogen.sh0000755000175100001440000000021711205046533014045 0ustar artausers#! /bin/sh [ -d config ] || mkdir config set -x aclocal -I config libtoolize --force --copy autoheader automake --add-missing --copy autoconf g15stats-1.9.2/g15stats.c0000644000175100017530000017165511231710657013503 0ustar artaarta/* This file is part of g15daemon. g15daemon 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 of the License, or (at your option) any later version. g15daemon 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 g15daemon; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA (c) 2008-2009 Mike Lampard $Revision: 520 $ - $Date: 2009-07-23 00:24:45 +0200 (Thu, 23 Jul 2009) $ $Author: czarnyckm $ This daemon listens on localhost port 15550 for client connections, and arbitrates LCD display. Allows for multiple simultaneous clients. Client screens can be cycled through by pressing the 'L1' key. This is a simple stats client showing graphs for CPU, MEM & Swap usage, Network traffic, Temperatures, CPU Frequency and Battery life. */ #define _GNU_SOURCE 1 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "g15stats.h" int g15screen_fd; int cycle = 0; int info_cycle = 0; /** Holds the mode type variable of the application running */ int mode[MAX_SCREENS]; /** Holds the sub mode type variable of the application running */ int submode = 0; int info_cycle_timer = -1; // Summary Screen indicators count 4 or 5 int summary_rows = 4; int have_freq = 2; _Bool have_temp = 1; _Bool have_fan = 1; _Bool have_bat = 1; _Bool have_nic = 0; _Bool sensor_type_temp[MAX_SENSOR]; _Bool sensor_type_fan[MAX_SENSOR]; int sensor_lost_temp[MAX_SENSOR]; int sensor_lost_fan[MAX_SENSOR]; int sensor_lost_bat = 1; int sensor_temp_id = 0; int sensor_temp_main = 0; int sensor_fan_id = 0; /** Holds the number of the cpus */ int ncpu; unsigned int net_hist[MAX_NET_HIST][2]; int net_rr_index=0; unsigned long net_max_in = 100; unsigned long net_max_out = 100; unsigned long net_cur_in = 0; unsigned long net_cur_out = 0; float temp_tot_cur = 1; float temp_tot_max = 1; float fan_tot_cur = 1; float fan_tot_max = 1; _Bool net_scale_absolute=0; pthread_cond_t wake_now = PTHREAD_COND_INITIALIZER; unsigned long maxi(unsigned long a, unsigned long b) { if(a>b) return a; return b; } void format_float(char *tmpstr, char *format_less, char * format_great, float value){ if (value < 9.9) { sprintf(tmpstr,format_less,value); } else { sprintf(tmpstr,format_great,(unsigned long)value); } } char * show_bytes_short(unsigned long bytes) { static char tmpstr[32]; if(bytes>=1024*1024) { format_float(tmpstr, "%4.1fM","%4liM", (float)bytes / (1024*1024)); } else if(bytes >= 1024) { format_float(tmpstr, "%4.1fk","%4lik", (float)bytes / 1024); } else { sprintf(tmpstr,"%4liB",bytes); } return tmpstr; } char * show_bytes(unsigned long bytes) { static char tmpstr[32]; if(bytes>=1024*1024) { format_float(tmpstr, "%2.1fMB","%liMB", (float)bytes / (1024*1024)); } else if(bytes >= 1024) { format_float(tmpstr, "%2.1fkB","%likB", (float)bytes / 1024); } else { sprintf(tmpstr,"%liB",bytes); } return tmpstr; } char * show_hertz_logic(int hertz, char *hz) { static char tmpstr[32]; if (hertz >= 1000000) { format_float(tmpstr, "%3.1fG","%3.fG", (float)hertz / 1000000); } else if (hertz >= 1000) { format_float(tmpstr, "%3.1fM","%3liM", (float)hertz / 1000); } else { sprintf(tmpstr, "%3iK", hertz); } if (strlen((char *)hz) > 0) { strcat(tmpstr, hz); } return tmpstr; } char * show_hertz_short(int hertz) { return show_hertz_logic(hertz, ""); } char * show_hertz(int hertz) { return show_hertz_logic(hertz, "Hz"); } void print_vert_label_logic(g15canvas *canvas, char *label, unsigned int sx){ int i; int len =strlen((char *)label); if (len > 5) { len = 5; } int starty = 0; int incy = 0; switch (len){ case 6 : break; case 5 : starty = 0; break; case 4 : starty = 4; break; case 3 : starty = 3; incy = 4; break; default : return; } char val[2]; for (i=0; i max) num = max; if (type == 2) { y1 += 2; y2 -= 2; x1 += 2; x2 -= 2; } len = ((float) max / (float) num); length = (x2 - x1) / len; if (type == 1) { g15r_pixelBox (canvas, x1, y1 - type, x2, y2 + type, color ^ 1, 1, 1); g15r_pixelBox (canvas, x1, y1 - type, x2, y2 + type, color, 1, 0); } else if (type == 2) { g15r_pixelBox (canvas, x1 - 2, y1 - type, x2 + 2, y2 + type, color ^ 1, 1, 1); g15r_pixelBox (canvas, x1 - 2, y1 - type, x2 + 2, y2 + type, color, 1, 0); } else if (type == 3) { g15r_drawLine (canvas, x1, y1 - type, x1, y2 + type, color); g15r_drawLine (canvas, x2, y1 - type, x2, y2 + type, color); g15r_drawLine (canvas, x1, y1 + ((y2 - y1) / 2), x2, y1 + ((y2 - y1) / 2), color); } g15r_pixelBox (canvas, (int) ceil (x2-length), y1, x2, y2, color, 1, 1); if(type == 5) { int x; for(x=x2-2;x>(x2-length);x-=2) g15r_drawLine (canvas, x, y1, x, y2, color^1); } } void drawBar_both(g15canvas *canvas, int y1, int y2, int bar_current, int bar_total, int rbar_current, int rbar_total) { g15r_drawBar(canvas, BAR_START, y1, BAR_END, y2, G15_COLOR_BLACK, bar_current, bar_total, 4); drawBar_reversed(canvas, BAR_START, y1, BAR_END, y2, G15_COLOR_BLACK, rbar_current, rbar_total, 5); } void drawLine_both(g15canvas *canvas, int y1, int y2) { g15r_drawLine(canvas, VL_LEFT, y1, VL_LEFT, y2, G15_COLOR_BLACK); g15r_drawLine(canvas, VL_LEFT + 1, y1, VL_LEFT + 1, y2, G15_COLOR_BLACK); } void drawAll_both(g15canvas *canvas, int y1, int y2, int bar_current, int bar_total, int rbar_current, int rbar_total) { drawBar_both(canvas, y1, y2, bar_current, bar_total, rbar_current, rbar_total); drawLine_both(canvas, y1, y2); } int daemonise(int nochdir, int noclose) { pid_t pid; if(nochdir<1) chdir("/"); pid = fork(); switch(pid){ case -1: printf("Unable to daemonise!\n"); return -1; break; case 0: { umask(0); if(setsid()==-1) { perror("setsid"); return -1; } if(noclose<1) { freopen( "/dev/null", "r", stdin); freopen( "/dev/null", "w", stdout); freopen( "/dev/null", "w", stderr); } break; } default: _exit(0); } return 0; } void init_cpu_count(void) { // initialize cpu count once if (!ncpu) { const glibtop_sysinfo *cpuinfo = glibtop_get_sysinfo(); if(cpuinfo->ncpu == 0) { ncpu = 1; } else { ncpu = cpuinfo->ncpu; } } } int get_sysfs_value(char *filename) { int ret_val = -1; FILE *fd_main; static char tmpstr [MAX_LINES]; fd_main = fopen(filename, "r"); if (fd_main != NULL) { if (fgets(tmpstr, MAX_LINES, fd_main) != NULL) { fclose(fd_main); ret_val = atoi(tmpstr); } else fclose(fd_main); } else { ret_val = SENSOR_ERROR; } return ret_val; } int get_processor_freq(char *which, int core) { static char tmpstr [MAX_LINES]; sprintf(tmpstr, "/sys/devices/system/cpu/cpu%d/cpufreq/%s", core, which); return get_sysfs_value(tmpstr); } int get_cpu_freq_cur(int core) { int ret_val; switch (have_freq) { case 2: ret_val = get_processor_freq("scaling_cur_freq", core); break; default: ret_val = get_processor_freq("cpuinfo_%d_freq", core); break; } if ((!core) && (ret_val == SENSOR_ERROR)) { have_freq--; if (have_freq < 0) { have_freq = 0; } printf("Frequency sensor doesn't appear to exist for core=%d . ", core); } return ret_val; } int get_cpu_freq_max(int core) { return get_processor_freq("cpuinfo_max_freq", core); } int get_cpu_freq_min(int core) { return get_processor_freq("cpuinfo_min_freq", core); } int get_hwmon(int sensor_id, char *sensor, char *which, int id, _Bool sensor_type) { char tmpstr [MAX_LINES]; if(sensor_type) { sprintf(tmpstr, "/sys/class/hwmon/hwmon%d/device/%s%d_%s", sensor_id, sensor, id, which); } else { sprintf(tmpstr, "/sys/class/hwmon/hwmon%d/%s%d_%s", sensor_id, sensor, id, which); } return get_sysfs_value(tmpstr); } int get_sensor_cur(int id, int screen_id) { if (screen_id == SCREEN_TEMP) { return get_hwmon(sensor_temp_id, "temp", "input", id, sensor_type_temp[sensor_temp_id]); } else { return get_hwmon(sensor_fan_id, "fan", "input", id, sensor_type_fan[sensor_fan_id]); } } int get_sensor_max(int id, int screen_id) { if (screen_id == SCREEN_TEMP) { return get_hwmon(sensor_temp_id, "temp", "max", id, sensor_type_temp[sensor_temp_id]); } else { return get_hwmon(sensor_fan_id, "fan", "alarm", id, sensor_type_fan[sensor_fan_id]); } } int get_next(int sensor_id, int *sensor_lost){ int new_sensor_id; new_sensor_id = sensor_id; do { new_sensor_id++; if (new_sensor_id >= MAX_SENSOR) { new_sensor_id = 0; } if (sensor_lost[new_sensor_id]){ return new_sensor_id; } } while(sensor_id != new_sensor_id); return SENSOR_ERROR; } int get_sensors(g15_stats_info *sensors, int screen_id, _Bool *sensor_type, int *sensor_lost, int sensor_id) { char label[16]; int count = 0; if (screen_id == SCREEN_TEMP) { temp_tot_cur = 0; sprintf(label, "Temperature"); } else { //SCREEN_FAN fan_tot_cur = 0; sprintf(label, "Fan"); } for (count = 0; count < NUM_PROBES; count++) { if ((sensors[count].cur = get_sensor_cur(count + 1, screen_id)) == SENSOR_ERROR) { break; } sensors[count].max = get_sensor_max(count + 1, screen_id); if (screen_id == SCREEN_TEMP) { sensors[count].cur /= 1000; sensors[count].max /= 1000; if (temp_tot_max < sensors[count].max) { temp_tot_max = sensors[count].max; } if ((sensor_temp_main == (count +1)) || ((!sensor_temp_main) && (temp_tot_cur < sensors[count].cur))) { temp_tot_cur = sensors[count].cur; } } else { //SCREEN_FAN if (fan_tot_cur = NUM_PROBES) { count = NUM_PROBES; } else if(sensors[count].cur != SENSOR_ERROR) { count++; } return count; } void print_sys_load_info(g15canvas *canvas, char *tmpstr) { glibtop_loadavg loadavg; glibtop_uptime uptime; glibtop_get_loadavg(&loadavg); glibtop_get_uptime(&uptime); float minutes = uptime.uptime/60; float hours = minutes/60; float days = 0.0; if(hours>24) days=(int)(hours/24); if(days) hours=(int)hours-(days*24); sprintf(tmpstr,"LoadAVG %.2f %.2f %.2f | Uptime %.fd%.fh",loadavg.loadavg[0],loadavg.loadavg[1],loadavg.loadavg[2],days,hours); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } void print_mem_info(g15canvas *canvas, char *tmpstr) { glibtop_mem mem; glibtop_get_mem(&mem); sprintf(tmpstr,"Memory Used %dMB | Memory Total %dMB",(unsigned int)((mem.buffer+mem.cached+mem.user)/(1024*1024)),(unsigned int)(mem.total/(1024*1024))); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } void print_swap_info(g15canvas *canvas, char *tmpstr) { glibtop_swap swap; glibtop_get_swap(&swap); sprintf(tmpstr,"Swap Used %dMB | Swap Avail. %dMB",(unsigned int)(swap.used/(1024*1024)),(unsigned int)(swap.total/(1024*1024))); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } void print_net_peak_info(g15canvas *canvas, char *tmpstr) { sprintf(tmpstr,"Peak IN %s/s|",show_bytes(net_max_in)); strcat(tmpstr,"Peak OUT "); strcat(tmpstr,show_bytes(net_max_out)); strcat(tmpstr,"/s"); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } void print_net_current_info(g15canvas *canvas, char *tmpstr) { sprintf(tmpstr,"Current IN %s/s|",show_bytes(net_cur_in)); strcat(tmpstr,"Current OUT "); strcat(tmpstr,show_bytes(net_cur_out)); strcat(tmpstr,"/s"); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } void print_freq_info(g15canvas *canvas, char *tmpstr) { char proc[12]; int core; init_cpu_count(); sprintf(tmpstr, "%s", ""); for (core = 0; (core < ncpu) && (core < 6); core++) { sprintf(proc, "C%d ", core); strcat(tmpstr,proc); if (ncpu < 5) { strcat(tmpstr, show_hertz(get_cpu_freq_cur(core))); } else { strcat(tmpstr, show_hertz_short(get_cpu_freq_cur(core))); } if ((core + 1) < ncpu) { strcat(tmpstr, "|"); } } g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_SMALL, 80 - (strlen(tmpstr)*4) / 2, INFO_ROW); } void print_time_info(g15canvas *canvas, char *tmpstr){ time_t now; time(&now); sprintf(tmpstr,"%s",ctime(&now)); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } void draw_mem_screen(g15canvas *canvas, char *tmpstr) { glibtop_mem mem; glibtop_get_mem(&mem); int mem_total = mem.total / 1024; int mem_free = mem.free / 1024; int mem_user = mem.user / 1024; int mem_buffer = mem.buffer / 1024; int mem_cached = mem.cached / 1024; g15r_clearScreen (canvas, G15_COLOR_WHITE); sprintf(tmpstr,"Usr %2.f%%",((float)mem_user/(float)mem_total)*100); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, TEXT_LEFT, 2); sprintf(tmpstr,"Buf %2.f%%",((float)mem_buffer/(float)mem_total)*100); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, TEXT_LEFT, 14); sprintf(tmpstr,"Che %2.f%%",((float)mem_cached/(float)mem_total)*100); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, TEXT_LEFT, 26); g15r_drawBar(canvas,BAR_START,1,BAR_END,10,G15_COLOR_BLACK,mem_user,mem_total,4); g15r_drawBar(canvas,BAR_START,12,BAR_END,21,G15_COLOR_BLACK,mem_buffer,mem_total,4); g15r_drawBar(canvas,BAR_START,23,BAR_END,BAR_BOTTOM,G15_COLOR_BLACK,mem_cached,mem_total,4); drawBar_reversed(canvas,BAR_START,1,BAR_END,BAR_BOTTOM,G15_COLOR_BLACK,mem_free,mem_total,5); drawLine_both(canvas, 1, BAR_BOTTOM); print_vert_label(canvas, "FREE"); } void draw_swap_screen(g15canvas *canvas, char *tmpstr) { glibtop_swap swap; g15r_clearScreen (canvas, G15_COLOR_WHITE); glibtop_get_swap(&swap); int swap_used = swap.used / 1024; int swap_total = swap.total / 1024; g15r_renderString (canvas, (unsigned char*)"Swap", 0, G15_TEXT_MED, TEXT_LEFT, 9); sprintf(tmpstr,"Used %i%%",(unsigned int)(((float)swap_used/(float)swap_total)*100)); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, TEXT_LEFT, 19); drawAll_both(canvas, 1, BAR_BOTTOM, swap_used, swap_total, swap_total-swap_used, swap_total); print_vert_label(canvas, "FREE"); } void print_label(g15canvas *canvas, char *tmpstr, int cur_shift) { g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_MED, TEXT_LEFT, cur_shift + 1); } void draw_summary_sensors_logic(g15canvas *canvas, char *tmpstr, g15_stats_info *sensors, char *label, int text_shift, int y1, int y2, int move, int cur_shift, int shift, int count, float tot_cur, float tot_max) { if (count) { int j = 0; int rest; int step = (int) (y2 / count); rest = y2 - (step * count); int y = cur_shift + y1; int last_y; for (j = 0; j < count; j++) { last_y = y; y += step; if (rest > 0) { rest--; y++; } drawBar_both(canvas, last_y + move, y + move, sensors[j].cur + 1, tot_max, tot_max - sensors[j].cur, tot_max); } drawLine_both(canvas, cur_shift + y1 + move, y + move); sprintf(tmpstr, label, tot_cur); print_label(canvas, tmpstr, text_shift); } } void draw_summary_screen(g15canvas *canvas, char *tmpstr, int y1, int y2, int move, int shift, int text_shift, int id) { // Memory section glibtop_mem mem; glibtop_get_mem(&mem); int mem_total = (mem.total / 1024); int mem_used = mem_total - (mem.free / 1024); int cur_shift = shift * id; if (summary_rows > 4){ if (shift > 7) { if (id == 2) { y2 = 4; shift = 6; } else { y2 = 5; shift = 7; } } } int y; int count; // Memory section sprintf(tmpstr, "MEM %3.f%%", ((float) (mem_used) / (float) mem_total)*100); print_label(canvas, tmpstr, text_shift * id); drawAll_both(canvas, cur_shift + y1 + move, cur_shift + y2 + move, mem_used + 1, mem_total, mem_total - mem_used, mem_total); id++; cur_shift += shift; // Network section if (have_nic) { y = y2 / 2; drawLine_both(canvas, cur_shift + y1 + move, cur_shift + y2 + move); drawBar_both(canvas, cur_shift + y1 + move, cur_shift + y + move, net_cur_in + 1, net_max_in, net_max_in - net_cur_in, net_max_in); drawBar_both(canvas, cur_shift + y + move, cur_shift + y2 + move, net_cur_out + 1, net_max_out, net_max_out - net_cur_out, net_max_out); if (net_cur_in > net_cur_out) { sprintf(tmpstr, "IN %s", show_bytes_short((int) net_cur_in)); } else { sprintf(tmpstr, "OUT%s", show_bytes_short((int) net_cur_out)); } print_label(canvas, tmpstr, text_shift * id); id++; cur_shift += shift; } if ((have_temp) || (have_fan)) { g15_stats_info sensors[NUM_PROBES]; // Temperature section if ((have_temp) && (id < summary_rows)) { count = get_sensors(sensors, SCREEN_TEMP, sensor_type_temp, sensor_lost_temp, sensor_temp_id); if ((count) && (have_temp)) { draw_summary_sensors_logic(canvas, tmpstr, sensors, "TEM %3.f\xb0", text_shift * id, y1, y2, move, cur_shift, shift, count, temp_tot_cur, temp_tot_max); id++; cur_shift += shift; } } // Fan section if ((have_fan) && (id < summary_rows)) { count = get_sensors(sensors, SCREEN_FAN, sensor_type_fan, sensor_lost_fan, sensor_fan_id); if ((count) && (have_fan)) { draw_summary_sensors_logic(canvas, tmpstr, sensors, "RPM%5.f", text_shift * id, y1, y2, move, cur_shift, shift, count, fan_tot_cur, fan_tot_max); id++; cur_shift += shift; } } } // Swap section if (id < summary_rows) { glibtop_swap swap; glibtop_get_swap(&swap); int swap_used = swap.used / 1024; int swap_total = swap.total / 1024; drawAll_both(canvas, cur_shift + y1 + move, cur_shift + y2 + move, swap_used, swap_total, swap_total - swap_used, swap_total); sprintf(tmpstr, "Swp %3i%%", (unsigned int) (((float) swap_used / (float) swap_total)*100)); print_label(canvas, tmpstr, text_shift * id); id++; cur_shift += shift; } } /* draw cpu screen. if drawgraph = 0 then no graph is drawn */ void draw_cpu_screen_unicore_logic(g15canvas *canvas, glibtop_cpu cpu, char *tmpstr, int drawgraph, int printlabels, int cpuandmemory) { int total,user,nice,sys,idle; int b_total,b_user,b_nice,b_sys,b_idle,b_irq,b_iowait; static int last_total,last_user,last_nice,last_sys,last_idle,last_iowait,last_irq; g15r_clearScreen (canvas, G15_COLOR_WHITE); total = ((unsigned long) cpu.total) ? ((double) cpu.total) : 1.0; user = ((unsigned long) cpu.user) ? ((double) cpu.user) : 1.0; nice = ((unsigned long) cpu.nice) ? ((double) cpu.nice) : 1.0; sys = ((unsigned long) cpu.sys) ? ((double) cpu.sys) : 1.0; idle = ((unsigned long) cpu.idle) ? ((double) cpu.idle) : 1.0; b_total = total - last_total; b_user = user - last_user; b_nice = nice - last_nice; b_sys = sys - last_sys; b_idle = idle - last_idle; b_irq = cpu.irq - last_irq; b_iowait= cpu.iowait - last_iowait; last_total = total; last_user = user; last_nice = nice; last_sys = sys; last_idle = idle; last_irq = cpu.irq; last_iowait = cpu.iowait; if(printlabels) { sprintf(tmpstr,"Usr %2.f%%",((float)b_user/(float)b_total)*100); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, 1, 2); sprintf(tmpstr,"Sys %2.f%%",((float)b_sys/(float)b_total)*100); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, 1, 14); sprintf(tmpstr,"Nce %2.f%%",((float)b_nice/(float)b_total)*100); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, 1, 26); } if(drawgraph) { g15r_drawBar(canvas,BAR_START,1,BAR_END,10,G15_COLOR_BLACK,b_user+1,b_total,4); g15r_drawBar(canvas,BAR_START,12,BAR_END,21,G15_COLOR_BLACK,b_sys+1,b_total,4); g15r_drawBar(canvas,BAR_START,23,BAR_END,BAR_BOTTOM,G15_COLOR_BLACK,b_nice+1,b_total,4); drawBar_reversed(canvas,BAR_START,1,BAR_END,BAR_BOTTOM,G15_COLOR_BLACK,b_idle+1,b_total,5); drawLine_both(canvas, 1, BAR_BOTTOM); } if (cpuandmemory) { print_vert_label(canvas, "TOTAL"); sprintf(tmpstr,"CPU %3.f%%",((float)(b_total-b_idle)/(float)b_total)*100); print_label(canvas, tmpstr, 0); } else if ((cycle == SCREEN_FREQ) && (mode[SCREEN_FREQ]) && (have_freq)) { print_vert_label(canvas, "FREQ"); } else { print_vert_label(canvas, "Idle"); } } void draw_cpu_screen_unicore(g15canvas *canvas, char *tmpstr, int drawgraph, int printlabels) { glibtop_cpu cpu; glibtop_get_cpu(&cpu); draw_cpu_screen_unicore_logic(canvas, cpu, tmpstr, drawgraph, printlabels, 0); } void draw_cpu_screen_multicore(g15canvas *canvas, char *tmpstr, int unicore) { glibtop_cpu cpu; int core,ncpumax; int divider = 0; int total,user,nice,sys,idle; int b_total,b_user,b_nice,b_sys,b_idle,b_irq,b_iowait; int sub_val; static int last_total[GLIBTOP_NCPU],last_user[GLIBTOP_NCPU],last_nice[GLIBTOP_NCPU], last_sys[GLIBTOP_NCPU],last_idle[GLIBTOP_NCPU],last_iowait[GLIBTOP_NCPU],last_irq[GLIBTOP_NCPU]; init_cpu_count(); ncpumax = ncpu; glibtop_get_cpu(&cpu); switch (cycle) { case SCREEN_SUMMARY : draw_cpu_screen_unicore_logic(canvas, cpu, tmpstr, 0, 0, 1); break; case SCREEN_CPU : if ((unicore) || (ncpu==1)) { draw_cpu_screen_unicore_logic(canvas, cpu, tmpstr, 1, 1, 0); return; } draw_cpu_screen_unicore_logic(canvas, cpu, tmpstr, 0, 1, 0); break; case SCREEN_FREQ : draw_cpu_screen_unicore_logic(canvas, cpu, tmpstr, 0, 0, 0); break; } int y1=0, y2=BAR_BOTTOM; int shift = 12; int shift2 = 24; int current_value=1; int freq_cur = 1, freq_total = 1; int freq_sum = 0; float result; int spacer = 1; int height = 9; int move = 0; switch (cycle) { case SCREEN_FREQ : if(ncpu > 11){ spacer = 0; } height = 36; break; case SCREEN_CPU : if(ncpu > 4){ spacer = 0; } height = 12; break; case SCREEN_SUMMARY : spacer = 0; if (!mode[SCREEN_SUMMARY]) { summary_rows = 5; switch (ncpu) { case 1 : case 2 : case 3 : case 5 : case 7 : move = 1; height = 6; break; default : height = 8; break; } } else { summary_rows = 4; switch (ncpu) { case 3 : case 5 : move = 1; break; } height = 8; } shift = height + 1; shift2 = (2 * shift); break; } ncpumax = height; if (ncpumax < ncpu) { height = (height - ((ncpumax - 1) * spacer)) / (ncpumax); } else { height = (height - ((ncpu - 1) * spacer)) / (ncpu); } if (height < 1) { height = 1; } for(core = 0; ((core < ncpu) && (core < ncpumax)); core++) { total = ((unsigned long) cpu.xcpu_total[core]) ? ((double) cpu.xcpu_total[core]) : 1.0; user = ((unsigned long) cpu.xcpu_user[core]) ? ((double) cpu.xcpu_user[core]) : 1.0; nice = ((unsigned long) cpu.xcpu_nice[core]) ? ((double) cpu.xcpu_nice[core]) : 1.0; sys = ((unsigned long) cpu.xcpu_sys[core]) ? ((double) cpu.xcpu_sys[core]) : 1.0; idle = ((unsigned long) cpu.xcpu_idle[core]) ? ((double) cpu.xcpu_idle[core]) : 1.0; b_total = total - last_total[core]; b_user = user - last_user[core]; b_nice = nice - last_nice[core]; b_sys = sys - last_sys[core]; b_idle = idle - last_idle[core]; b_irq = cpu.xcpu_irq[core] - last_irq[core]; b_iowait = cpu.xcpu_iowait[core] - last_iowait[core]; last_total[core] = total; last_user[core] = user; last_nice[core] = nice; last_sys[core] = sys; last_idle[core] = idle; last_irq[core] = cpu.xcpu_irq[core]; last_iowait[core] = cpu.xcpu_iowait[core]; y1 = (core * height) + (core * spacer); y2 = y1 + height - 1; switch (cycle) { case SCREEN_FREQ: if ((mode[SCREEN_FREQ]) && (have_freq)) { freq_cur = get_cpu_freq_cur(core); if (core < 6) { result = ((float) (b_total - b_idle) / (float) b_total)*100; if (result < 100.0) { sprintf(tmpstr, "%2.f%% %s", result, show_hertz_short(freq_cur)); } else { sprintf(tmpstr, "%3.f%%%s", result, show_hertz_short(freq_cur)); } if (ncpu < 5) { g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_MED, 1, y1 + 1); } else { g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_SMALL, 1, core * 6); } } freq_total = get_cpu_freq_max(core); drawBar_both(canvas, y1, y2, freq_cur, freq_total, freq_total - freq_cur, freq_total); y1 = 0; } else { if (core < 6) { if (have_freq) { freq_cur = get_cpu_freq_cur(core); sprintf(tmpstr, "%s%3.f%%", show_hertz_short(freq_cur), ((float) (b_total - b_idle) / (float) b_total)*100); } else { sprintf(tmpstr, "CPU%.f%3.f%%", (float) core, ((float) (b_total - b_idle) / (float) b_total)*100); } if (ncpu < 5) { g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_MED, 1, y1 + 1); } else { g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_SMALL, 1, core * 6); } } current_value = b_total - b_idle; drawBar_both(canvas, y1, y2, current_value, b_total, b_total - current_value, b_total); y1 = 0; } break; case SCREEN_CPU: if (mode[SCREEN_CPU]) { divider = 9 / ncpu; sub_val = divider * core; g15r_drawBar(canvas, BAR_START, sub_val, BAR_END, divider + sub_val, G15_COLOR_BLACK, b_user + 1, b_total, 4); g15r_drawBar(canvas, BAR_START, shift + sub_val, BAR_END, shift + divider + sub_val, G15_COLOR_BLACK, b_sys + 1, b_total, 4); y1 = 0; y2 = shift2 + divider + sub_val; g15r_drawBar(canvas, BAR_START, shift2 + sub_val, BAR_END, y2, G15_COLOR_BLACK, b_nice + 1, b_total, 4); divider = y2 / ncpu; drawBar_reversed(canvas, BAR_START, sub_val, BAR_END, y2, G15_COLOR_BLACK, b_idle + 1, b_total, 5); } else { current_value = b_total - b_idle; drawBar_both(canvas, y1, y2, current_value, b_total, b_total - current_value, b_total); drawBar_both(canvas, shift + y1, shift + y2, b_sys + 1, b_total, b_total - b_sys, b_total); y2 += shift2; drawBar_both(canvas, shift2 + y1, y2, b_nice + 1, b_total, b_total - b_nice, b_total); y1 = 0; } break; case SCREEN_SUMMARY: current_value = b_total - b_idle; drawBar_both(canvas, y1 + move, y2 + move, current_value, b_total, b_total - current_value, b_total); if (have_freq) { freq_cur = get_cpu_freq_cur(core); freq_total = get_cpu_freq_max(core); freq_sum = maxi(freq_sum, freq_cur); drawBar_both(canvas, shift + y1 + move, shift + y2 + move, freq_cur, freq_total, freq_total - freq_cur, freq_total); } y1 = 0; break; } } drawLine_both(canvas, y1 + move, y2 + move); if (cycle == SCREEN_SUMMARY) { int text_shift; if (summary_rows > 4) { text_shift = 7; } else { text_shift = 9; } if (have_freq) { drawLine_both(canvas, shift + y1 + move, shift + y2 + move); sprintf(tmpstr, "FRQ %s", show_hertz_short((int) freq_sum)); print_label(canvas, tmpstr, text_shift); draw_summary_screen(canvas, tmpstr, y1, y2, move, shift, text_shift, 2); } else { draw_summary_screen(canvas, tmpstr, y1, y2, move, shift, text_shift, 1); } } } void draw_net_screen(g15canvas *canvas, char *tmpstr, char *interface) { int i; int x=0; float diff=0; float height=0; float last=0; g15r_clearScreen (canvas, G15_COLOR_WHITE); glibtop_netload netload; glibtop_get_netload(&netload,interface); // in x=53; for(i=net_rr_index+1;i 0) { charge = ((float)bats[i].cur_charge/(float)bats[i].max_charge)*100; } sprintf(tmpstr,"Bt%d %2.f%%", i, charge); g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_MED, 1, (i*12) + 2); g15r_drawBar(canvas, BAR_START, bar_top, BAR_END, bar_bottom, G15_COLOR_BLACK, bats[i].cur_charge, bats[i].max_charge, 4); } drawBar_reversed(canvas,BAR_START,1,BAR_END,BAR_BOTTOM,G15_COLOR_BLACK,100-(((float)tot_cur_charge/(float)tot_max_charge)*100),100,5); } if ((!all) || (info_cycle == SCREEN_BAT)) { float total_charge = 0; if (tot_max_charge > 0) { total_charge = ((float)tot_cur_charge/(float)tot_max_charge)*100; } sprintf (tmpstr,"Total %2.f%% | ", total_charge); for (i = 0; i < NUM_BATS; i++) { char extension[11]; switch (bats[i].status) { case -1: { sprintf(extension, "Bt%d - | ", i); break; } case 0: { sprintf(extension, "Bt%d F | ", i); break; } case 1: { sprintf(extension, "Bt%d C | ", i); break; } case 2: { sprintf(extension, "Bt%d D | ", i); break; } } strcat (tmpstr, extension); } g15r_renderString (canvas, (unsigned char*)tmpstr, 0, G15_TEXT_SMALL, 80-(strlen(tmpstr)*4)/2, INFO_ROW); } } void draw_g15_stats_info_screen_logic(g15canvas *canvas, char *tmpstr, int all, int screen_type, g15_stats_info *probes, int count, float tot_max, int *sensor_lost, int sensor_id, char *vert_label, char *format_main, char *format_bottom) { if ((!count) || (probes[0].cur == SENSOR_ERROR)) { return; } else { sensor_lost[sensor_id] = RETRY_COUNT; } int j = 0; int shift; shift = 32 / count; if (count) { if (all) { g15r_clearScreen(canvas, G15_COLOR_WHITE); print_vert_label(canvas, vert_label); for (j = 0; j < count; j++) { register int bar_top = (j * shift) + 1 + j; register int bar_bottom = ((j + 1)*shift) + j; sprintf(tmpstr, format_main, j + 1, probes[j].cur); g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_MED, 1, bar_top + 1); drawBar_both(canvas, bar_top, bar_bottom, probes[j].cur + 1, tot_max, tot_max - probes[j].cur, tot_max); } drawLine_both(canvas, 1, ((j*shift) + j-1)); } if ((!all) || (info_cycle == screen_type)) { char extension[16]; tmpstr[0] = '\0'; for (j = 0; j < count; j++) { sprintf(extension, format_bottom, j + 1, probes[j].cur); if (j) { strcat(tmpstr, "| "); } strcat(tmpstr, extension); } g15r_renderString(canvas, (unsigned char*) tmpstr, 0, G15_TEXT_SMALL, 80 - (strlen(tmpstr)*4) / 2, INFO_ROW); } } } void draw_g15_stats_info_screen(g15canvas *canvas, char *tmpstr, int all, int screen_type) { static g15_stats_info probes[NUM_PROBES]; int count; switch (screen_type) { case SCREEN_TEMP: count = get_sensors(probes, SCREEN_TEMP, sensor_type_temp, sensor_lost_temp, sensor_temp_id); draw_g15_stats_info_screen_logic(canvas, tmpstr, all, screen_type, probes, count, temp_tot_max, sensor_lost_temp, sensor_temp_id, "TEMP", "t-%d %3.f\xb0", "temp%d %1.f\xb0 "); break; case SCREEN_FAN: count = get_sensors(probes, SCREEN_FAN, sensor_type_fan, sensor_lost_fan, sensor_fan_id); draw_g15_stats_info_screen_logic(canvas, tmpstr, all, screen_type, probes, count, fan_tot_max, sensor_lost_fan, sensor_fan_id, "RPM", "F-%d%5.f", "Fan%d %1.f "); break; default: break; } } void calc_info_cycle(void) { info_cycle = cycle; info_cycle_timer++; if (!submode) { switch ((int) (info_cycle_timer / PAUSE)) { case SCREEN_SUMMARY: info_cycle = SCREEN_SUMMARY; break; case SCREEN_CPU: info_cycle = SCREEN_CPU; break; case SCREEN_FREQ: if (have_freq) { info_cycle = SCREEN_FREQ; break; } info_cycle_timer += PAUSE; case SCREEN_MEM: info_cycle = SCREEN_MEM; break; case SCREEN_SWAP: info_cycle = SCREEN_SWAP; break; case SCREEN_NET: if (have_nic) { info_cycle = SCREEN_NET; break; } info_cycle_timer += PAUSE; case SCREEN_BAT: if (have_bat) { info_cycle = SCREEN_BAT; break; } info_cycle_timer += PAUSE; case SCREEN_TEMP: if (have_temp) { info_cycle = SCREEN_TEMP; break; } info_cycle_timer += PAUSE; case SCREEN_FAN: if (have_fan) { info_cycle = SCREEN_FAN; break; } info_cycle_timer += PAUSE; case SCREEN_NET2: if (have_nic) { info_cycle = SCREEN_NET2; break; } info_cycle_timer += PAUSE; default: info_cycle_timer = 0; info_cycle = SCREEN_SUMMARY; break; } } } void print_info_label(g15canvas *canvas, char *tmpstr) { switch (info_cycle) { case SCREEN_SUMMARY : print_time_info(canvas, tmpstr); break; case SCREEN_CPU : print_sys_load_info(canvas, tmpstr); break; case SCREEN_FREQ : print_freq_info(canvas, tmpstr); break; case SCREEN_MEM : print_mem_info(canvas, tmpstr); break; case SCREEN_SWAP : print_swap_info(canvas, tmpstr); break; case SCREEN_NET : print_net_peak_info(canvas, tmpstr); break; case SCREEN_BAT : if (cycle != SCREEN_BAT) { draw_bat_screen(canvas, tmpstr, 0); } break; case SCREEN_TEMP : if (cycle != SCREEN_TEMP) { draw_g15_stats_info_screen(canvas, tmpstr, 0, SCREEN_TEMP); } break; case SCREEN_FAN : if (cycle != SCREEN_FAN) { draw_g15_stats_info_screen(canvas, tmpstr, 0, SCREEN_FAN); } break; case SCREEN_NET2 : print_net_current_info(canvas, tmpstr); break; } } void keyboard_watch(void) { unsigned int keystate; int change = 0; while(1) { recv(g15screen_fd,&keystate,4,0); if(keystate & G15_KEY_L1) { } else if(keystate & G15_KEY_L2) { cycle--; change = CHANGE_DOWN; } else if(keystate & G15_KEY_L3) { cycle++; change = CHANGE_UP; } else if(keystate & G15_KEY_L4) { mode[cycle]++; change = CHANGE_MODE; } else if(keystate & G15_KEY_L5) { submode++; change = CHANGE_SUBMODE; } if (change) { switch (change) { case CHANGE_UP : if (cycle > MAX_SCREENS) { cycle = 0; } switch (cycle) { case SCREEN_NET: if (have_nic) { break; } cycle++; case SCREEN_BAT: if (have_bat) { break; } cycle++; case SCREEN_TEMP: if (have_temp) { break; } cycle++; case SCREEN_FAN: if (have_fan) { break; } cycle = 0; break; } info_cycle_timer = cycle * PAUSE; break; case CHANGE_DOWN : if (cycle < 0) { cycle = MAX_SCREENS; } switch (cycle) { case SCREEN_FAN: if (have_fan) { break; } cycle--; case SCREEN_TEMP: if (have_temp) { break; } cycle--; case SCREEN_BAT: if (have_bat) { break; } cycle--; case SCREEN_NET: if (have_nic) { break; } cycle--; break; } info_cycle_timer = cycle * PAUSE; break; case CHANGE_MODE : switch (cycle) { case SCREEN_NET: if (have_nic) { net_scale_absolute ^= 1; } else { change = 0; } break; case SCREEN_TEMP: sensor_temp_id = get_next(sensor_temp_id, sensor_lost_temp); if (sensor_temp_id == SENSOR_ERROR) { sensor_temp_id = 0; } break; case SCREEN_FAN: sensor_fan_id = get_next(sensor_fan_id, sensor_lost_fan); if (sensor_fan_id == SENSOR_ERROR) { sensor_fan_id = 0; } break; case SCREEN_SWAP: case SCREEN_MEM: case SCREEN_BAT: change = 0; break; } break; } if (cycle > MAX_SCREENS) { //Wrap around the apps cycle = 0; } if (mode[cycle] > MAX_MODE) { mode[cycle] = 0; } if (submode > MAX_SUB_MODE) { submode = 0; } if (change) { pthread_cond_broadcast(&wake_now); } change = 0; } usleep(100 * 900); } return; } void network_watch(void *iface) { char *interface = (char*)iface; static unsigned long previous_in; static unsigned long previous_out; int i=0, j = 0, max_in = 0, max_out = 0; glibtop_netload netload; int mac=0; glibtop_get_netload(&netload,interface); for(i=0;i<8;i++) mac+=netload.hwaddress[i]; if(!mac) { printf("Interface %s does not appear to exist. Net screen will be disabled.\n",interface); have_nic = 0; return; // interface probably doesn't exist - no mac address } while (1) { j = 0, max_in = 0, max_out = 0; if (previous_in + previous_out) { net_cur_in = netload.bytes_in - previous_in; net_cur_out = netload.bytes_out - previous_out; net_hist[i][0] = net_cur_in; net_hist[i][1] = net_cur_out; if (net_scale_absolute==1) { net_max_in = maxi(net_max_in, net_cur_in); net_max_out = maxi(net_max_out, net_cur_out); } else { /* Try ti auto-resize the net graph */ /* check for max value */ for (j = 0; j < MAX_NET_HIST; j++) { max_in = maxi(max_in, net_hist[j][0]); max_out = maxi(max_out, net_hist[j][1]); } /* Assign new values */ net_max_in = max_in; net_max_out = max_out; } net_rr_index = i; i++; if (i > MAX_NET_HIST) i = 0; } previous_in = netload.bytes_in; previous_out = netload.bytes_out; sleep(1); glibtop_get_netload(&netload, interface); } } /* wait for a max of seconds.. if condition &wake_now is received leave immediately */ void g15stats_wait(int seconds) { pthread_mutex_t dummy_mutex; struct timespec timeout; /* Create a dummy mutex which doesn't unlock for sure while waiting. */ pthread_mutex_init(&dummy_mutex, NULL); pthread_mutex_lock(&dummy_mutex); time(&timeout.tv_sec); timeout.tv_sec += seconds; timeout.tv_nsec = 0L; pthread_cond_timedwait(&wake_now, &dummy_mutex, &timeout); pthread_mutex_unlock(&dummy_mutex); pthread_mutex_destroy(&dummy_mutex); } int main(int argc, char *argv[]){ g15canvas *canvas; pthread_t keys_thread; pthread_t net_thread; int i; int go_daemon=0; unsigned char interface[128]; static char tmpstr[MAX_LINES]; int unicore = 0; for (i=0;i= MAX_SENSOR) { sensor_temp_id = 0; } } } if(0==strncmp(argv[i],"-gt",3)||0==strncmp(argv[i],"--global-temp",13)) { if(argv[i+1]!=NULL) { i++; sensor_temp_main = atoi(argv[i]); } } if(0==strncmp(argv[i],"-f",2)||0==strncmp(argv[i],"--fan",5)) { if(argv[i+1]!=NULL) { i++; sensor_fan_id = atoi(argv[i]); if (sensor_fan_id >= MAX_SENSOR) { sensor_fan_id = 0; } } } } if((g15screen_fd = new_g15_screen(G15_G15RBUF))<0){ printf("Sorry, cant connect to the G15daemon\n"); return -1; } canvas = (g15canvas *) malloc (sizeof (g15canvas)); if(go_daemon==1) daemonise(0,0); if(canvas != NULL) g15r_initCanvas(canvas); else return -1; glibtop_init(); pthread_create(&keys_thread,NULL,(void*)keyboard_watch,NULL); if(have_nic==1) pthread_create(&net_thread,NULL,(void*)network_watch,&interface); for (i=0;imode_xor = 0; g15_send(g15screen_fd,(char *)canvas->buffer,G15_BUFFER_LEN); g15stats_wait(1); } glibtop_close(); close(g15screen_fd); free(canvas); return 0; } g15stats-1.9.2/g15stats.h0000644000175100001440000000173711226332461013701 0ustar artausers#define TEXT_LEFT 1 #define NUM_BATS 3 #define NUM_PROBES 4 #define MAX_NET_HIST 107 #define MAX_SENSOR 4 #define MAX_MODE 1 #define MAX_SUB_MODE 1 #define PAUSE 6 #define RETRY_COUNT 10 #define VL_LEFT 42 #define BAR_START 45 #define BAR_END 153 #define BAR_BOTTOM 32 #define TEXT_RIGHT 155 #define MAX_LINES 128 #define INFO_ROW 37 #define SENSOR_ERROR -100 #define CHANGE_DOWN 1 #define CHANGE_UP 2 #define CHANGE_MODE 3 #define CHANGE_SUBMODE 4 #define SCREEN_SUMMARY 0 #define SCREEN_CPU 1 #define SCREEN_FREQ 2 #define SCREEN_MEM 3 #define SCREEN_SWAP 4 #define SCREEN_NET 5 #define SCREEN_BAT 6 #define SCREEN_TEMP 7 #define SCREEN_FAN 8 #define SCREEN_NET2 9 #define MAX_SCREENS 8 typedef struct g15_stats_bat_info { long max_charge; long cur_charge; long status; } g15_stats_bat_info; typedef struct g15_stats_info { float cur; float max; } g15_stats_info; g15stats-1.9.2/configure.in0000644000175100001440000000214011231707472014357 0ustar artausersAC_INIT(g15stats,[1.1], [mlampard@users.sf.net]) PACKAGE=g15stats VERSION=1.9.2 AC_PREFIX_DEFAULT(/usr) AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AC_CONFIG_HEADER([config.h]) AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_RANLIB AC_CHECK_LIB([g15daemon_client], [g15daemon_version],,AC_MSG_ERROR(["libg15daemon_client (or its devel package) not found. please install it"])) AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(g15daemon_client.h,,AC_MSG_ERROR(["libg15daemon_client (or its devel package) could not be found. please install it"])) AC_CHECK_HEADERS(libg15render.h,,AC_MSG_ERROR(["libg15render (or its devel package) could not be found. please install it"])) PKG_CHECK_MODULES(GTOP,libgtop-2.0,,) AC_ARG_WITH(gtop-includes,AC_HELP_STRING([--with-gtop-includes],[Path to libgtop includes (Autodetect)]),GTOP_CFLAGS="-I$withval",) AC_ARG_WITH(gtop-libs,AC_HELP_STRING([--with-gtop-libs],[Path to libgtop libraries (Autodetect)]),GTOP_LIBS="-L$withval -lgtop-2.0 -lglib-2.0",) CPPFLAGS="$CPPFLAGS $GTOP_CFLAGS" CFLAGS="$CPPFLAGS $GTOP_CFLAGS" LDFLAGS="$LDFLAGS $GTOP_LIBS" AC_OUTPUT(Makefile)