You are looking at historical revision 25828 of this page. It may differ significantly from its current revision.

proccpuinfo

A binding for the libproccpuinfo library

Usage Example

 (use proccpuinfo)
 (proccpuinfo 'architecture)
 (proccpuinfo 'hardware-platform)
 (proccpuinfo 'frequency)
 (proccpuinfo 'bogomips)
 (proccpuinfo 'cache)
 (proccpuinfo 'cpus)
 (proccpuinfo 'cputype)

Requirements

Synopsis

This egg contains thoroughly commented Chicken code (mainly in the "proccpuinfo.scm" file) which is intended to be an example of how a basic Chicken binding of a simple C library can be created.

Installation

This binding is distributed as a Chicken egg. To compile and install this egg, you must first download and install libproccpuinfo.

libproccpuinfo can be downloaded from here.

Its documentation can be found here.

Once you've installed libproccpuinfo, you can compile and install this egg by typing:

 chicken-install proccpuinfo

Note

 This egg has only been tested with libproccpuinfo version 0.0.8

Troubleshooting tips

If you receive an error from chicken-install about not being able to find "proccpuinfo.h" or about not being able to find "-lproccpuinfo", try passing the locations of libproccpuinfo's header and library files to chicken-install via your shell's CFLAGS and LDFLAGS environment variables.

For example, you could try running something like the following from your shell:

 CFLAGS=-I/usr/local/libproccpuinfo/include LDFLAGS=-L/usr/local/libproccpuinfo/lib chicken-install proccpuinfo

Substitute the path you've installed libproccpuinfo to in place of "/usr/local/libproccpuinfo"

List of Procedures

This egg only exports a single procedure:

[procedure] (proccpuinfo DESIRED-INFO [filename: FILENAME] [arch: ARCHITECTURE])

Where DESIRED-INFO is one of the following:

and FILENAME is an optional string containing the name of the file to read from instead of the default "/proc/cpuinfo"

and ARCHITECTURE is an optional string that will be used to interpret the cpuinfo file as if it was read on a different architecture.

This procedure will return the desired entry from "/proc/cpuinfo" or the given FILENAME, or #f if there is no such entry.

Please see the libproccpuinfo documentation for more information.

Internal Binding Documentation

Please see the comments in the source (the "proccpuinfo.scm" file in particular) for a detailed explanation of how the binding works. A tutorial article regarding this binding is forthcoming. Watch this space.

License

Copyright (C) 2012 - Sergey Goldgaber, Moritz Heidkamp, Christian Kellermann

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/