diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/Documentation/Configure.help linux-2.4.19-magnet/Documentation/Configure.help --- linux-2.4.19/Documentation/Configure.help Fri Aug 2 18:39:42 2002 +++ linux-2.4.19-magnet/Documentation/Configure.help Fri Nov 8 08:44:34 2002 @@ -25280,6 +25280,146 @@ If unsure, say N. +MAGNET Kernel Instrumentation +CONFIG_MAGNET + MAGNET: Monitoring Apparatus for General kerNel Event Tracing + + MAGNET is a highly efficient mechanism for exporting kernel events + to user space. Events are timestamped from the cycle counter + available in nearly all contemporary CPUs. MAGNET was orignally + developed to instrument the network subsystem but now instruments + several kernel subsystems. + + MAGNET is of primary interest to designers, researchers, and + implementors. Even though the overhead associated with it is low and + can be safely used by anyone, it is of special interest and hence + should be disabled by most people. Say N here. + + Saying Y here will only add the MAGNET instrumentation mechanism. + You must select the specific subsystems to instrument from the list + below. + + See Documentation/magnet.txt for information on how to use MAGNET. + +MAGNET Instrumentation Buffer Size +CONFIG_MAGNET_BUFSIZE + Sets the size of the MAGNET instrumentation buffer in the kernel. + + The default value yields a very low likelihood that event records + will be lost on most machines. Increasing the value decreases the + probability of event loss, but also decreases amount of kernel + memory available for other purposes. + +MAGNET Extended Instrumentation +CONFIG_MAGNET_EXTENDED + Enabling this option allows kernel parameters to be exported in + event records. Using it increases the size of event records which + adds overhead but provides information which may not be available by + other means, + + Currently, extended information for network events exports TCP, UDP + and IP headers. (Exporting Ethernet headers is in the process of + being implemented.) Extended information for other events can easily + be added. + + Saying Y here will only add extended instrumentation mechanisms. You + must select the specific subsystems to instrument from the list + below. + +MAGNET Debugging Code (EXPERIMENTAL) +CONFIG_MAGNET_DEBUG + Select to enable debugging code in the MAGNET instrumention. This is + of interest to MAGNET developers only. Normally, you would say N + here. + +MAGNET Benchmarking Code (EXPERIMENTAL) +CONFIG_MAGNET_BENCHMARK + Select to benchmark the MAGNET function wich adds events to the + event buffer. This allows the overhead of MAGNET to be estimated by + appending a benchmark event after regular instrumentation points. + Normally, you would say N here. + +MAGNET Network Instrumentation +CONFIG_MAGNET_NET + Select to enable networking instrumention. + + Saying Y here only enables the selection of instrumentation for + individual network subsystems. You must select the specific + subsystems to instrument from the list below. + +MAGNET Socket Instrumentation +CONFIG_MAGNET_SOCK + Select to record socket-layer information about open/close and + send/recv calls. + +MAGNET Extended Socket Instrumentation +CONFIG_MAGNET_SOCK_EXT + Select to enable extended information about socket-related + event. + +MAGNET TCP Instrumentation +CONFIG_MAGNET_TCP + Select to record TCP-layer information about data passed down from + the socket layer or data passed up from the IP layer. + +MAGNET Extended TCP Instrumentation +CONFIG_MAGNET_TCP_EXT + Select to enable extended information about TCP-related events. + +MAGNET UDP Instrumentation +CONFIG_MAGNET_UDP + Select to record UDP-layer information about data passed down from + the socket layer or data passed up from the IP layer. + +MAGNET Extended UDP Instrumentation +CONFIG_MAGNET_UDP_EXT + Select to enable extended information about UDP-related events. + +MAGNET IP Instrumentation +CONFIG_MAGNET_IP + Select to record IP-layer information about data passed down from + the TCP/UDP layers or data passed up from the device layer. + +MAGNET Extended IP Instrumentation +CONFIG_MAGNET_IP_EXT + Select to enable extended information about IP-related events. + +MAGNET Generic Network Device Instrumentation +CONFIG_MAGNET_DEV_NET + Select to record network device information about data passed down + from the IP layer or data passed up from the actual device driver. + + Note: you are only likely to want this if the device driver for your + hardware has not been instrumented yet. + +MAGNET Ethernet Instrumentation +CONFIG_MAGNET_DEV_ETH + Select to record selected ethernet device information about data + passed down from the device layer or data passed up from the + hardware. + + Note: not all ethernet devices have been instrumented. If yours is + not, select the generic network device instrumentation above. + +MAGNET Extended Ethernet Instrumentation +CONFIG_MAGNET_DEV_ETH_EXT + NOTICE: DO NOT enable this option. It is very likely to cause a + kernel oops! + + Select to enable extended information about selected + Ethernet-related events. + +MAGNET Task Instrumentation +CONFIG_MAGNET_TASK + Select to record task-related information about task + creation/destruction events (fork() and exit()) and context switch + events. (The latter records when the schedule() function execution + begins and ends.) + +MAGNET Extended task Instrumentation +CONFIG_MAGNET_TASK_EXT + Select to enable extended information about task-related events. + # # A couple of things I keep forgetting: # capitalize: AppleTalk, Ethernet, DOS, DMA, FAT, FTP, Internet, @@ -25596,6 +25736,7 @@ # LocalWords: DMX Domex dmx wellington ftdi sio Accton Billington Corega FEter # LocalWords: MELCO LUA PNA Linksys SNC chkdsk AWACS Webcam RAMFS Ramfs ramfs # LocalWords: ramfiles MAKEDEV pty WDTPCI APA apa +# LocalWords: MAGNET recv # # The following sets edit modes for GNU EMACS # Local Variables: diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/Documentation/magnet-install.txt linux-2.4.19-magnet/Documentation/magnet-install.txt --- linux-2.4.19/Documentation/magnet-install.txt Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/Documentation/magnet-install.txt Thu Nov 14 14:23:07 2002 @@ -0,0 +1,294 @@ +# +# MAGNET - Monitoring Apparatus for General kerNel Event Tracing +# +# Version: @(#)magnet-install.txt 2.0.0 2002/10/22 +# +# Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +# +# History: +# +# 2001-03-06 1.0.0 internal release +# 2002-10-22 2.0.0 public release +# +# License: +# +# Copyright 2002. The Regents of the University of California. +# +# This material was produced under U.S. Government contract +# W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +# by the University of California for the U.S. Department of Energy. +# The Government is granted for itself and other acting on its behalf +# a paid-up, non-exclusive, irrevocable worldwide license in the +# material to reproduce, prepare derivative works, and perform +# publicly and display publicly. Beginning five (5) years after +# November 6, 2002, subject to additional five-year worldwide +# renewals, the Government is granted for itself and others acting on +# its behalf a paid-up, nonexclusive, irrevocable worldwide license +# in this material to reproduce, prepare derivative works, distribute +# copies to the public, perform publicly and display publicly, and to +# permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +# STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +# ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +# ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +# COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +# OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +# PRIVATELY OWNED RIGHTS. +# +# Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + + Step-by-Step instructions on how to install MAGNET + +The following instructions assume familiarity in building a kernel +from source. + +(For more information on how to build a kernel, see +http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html. Also some +distributions have their own way to build a kernel, e.g., Debian. It +is best to use your distribution's way if there is one.) + +1. MAGNET-ize the Linux kernel + + a. Get an official kernel release (e.g., 2.4.19) from + http://www.kernel.org/, your favorite Linux kernel repository or + from your distribution's repository. Install it, usually in + /usr/src. Change to the kernel directory. + + b. Download the MAGNET patch for your kernel version, e.g., + patch-2.4.19-magnet. + + (If a patch for your kernel version is not yet available, select + the closest patch. You may need to do some manual work to get the + patch installed.) + + c. Patch the kernel "patch -p1 < patch-2.4.19-magnet". + +2. Configure the kernel + + a. Configure the kernel with the necessary options for your + hardware. + + Make sure to check "YES" when to "Prompt for development and/or + incomplete code/drivers" under "Code maturity level options". + + b. Select "MAGNET kernel instrumentation" under the "Kernel hacking" + option to enable various choices about configuring MAGNET. + Configure MAGNET appropriately. + +3. Make, install and activate the MAGNET-ized kernel + +4. Build the user-space tools: mkmagnet, magnet-read, magnet-parse and + magnet-dump + + a. Make the tools: "cd magnet; make -f Makefile.tools" + + b. Install the tools in /usr/sbin: "make -f Makefile.tools install" + +5. Check for a MAGNET-ized kernel + + a. Reboot. + + b. The existence of /proc/magnet indicates that MAGNET is installed + properly. Cat /proc/magnet to see details about the installation. + +6. Create MAGNET device file (typically /dev/magnet) by checking + /proc/magnet and using the the major/minor numbers found there to + create /dev/magnet with mknod. + +7. Test MAGNET + + a. Create an empty trace file: "mkmagnet -b " + + b. Collect events: "magnet-read " + + c. Parse events: "magnet-parse > " + +8. Optionally enable unattended data collection + + NOTE: magnet.cron has not been extensively tested since v1.0.0. + + a. Modify the configuration lines of the scripts (magnet.cron and + magnet.copy) to reflect your environment. + + b. Create cron job for magnet.cron: "crontab -e" + + # Set up MAGNET to run every day at 12:34 AM + 34 0 * * * /usr/sbin/magnet.cron + + c. Optionally enable MAGNET at boot-time by placing a symbolic link + to magnet.cron in the appropriate rc directory. For example, + + cd /etc/rc3.d + ln -s /bin/magnet.cron S89magnet + + +Example: + +In this section, we give an example of how we build a MAGNET-ized +kernel. + +Note: We highly recommend the Debian distribution (www.debian.org) as +it makes package management almost painless. Since that is the +distribution we use, the example below shows the steps necessary to +build and install a MAGNET-ized kernel under Debian. + +1. MAGNET-ize the Linux kernel + + a. Get kernel source from kernel.org + + > wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.19.tar.bz2 + > tar jxpf linux-2.4.18.tar.bz2 + > mv linux-2.4.19 magnet-2.4.18 + +or download from the Debian + distribution: + + > apt-get install kernel-source-2.4.19 + > cd /usr/src + > tar jxpf kernel-source-2.4.19.tar.bz2 + > mv kernel-source-2.4.19 magnet-2.4.18 + + b. Get MAGNET patch off our web site and place in + /usr/src/magnet-2.4.19 + + c. Patch the kernel + + > cd magnet-2.4.19 + > patch -p1 < patch-2.4.19-magnet + +2. Configure the kernel + + a. Configure for your hardware. (Here we see one of the benefits of + using Debian. A copy of the configuration files for installed + kernels are kept in /boot. Copy one of them as your initial + configuration.) + + > cp /boot/config-2.4.19 .config + > make + + Change any options as appropriate but make sure that "Prompt for + development and/or incomplete code/drivers" under "Code maturity + level options" has been enabled in order to display MAGNET + options. + + b. Select "MAGNET kernel instrumentation" under the "Kernel hacking" + option to enable various choices about configuring MAGNET. Also + select which subsystems you wish to instrument, as shown. + + [*] MAGNET kernel instrumentation + (256) Buffer size (default 256 pages) + [*] Extended instrumentation + [ ] Debugging code + [ ] Benchmarking code + [*] Network instrumentation + [*] Socket layer + [ ] Extended socket instrumentation + [*] TCP layer + [ ] Extended TCP instrumentation + [*] UDP layer + [ ] Eextended UDP instrumentation + [*] IP layer + [ ] Extended IP instrumentation + [ ] Generic network device + [*] Ethernet devices + [ ] Extended ethernet instrumentation + [ ] Task scheduling instrumentation + +3. Make, install and activate the MAGNET-ized kernel. + + Here is where Debian really shines! + + > make-kpkg --rootcmd fakeroot clean + > make-kpkg --rootcmd fakeroot --revision 1.0 \ + --append_to_version '-magnet' kernel_image + > sudo dpkg -i /usr/src/kernel-image-2.4.19-magnet_1.0_i386.deb + + The latter command may prompt you to create a boot floppy or to + install a boot block to activate the new kernel, as shown below. + Answer as appropriate. (Typically the defaults are fine so just hit + the carriage return twice.) + + Would you like to create a boot floppy now? [No] + You already have a LILO configuration in /etc/lilo.conf + Install a boot block using the existing /etc/lilo.conf? [Yes] + + There... building and installing a kernel is not too painful is it! + + (Note: you may also want to specify modules_image if you have any + kernel modules not included in the kernel source that need to be + built. The details of doing this are beyond the scope of this + document, but the synopsis is that all modules with source code in + /usr/src/modules will have package built by make-kpkg ... + modules_image" and deposited in /usr/src. Install them with dpkg.) + +4. Build and install user-space tools + + > cd /usr/src/magnet-2.4.19/magnet + > make -f Makefile.tools + > make -f Makefile.tools install + +5. Check for a MAGNET-ized kernel + + a. Reboot + + b. Check for /proc/magnet + + > cat /proc/magnet + + --------------------------------------------------------------- + MAGNET: Monitoring Apparatus for General kerNel Event Tracing + --------------------------------------------------------------- + Version: 2.0.0 + Device Name: /dev/magnet + Device Number: 10, 63 + Buffer Size: 1024 KB (256 pages) + Record size: 20 bytes + Extended Info: off + Socket: on + TCP: on + UDP: on + IP: on + Task: off + --------------------------------------------------------------- + RADIANT (http://www.lanl.gov/radiant) + --------------------------------------------------------------- + +6. Create MAGNET device file (typically /dev/magnet) + + a. Use magnet.cron to create /dev/magnet + + > magnet.cron + + b. Alternatively, create by hand + + > mknod /dev/magnet c + + where the major and minor numbers are obtained from /proc/magnet + as above. + +7. Test MAGNET + + a. Create an empty trace file + + > cd /tmp + > mkmagnet mytrace.mag + + b. Collect events + + > magnet-read mytrace.mag + + c. Parse events into human readible form + + > magnet-parse mytrace.mag > mytrace.txt + +8. Optionally enable unattended data collection (see above) diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/Documentation/magnet.txt linux-2.4.19-magnet/Documentation/magnet.txt --- linux-2.4.19/Documentation/magnet.txt Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/Documentation/magnet.txt Thu Nov 14 14:23:29 2002 @@ -0,0 +1,277 @@ +# +# MAGNET - Monitoring Apparatus for General kerNel Event Tracing +# +# Version: @(#)magnet.txt 2.0.0 2002/10/22 +# +# Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +# +# History: +# +# 2001-03-06 1.0.0 internal release +# 2002-10-22 2.0.0 public release +# +# License: +# +# Copyright 2002. The Regents of the University of California. +# +# This material was produced under U.S. Government contract +# W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +# by the University of California for the U.S. Department of Energy. +# The Government is granted for itself and other acting on its behalf +# a paid-up, non-exclusive, irrevocable worldwide license in the +# material to reproduce, prepare derivative works, and perform +# publicly and display publicly. Beginning five (5) years after +# November 6, 2002, subject to additional five-year worldwide +# renewals, the Government is granted for itself and others acting on +# its behalf a paid-up, nonexclusive, irrevocable worldwide license +# in this material to reproduce, prepare derivative works, distribute +# copies to the public, perform publicly and display publicly, and to +# permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +# STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +# ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +# ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +# COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +# OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +# PRIVATELY OWNED RIGHTS. +# +# Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +MAGNET -- Monitoring Apparatus for General kerNel Event Tracing + +MAGNET, a research tool created by Los Alamos National Laboratory's +RADIANT (Research and Development in Advanced Networking Technology) +team , is a low-overhead, high-performance +generic kernel event monitoring mechanism suitable for benchmarking, +debugging and measuring performance. While MAGNET can be used to +monitor any kernel event, this release contains direct support for +monitoring the network protocol stack and CPU context switches. + +======================================================================== + +History: + +This is the second release of MAGNET and the first release to see +external dissemination. Furthermore, with this release we have subtly +changed the name. Instead of MAGNeT, standing for "a Monitor for +Application Generated NEtwork Traffic", MAGNET now stands for +"Monitoring Apparatus for Generic kerNel Event Tracing" to emphasize +that the mechanisms are useful for monitoring any kernel event, not +just network traffic. + +The first release was a prototype used to demonstrate feasibility and +good performance. Many of the published papers about MAGNET describe +the implementation in the first release. For this reason, we are +continuing to make the first release available. We emphasize, however, +that the first release is for historical purposes only. Do not use it. + +The second release is much more flexible and robust, as well as having +a more general trace file format. Various variable and field names +have been changed to emphasize MAGNET's general applicability for +monitoring any kernel event. The organization within the kernel has +also been generalized as well. The configuration options for MAGNET +are now located under the "Kernel Hacking" category. Based on feedback +we have received, the configuration process is much more flexible and +allows the instrumentation to be enabled independently. + +======================================================================== + +Monitoring Network Traffic: + +In contrast to traditional traffic monitoring solutions which are +designed to report traffic on the wire, which may or may not reflect +the actual traffic patterns that applications generate, MAGNET is +designed to show network traffic as it progresses through the stack. +Frequently, application-level and wire-level traffic differ +dramatically hence MAGNET provides greater insight into the networking +demands of applications, as well as the effect of each layer in the +networking stack. + +At strategic points in the processing of network traffic (for example, +when the TCP code hands a packet of data to the IP layer, or when the +kernel socket code hands data from the TCP layer to the running +application), an event record, including a high-resolution timestamp, +is added to a non-swappable kernel circular buffer. The event records +are read by a user-level application which simply mmaps() the kernel +circular buffer and reads out of it as it is updated. We have shown +that this design has minimal impact on system performance. + +Currently, the socket, TCP, UDP. and IP layers have been instrumented. +These have been tested on i386 and PowerPC platforms. The generic +network device layer has also been instrumented, along with selected +Ethernet drivers (eepro100, tulip and acenic). Optionally, extended +information in the form of TCP, UDP and IP headers can be recorded for +each event (at the cost of a larger performance impact, of course). In +this mode, MAGNET can be used by protocol designers and implementors +to debug the workings of their protocols under known conditions. + +======================================================================== + +Monitoring Tasks: + +In addition to network instrumentation, task creation (fork()), +termination (exit()) and context switches have been instrumented with +no noticeable impact on performance. The latter shows that the +mechanisms MAGNET provides are light-weight enough that all kernel +events can be monitored. + +======================================================================== + +Things to keep in mind: + +The parameter field for network send/recv operations gives the size of +the data at that layer including the size of applicable headers. For +example, sending 80 bytes via TCP yields the following sizes: 80 bytes +for socket send, 112 bytes for TCP send, 132 bytes for IP send and 146 +bytes for Ethernet send. (The TCP-send size is 112 rather than 100 +bytes because of the TCP options that Linux nearly always sends.) +Likeweise, sending 136 bytes via UDP yields the following sizes: 136 +bytes for socket send, 144 for UDP send, 164 for IP send and 178 for +Ethernet send. + +DO NOT enable extended information for the Ethernet drivers. There is +a NULL pointer problem which is guaranteed to oops your kernel! This +will hopefully be fixed in a maintenance release. + +======================================================================== + +Future: + +Currently, the identifier field of the MAGNET data record is +0x00000000 for Ethernet, generic network device and IP receives, +rather than a valid socket ID, because socket look-up does not occur +until UDP/TCP. We are considering looking up the socket early but have +not implemented it. + +More testing needs to be done on the extended data capability. Based +on internal testing, we believe the code to be correct but welcome +feedback and bug fixes. The Ethernet extended data NULL pointer bug +needs to be squashed. + +We intend to instrument drivers for all the NICs we have. Besides +those listed above, we will be instrumenting the Broadcom and e1000 +drivers eventually. Those who are interested in instrumenting other +drivers are encouraged to send patches licensed under the GPL. + +We are also considering the possibility of instrumenting other kernel +subsystems as needed. Please instrument any subsystems of interest to +you and send us patches. + +======================================================================== + +Files: + +MAGNET currently consists of the following files: + +include/linux/magnet.h + + Header file to describe MAGNET data types, for both kernel and + user-level programs. Also defines kernel function prototypes. + +magnet/magnet.c + + The code to maintain the circular kernel buffer and perform MAGNET + initialization and tear-down. + +magnet/magnet-read.c + + User-level program to read MAGNET data from the kernel buffer. This + program works by memory mapping a pre-existing file and transferring + bytes of data from the kernel to the file. Useful in its own right + for reading events from the kernel buffer, it is also a model of how + to write such an application. + +magnet/magnet-parse.c + + Program for reading binary trace files collected from the kernel + buffer by magnet-read. It converts the data in a human-readable + form, taking into account endian and cycle timing issues. + +magnet/magnet-dump.c + + Program for reading binary trace files collected from the kernel + buffer by magnet-read. It displays the data in a raw, hexadecimal + form. Good for debugging modifications to both the kernel code and + user-level tools + +magnet/mkmagnet.c + + Program to create an empty MAGNET trace files to be filled with data + by magnet-read. + +magnet/Config.in +magnet/Makefile +magnet/Makefile.tools + + The kernel configuration and make files for MAGNET. The file + Makefile.tools is used to build mkmagnet, magnet-read, magnet-parse + and magnet-dump (via make -f Makefile.tools). + +magnet/magnet.cron +magnet/magnet.copy + + Simple shell scripts to automate running the above user space + program to collect and archive data. magnet.cron also takes care of + creating the magnet device file (see below). They are relics of v1.0 + and may require updating or modification. + +Documentation/magnet.txt +Documentation/magnet-install.txt + + Text files containing information about MAGNET and its installation. + +/proc/magnet + + Reading this file displays various information about the currently + running MAGNET version, including size of data packets, size of the + kernel buffer, major/minor numbers for /dev/magnet, comfiguration + options and other details. + +/dev/magnet + + A special device file must be created to perform the mmap()ing from + the kernel to user-level space. /proc/magnet contains the + major/minor mode numbers this special file requires. + +MAGNET also consists of modifications to several kernel files. + +======================================================================== + +Compilation options: + +The following hierarchy of kernel compilation options are available: + +CONFIG_MAGNET + CONFIG_MAGNET_BUFSIZE + CONFIG_MAGNET_EXTENDED + CONFIG_MAGNET_DEBUG + CONFIG_MAGNET_BENCHMARK + CONFIG_MAGNET_NET + CONFIG_MAGNET_SOCK + CONFIG_MAGNET_SOCK_EXT + CONFIG_MAGNET_TCP + CONFIG_MAGNET_TCP_EXT + CONFIG_MAGNET_UDP + CONFIG_MAGNET_UDP_EXT + CONFIG_MAGNET_IP + CONFIG_MAGNET_IP_EXT + CONFIG_MAGNET_DEV_NET + CONFIG_MAGNET_DEV_ETH + CONFIG_MAGNET_DEV_ETH_EXT + CONFIG_MAGNET_TASK + CONFIG_MAGNET_TASK_EXT + +For more information see Document/Configure.help or select help for a +specific item within a configuration utility (e.g., menuconfig). + +======================================================================== diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/Makefile linux-2.4.19-magnet/Makefile --- linux-2.4.19/Makefile Fri Aug 2 18:39:46 2002 +++ linux-2.4.19-magnet/Makefile Fri Nov 8 07:44:00 2002 @@ -125,7 +125,7 @@ NETWORKS =net/network.o LIBS =$(TOPDIR)/lib/lib.a -SUBDIRS =kernel drivers mm fs net ipc lib +SUBDIRS =kernel drivers mm fs net ipc lib magnet DRIVERS-n := DRIVERS-y := @@ -188,6 +188,7 @@ DRIVERS-$(CONFIG_BLUEZ) += drivers/bluetooth/bluetooth.o DRIVERS-$(CONFIG_HOTPLUG_PCI) += drivers/hotplug/vmlinux-obj.o DRIVERS-$(CONFIG_ISDN_BOOL) += drivers/isdn/vmlinux-obj.o +DRIVERS-$(CONFIG_MAGNET) += magnet/libmagnet.a DRIVERS := $(DRIVERS-y) diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/arch/i386/config.in linux-2.4.19-magnet/arch/i386/config.in --- linux-2.4.19/arch/i386/config.in Fri Aug 2 18:39:42 2002 +++ linux-2.4.19-magnet/arch/i386/config.in Tue Nov 12 17:23:45 2002 @@ -425,4 +425,10 @@ bool ' Compile the kernel with frame pointers' CONFIG_FRAME_POINTER fi +# Enable/disable MAGNET +bool 'MAGNET kernel instrumentation' CONFIG_MAGNET +if [ "$CONFIG_MAGNET" = "y" ]; then + source magnet/Config.in +fi + endmenu diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/arch/ppc/config.in linux-2.4.19-magnet/arch/ppc/config.in --- linux-2.4.19/arch/ppc/config.in Fri Aug 2 18:39:43 2002 +++ linux-2.4.19-magnet/arch/ppc/config.in Tue Nov 12 17:23:52 2002 @@ -401,4 +401,11 @@ bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ bool 'Include kgdb kernel debugger' CONFIG_KGDB bool 'Include xmon kernel debugger' CONFIG_XMON + +# Enable/disable MAGNET +bool 'MAGNET kernel instrumentation' CONFIG_MAGNET +if [ "$CONFIG_MAGNET" = "y" ]; then + source magnet/Config.in +fi + endmenu diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/drivers/net/acenic.c linux-2.4.19-magnet/drivers/net/acenic.c --- linux-2.4.19/drivers/net/acenic.c Fri Aug 2 18:39:44 2002 +++ linux-2.4.19-magnet/drivers/net/acenic.c Fri Nov 8 13:00:14 2002 @@ -84,6 +84,10 @@ #include +#ifdef CONFIG_MAGNET_DEV_ETH +#include +#endif /* CONFIG_MAGNET_DEV_ETH */ + #undef INDEX_DEBUG #ifdef CONFIG_ACENIC_OMIT_TIGON_I @@ -2276,6 +2280,11 @@ skb->ip_summed = CHECKSUM_NONE; } +#ifdef CONFIG_MAGNET_DEV_ETH + /* Mark recv: MAC header already stripped off; add size back */ + MAGNET_ADD(MAGNET_ETH_RECV, skb->sk, skb->len + 14, MAGNET_NO_DATA); +#endif /* CONFIG_MAGNET_DEV_ETH */ + /* send it up */ #if ACENIC_DO_VLAN if (ap->vlgrp && (bd_flags & BD_FLG_VLAN_TAG)) { @@ -2828,6 +2837,11 @@ } } #endif + +#ifdef CONFIG_MAGNET_DEV_ETH + /* Mark xmit */ + MAGNET_ADD(MAGNET_ETH_SEND, skb->sk, skb->len, MAGNET_NO_DATA); +#endif /* CONFIG_MAGNET_DEV_ETH */ wmb(); ap->tx_prd = idx; diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/drivers/net/eepro100.c linux-2.4.19-magnet/drivers/net/eepro100.c --- linux-2.4.19/drivers/net/eepro100.c Fri Aug 2 18:39:44 2002 +++ linux-2.4.19-magnet/drivers/net/eepro100.c Tue Nov 12 18:49:45 2002 @@ -115,6 +115,10 @@ #include #include +#ifdef CONFIG_MAGNET_DEV_ETH +#include +#endif /* CONFIG_MAGNET_DEV_ETH */ + MODULE_AUTHOR("Maintainer: Andrey V. Savochkin "); MODULE_DESCRIPTION("Intel i82557/i82558/i82559 PCI EtherExpressPro driver"); MODULE_LICENSE("GPL"); @@ -1436,6 +1440,11 @@ outb(CUResume, ioaddr + SCBCmd); sp->last_cmd = (struct descriptor *)&sp->tx_ring[entry]; +#ifdef CONFIG_MAGNET_DEV_ETH + /* Mark xmit */ + MAGNET_ADD(MAGNET_ETH_SEND, skb->sk, skb->len, MAGNET_NO_DATA); +#endif /* CONFIG_MAGNET_DEV_ETH */ + /* Leave room for set_rx_mode(). If there is no more space than reserved for multicast filter mark the ring as full. */ if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) { @@ -1793,6 +1802,11 @@ PKT_BUF_SZ + sizeof(struct RxFD), PCI_DMA_FROMDEVICE); } skb->protocol = eth_type_trans(skb, dev); + +#ifdef CONFIG_MAGNET_DEV_ETH + MAGNET_ADD(MAGNET_ETH_RECV, skb->sk, pkt_len, MAGNET_NO_DATA); +#endif /* CONFIG_MAGNET_DEV_ETH */ + netif_rx(skb); sp->stats.rx_packets++; sp->stats.rx_bytes += pkt_len; diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/drivers/net/tulip/interrupt.c linux-2.4.19-magnet/drivers/net/tulip/interrupt.c --- linux-2.4.19/drivers/net/tulip/interrupt.c Fri Nov 9 14:45:35 2001 +++ linux-2.4.19-magnet/drivers/net/tulip/interrupt.c Fri Nov 8 13:01:03 2002 @@ -19,6 +19,10 @@ #include #include +#ifdef CONFIG_MAGNET_DEV_ETH +#include +#endif /* CONFIG_MAGNET_DEV_ETH */ + int tulip_rx_copybreak; unsigned int tulip_max_interrupt_work; @@ -209,6 +213,12 @@ tp->rx_buffers[entry].mapping = 0; } skb->protocol = eth_type_trans(skb, dev); + +#ifdef CONFIG_MAGNET_DEV_ETH + /* Mark recv (MAC header already stripped off; add size back) */ + MAGNET_ADD(MAGNET_ETH_RECV, skb->sk, skb->len + 14, MAGNET_NO_DATA); +#endif /* CONFIG_MAGNET_DEV_ETH */ + #ifdef CONFIG_NET_HW_FLOWCONTROL mit_sel = #endif diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/drivers/net/tulip/tulip_core.c linux-2.4.19-magnet/drivers/net/tulip/tulip_core.c --- linux-2.4.19/drivers/net/tulip/tulip_core.c Fri Aug 2 18:39:44 2002 +++ linux-2.4.19-magnet/drivers/net/tulip/tulip_core.c Fri Nov 8 07:47:48 2002 @@ -35,6 +35,10 @@ #include #endif +#ifdef CONFIG_MAGNET_DEV_ETH +#include +#endif /* CONFIG_MAGNET_DEV_ETH */ + static char version[] __devinitdata = "Linux Tulip driver version " DRV_VERSION " (" DRV_RELDATE ")\n"; @@ -707,6 +711,11 @@ u32 flag; dma_addr_t mapping; unsigned long eflags; + +#ifdef CONFIG_MAGNET_DEV_ETH + /* Mark xmit */ + MAGNET_ADD(MAGNET_ETH_SEND, skb->sk, skb->len, MAGNET_NO_DATA); +#endif /* CONFIG_MAGNET_DEV_ETH */ spin_lock_irqsave(&tp->lock, eflags); diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/include/linux/magnet.h linux-2.4.19-magnet/include/linux/magnet.h --- linux-2.4.19/include/linux/magnet.h Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/include/linux/magnet.h Thu Nov 14 14:22:42 2002 @@ -0,0 +1,372 @@ +/* +-- MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +-- +-- Version: @(#)magnet.h 2.0.0 2002/10/22 +-- +-- Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +-- +-- History: +-- +-- 2001-03-06 1.0.0 internal release +-- 2002-10-22 2.0.0 public release +-- +-- License: +-- +-- Copyright 2002. The Regents of the University of California. +-- +-- This material was produced under U.S. Government contract +-- W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +-- by the University of California for the U.S. Department of Energy. +-- The Government is granted for itself and other acting on its behalf +-- a paid-up, non-exclusive, irrevocable worldwide license in the +-- material to reproduce, prepare derivative works, and perform +-- publicly and display publicly. Beginning five (5) years after +-- November 6, 2002, subject to additional five-year worldwide +-- renewals, the Government is granted for itself and others acting on +-- its behalf a paid-up, nonexclusive, irrevocable worldwide license +-- in this material to reproduce, prepare derivative works, distribute +-- copies to the public, perform publicly and display publicly, and to +-- permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +-- STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +-- ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +-- ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +-- COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +-- OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +-- PRIVATELY OWNED RIGHTS. +-- +-- Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +-- Boston, MA 02111-1307, USA. +*/ + +#ifndef _MAGNET_H +#define _MAGNET_H + +#include /* Need PAGE_SIZE definition */ +#include + +#ifdef __KERNEL__ +#include +#include +#include +#include +typedef struct ethhdr ETHHDR; +#include +#else /* ! __KERNEL__ */ +#include +#include +#include +#include +typedef struct ether_header ETHHDR; +#include +#endif /* __KERNEL__ */ + + +#ifndef CONFIG_MAGNET_BUFSIZE +#define CONFIG_MAGNET_BUFSIZE 256 +#endif /*CONFIG_MAGNET_BUFSIZE */ +#define MAGNET_DATA_SIZE (CONFIG_MAGNET_BUFSIZE * PAGE_SIZE) + +/* +-- MAGNET version number: MM.NN.RR.VV (0xMMNNRRVV), where +-- Major: MM +-- Minor: NN +-- Revision: RR +-- Reserved: VV (currently 0x00) +-- +-- History: +-- +-- 0.00.00 Before MAGNET version numbers +-- 0.01.00 CPU cycle counter in KHz not Hz. +-- 0.02.00 PowerPC port, endian-aware +-- 0.03.00 Added socket open and close events +-- 0.04.00 Added date info record +-- 0.05.00 Added CPU instrumentation +-- 0.06.00 Generalization and clean up for release +-- 1.00.00 First public release +-- 2.00.00 Second public release (extensive changes) +*/ +#define MAGNET_MAJOR 2 +#define MAGNET_MINOR 0 +#define MAGNET_REVISION 0 + +/* Make sure version data is valid then construct version */ +#if MAGNET_MAJOR > 255 +#error MAGNET_MAJOR > 255 +#endif +#if MAGNET_MINOR > 255 +#error MAGNET_MINOR > 255 +#endif +#if MAGNET_REVISION > 255 +#error MAGNET_REVISION > 255 +#endif +#define MAGNET_MKVERSION(m,n,r) (((((m<<8)+n)<<8)+r)<<8) +#define MAGNET_VERSION \ + MAGNET_MKVERSION(MAGNET_MAJOR,MAGNET_MINOR,MAGNET_REVISION) + +/* +-- MAGNET event types +*/ +typedef enum { + MAGNET_LOST = 0x00000000, /* Lost [param=lost-records-count] */ + + MAGNET_SOCK_OPEN = 0x00000001, /* App called open() [param=socktype] */ + MAGNET_SOCK_CLOSE = 0x00000002, /* App called close() [param=0] */ + MAGNET_SOCK_SEND = 0x00000003, /* App called send() */ + MAGNET_SOCK_RECV = 0x00000004, /* App called recv() */ + + MAGNET_TCP_SEND = 0x00000005, /* Using TCP to send a msg */ + MAGNET_TCP_RECV = 0x00000006, /* Using TCP to recv a msg */ + + MAGNET_UDP_SEND = 0x00000007, /* Using UDP to send a msg */ + MAGNET_UDP_RECV = 0x00000008, /* Using UDP to recv a msg */ + + MAGNET_IP_SEND = 0x00000009, /* Using IP to send a msg */ + MAGNET_IP_RECV = 0x0000000A, /* Using IP to recv a msg */ + + MAGNET_ETH_SEND = 0x0000000B, /* Using Ethernet to send a msg */ + MAGNET_ETH_RECV = 0x0000000C, /* Using Ethernet to recv a msg */ + + MAGNET_DEV_SEND = 0x0000000D, /* Using device to send a msg */ + MAGNET_DEV_RECV = 0x0000000E, /* Using device to recv a msg */ + + MAGNET_TASK_FORK = 0x00000100, /* Create a process */ + MAGNET_TASK_EXIT = 0x00000101, /* Exit from a process */ + MAGNET_TASK_CTX_IN = 0x00000102, /* Before CTX switch */ + MAGNET_TASK_CTX_OUT = 0x00000103, /* After CTX switch */ + + MAGNET_SYSINFO = 0x01234567, /* System Info */ + MAGNET_DATEINFO = 0x01234568, /* Date Info */ + + MAGNET_BENCHMARK = 0xFFFFFFFE, /* Timing magnet_add [param=cycles] */ + + MAGNET_EMPTY = 0xFFFFFFFF, /* Empty slot */ +} MAGNET_EVENT; + +/* +-- Data and routines for extended instrumentation. +-- +-- Using these significantly adds to the space magnet packets take up +-- in memory, but provides very detailed reporting about the current +-- running state. +-- +-- Note: need to make more platform-generic... +-- Right now it is Linux-specific. +*/ + +/* +-- Use these to construct/destruct the parameter field of SOCK_OPEN: +-- +-- Format: PPPPSSTT, where PPPP is the process id, +-- SS is socket file descriptor +-- TT is the socket type (e.g., TCP, UDP) +*/ +#define magnet_mksockparm(p,s,t) ((((p << 8) | s) << 8) | t) +#define magnet_sockparm_getpid(p) ((p >> 16) & 0XFFFF) +#define magnet_sockparm_getsid(p) ((p >> 8) & 0xFF) +#define magnet_sockparm_gettype(p) (p & 0xFF) + +struct magnet_sock { + int domain; + int protocol; +}; + +#define MAGNET_TCPHDR_SIZE 60 /* TCP hdr is up to 60 bytes with opts */ +struct magnet_tcp { + struct tcphdr hdr; + unsigned char opt[MAGNET_TCPHDR_SIZE - sizeof(struct tcphdr)]; +#ifdef CONFIG_MAGNET_TCP_INFO + struct tcp_info info; // Still need to implement fill and parse! +#endif /* CONFIG_MAGNET_TCP_INFO */ +}; + +#define MAGNET_UDPHDR_SIZE sizeof(struct udphdr) +struct magnet_udp { + struct udphdr hdr; +}; + +#define MAGNET_IPHDR_SIZE 60 /* IP hdr is up to 60 bytes with options */ +struct magnet_ip { + struct iphdr hdr; + unsigned char opt[MAGNET_IPHDR_SIZE - sizeof(struct iphdr)]; +}; + +struct magnet_eth { + ETHHDR hdr; +}; + +struct magnet_task { + pid_t pid; +}; + +/* All of the conditional-cruft is to minimize overhead! */ +union magnet_ext_data { +# ifdef CONFIG_MAGNET_SOCK_EXT + struct magnet_sock sock; +# endif /* CONFIG_MAGNET_SOCK_EXT */ +# ifdef CONFIG_MAGNET_TCP_EXT + struct magnet_tcp tcp; +# endif /* CONFIG_MAGNET_TCP_EXT */ +# ifdef CONFIG_MAGNET_UDP_EXT + struct magnet_udp udp; +# endif /* CONFIG_MAGNET_UDP_EXT */ +# ifdef CONFIG_MAGNET_IP_EXT + struct magnet_ip ip; +# endif /* CONFIG_MAGNET_DEV_ETH_EXT */ +# ifdef CONFIG_MAGNET_DEV_ETH_EXT + struct magnet_eth eth; +# endif /* CONFIG_MAGNET_IP_EXT */ +# ifdef CONFIG_MAGNET_TASK_EXT + struct magnet_task task; +# endif /* CONFIG_MAGNET_TASK_EXT */ +}; + +/* +-- MAGNET record format - the interpretation depends on event type: +-- +-- Field System-Info Date-Info All-Other +-- --------- -------------- ------------------- ---------- +-- event MAGNET_SYSINFO MAGNET_DATEINFO event +-- id MAGNET_VERSION seconds-since-epoch id +-- timestamp combined-sizes timestamp timestamp +-- parm cpu-speed usec-past-seconds parm +-- data - - data +-- +-- where combined-sizes = (MAGNET_DATA_Size << 32) | sizeof(struct magnet_data) +*/ +struct magnet_data { + unsigned int event; /* Kind of event */ + unsigned int id; /* Abstract identifier */ + unsigned long long timestamp; /* Time of event (cycle counter) */ + unsigned int param; /* Usually size (in bytes) of event... */ + /* ...but is processor ID for tasks */ +#ifdef CONFIG_MAGNET_EXTENDED + union magnet_ext_data data; /* Event-specific extended data */ +#endif /* CONFIG_MAGNET_EXTENDED */ +} __attribute__ ((packed)); + +/*============================================================================ +-- +-- Everything below here is only meant for kernel mode. +-- +-- NOTE: the crufty conditionals are meant to reduce overhead where possible. +-- +*/ +#ifdef __KERNEL__ + +/* Initialize MAGNET */ +extern void magnet_init(void); + +/* Add an event to a per-socket queue */ +#ifdef CONFIG_MAGNET_EXTENDED +extern void magnet_add(unsigned int event, unsigned int id, int param, + unsigned int size, union magnet_ext_data *data); +#else + extern void magnet_add(unsigned int event, unsigned int id, int param); +#endif /* CONFIG_MAGNET_EXTENDED */ + +#define MAGNET_EXT(x) ((union magnet_ext_data *) x) /* Convenience Macro */ + +#ifdef CONFIG_MAGNET_EXTENDED +# define MAGNET_NO_DATA 0, NULL +# ifndef CONFIG_MAGNET_BENCHMARK +# define MAGNET_ADD(e, i, p, d) magnet_add(e, (unsigned int) i, p, d) +# else +# define MAGNET_ADD(e, i, p, d) \ + { unsigned long long t2, t1 = get_cycles(); \ + magnet_add(e, (unsigned int) i, p, d); \ + t2 = get_cycles(); \ + magnet_add(MAGNET_BENCHMARK, 0, t2 - t1, MAGNET_NO_DATA); \ + } +# endif /* CONFIG_MAGNET_BENCHMARK */ +#else +# define MAGNET_NO_DATA +# ifndef CONFIG_MAGNET_BENCHMARK +# define MAGNET_ADD(e, i, p, d) magnet_add(e, (unsigned int) i, p) +# else +# define MAGNET_ADD(e, i, p, d) \ + { unsigned long long t2, t1 = get_cycles(); \ + magnet_add(e, (unsigned int) i, p); \ + t2 = get_cycles(); \ + magnet_add(MAGNET_BENCHMARK, 0, t2 - t1); \ + } +# endif /* CONFIG_MAGNET_BENCHMARK */ +#endif /* CONFIG_MAGNET_EXTENDED */ + +#ifdef CONFIG_MAGNET_EXTENDED +# ifdef CONFIG_MAGNET_SOCK_EXT +# define MAGNET_SOCK_DATA(sock) sizeof(struct magnet_sock), MAGNET_EXT(sock) +# else +# define MAGNET_SOCK_DATA(sock) MAGNET_NO_DATA +# endif /* CONFIG_MAGNET_SOCK_EXT */ +#else +# define MAGNET_SOCK_DATA(sock) +#endif /* CONFIG_MAGNET_EXTENDED */ + +#ifdef CONFIG_MAGNET_EXTENDED +# ifdef CONFIG_MAGNET_TCP_EXT +# define MAGNET_TCP_DATA(tcp) \ + /* Since TCP extended data may not be working yet, play it safe! */ \ + tcp ? 4 * tcp->doff : MAGNET_TCPHDR_SIZE, MAGNET_EXT(tcp) +# else +# define MAGNET_TCP_DATA(tcp) MAGNET_NO_DATA +# endif /* CONFIG_MAGNET_TCP_EXT */ +#else +# define MAGNET_TCP_DATA(size,tcp) +#endif /* CONFIG_MAGNET_EXTENDED */ + +#ifdef CONFIG_MAGNET_EXTENDED +# ifdef CONFIG_MAGNET_UDP_EXT +# define MAGNET_UDP_DATA(udp) sizeof(struct udphdr), MAGNET_EXT(udp) +# else +# define MAGNET_UDP_DATA(udp) MAGNET_NO_DATA +# endif /* CONFIG_MAGNET_UDP_EXT */ +#else +# define MAGNET_UDP_DATA(udp) +#endif /* CONFIG_MAGNET_EXTENDED */ + +#ifdef CONFIG_MAGNET_EXTENDED +# ifdef CONFIG_MAGNET_IP_EXT +# define MAGNET_IP_DATA(ip) \ + /* Since IP extended data may not be working yet, play it safe! */ \ + ip ? 4 * ip->ihl : MAGNET_IPHDR_SIZE, MAGNET_EXT(ip) +# else +# define MAGNET_IP_DATA(ip) MAGNET_NO_DATA +# endif /* CONFIG_MAGNET_IP_EXT */ +#else +# define MAGNET_IP_DATA(size,ip) +#endif /* CONFIG_MAGNET_EXTENDED */ + +#ifdef CONFIG_MAGNET_EXTENDED +# ifdef CONFIG_MAGNET_DEV_ETH_EXT +# define MAGNET_ETH_DATA(eth) \ + eth ? sizeof(struct ethhdr) : 0, MAGNET_EXT(eth) +# else +# define MAGNET_ETH_DATA(eth) MAGNET_NO_DATA +# endif /* CONFIG_MAGNET_DEV_ETH_EXT */ +#else +# define MAGNET_ETH_DATA(eth) +#endif /* CONFIG_MAGNET_EXTENDED */ + +#ifdef CONFIG_MAGNET_EXTENDED +# ifdef CONFIG_MAGNET_TASK_EXT +# define MAGNET_TASK_DATA(task) sizeof(pid_t), MAGNET_EXT(&task->pid) +# else +# define MAGNET_TASK_DATA(task) MAGNET_NO_DATA +# endif /* CONFIG_MAGNET_TASK_EXT */ +#else +# define MAGNET_TASK_DATA(tsk) +#endif /* CONFIG_MAGNET_EXTENDED */ + +#endif /* __KERNEL__ */ +/*===========================================================================*/ + +#endif /* _MAGNET_H */ diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/init/main.c linux-2.4.19-magnet/init/main.c --- linux-2.4.19/init/main.c Fri Aug 2 18:39:46 2002 +++ linux-2.4.19-magnet/init/main.c Tue Nov 12 17:22:37 2002 @@ -69,6 +69,10 @@ #include #endif +#ifdef CONFIG_MAGNET +#include +#endif /* CONFIG_MAGNET */ + /* * Versions of gcc older than that listed below may actually compile * and link okay, but the end product can have subtle run time bugs. @@ -522,6 +526,11 @@ #ifdef CONFIG_TC tc_init(); #endif + +#ifdef CONFIG_MAGNET + /* MAGNET Instrumentation Interface. */ + magnet_init(); +#endif /* CONFIG_MAGNET */ /* Networking initialization needs a process context */ sock_init(); diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/kernel/exit.c linux-2.4.19-magnet/kernel/exit.c --- linux-2.4.19/kernel/exit.c Fri Aug 2 18:39:46 2002 +++ linux-2.4.19-magnet/kernel/exit.c Fri Nov 8 07:43:15 2002 @@ -21,6 +21,10 @@ #include #include +#ifdef CONFIG_MAGNET_TASK +#include +#endif /* CONFIG_MAGNET_TASK */ + extern void sem_exit (void); extern struct task_struct *child_reaper; @@ -472,6 +476,9 @@ tsk->exit_code = code; exit_notify(); +#ifdef CONFIG_MAGNET_TASK + MAGNET_ADD(MAGNET_TASK_EXIT, tsk, code, MAGNET_TASK_DATA(tsk)); +#endif /* CONFIG_MAGNET_TASK */ schedule(); BUG(); /* diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/kernel/fork.c linux-2.4.19-magnet/kernel/fork.c --- linux-2.4.19/kernel/fork.c Fri Aug 2 18:39:46 2002 +++ linux-2.4.19-magnet/kernel/fork.c Fri Nov 8 07:43:15 2002 @@ -28,6 +28,10 @@ #include #include +#ifdef CONFIG_MAGNET_TASK +#include +#endif /* CONFIG_MAGNET_TASK */ + /* The idle threads do not count.. */ int nr_threads; int nr_running; @@ -750,6 +754,10 @@ if (p->ptrace & PT_PTRACED) send_sig(SIGSTOP, p, 1); + +#ifdef CONFIG_MAGNET_TASK + MAGNET_ADD(MAGNET_TASK_FORK, p, 0, MAGNET_TASK_DATA(p)); +#endif /* CONFIG_MAGNET_TASK */ wake_up_process(p); /* do this last */ ++total_forks; diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/kernel/sched.c linux-2.4.19-magnet/kernel/sched.c --- linux-2.4.19/kernel/sched.c Fri Aug 2 18:39:46 2002 +++ linux-2.4.19-magnet/kernel/sched.c Fri Nov 8 10:16:59 2002 @@ -33,6 +33,10 @@ #include #include +#ifdef CONFIG_MAGNET_TASK +#include +#endif /* CONFIG_MAGNET_TASK */ + extern void timer_bh(void); extern void tqueue_bh(void); extern void immediate_bh(void); @@ -553,6 +557,10 @@ struct list_head *tmp; int this_cpu, c; +#ifdef CONFIG_MAGNET_TASK + MAGNET_ADD(MAGNET_TASK_CTX_OUT, current, current->processor, + MAGNET_TASK_DATA(current)); +#endif /* CONFIG_MAGNET_TASK */ spin_lock_prefetch(&runqueue_lock); @@ -701,6 +709,12 @@ reacquire_kernel_lock(current); if (current->need_resched) goto need_resched_back; + +#ifdef CONFIG_MAGNET_TASK + MAGNET_ADD(MAGNET_TASK_CTX_IN, current, current->processor, + MAGNET_TASK_DATA(current)); +#endif /* CONFIG_MAGNET_TASK */ + return; } diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/Config.in linux-2.4.19-magnet/magnet/Config.in --- linux-2.4.19/magnet/Config.in Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/Config.in Thu Nov 14 14:24:12 2002 @@ -0,0 +1,100 @@ +# +# MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +# +# Version: @(#)Config.in 2.0.0 2002/10/22 +# +# Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +# +# History: +# +# 2001-03-06 1.0.0 internal release +# 2002-10-22 2.0.0 public release +# +# License: +# +# Copyright 2002. The Regents of the University of California. +# +# This material was produced under U.S. Government contract +# W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +# by the University of California for the U.S. Department of Energy. +# The Government is granted for itself and other acting on its behalf +# a paid-up, non-exclusive, irrevocable worldwide license in the +# material to reproduce, prepare derivative works, and perform +# publicly and display publicly. Beginning five (5) years after +# November 6, 2002, subject to additional five-year worldwide +# renewals, the Government is granted for itself and others acting on +# its behalf a paid-up, nonexclusive, irrevocable worldwide license +# in this material to reproduce, prepare derivative works, distribute +# copies to the public, perform publicly and display publicly, and to +# permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +# STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +# ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +# ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +# COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +# OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +# PRIVATELY OWNED RIGHTS. +# +# Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +int ' Buffer size (default 256 pages)' CONFIG_MAGNET_BUFSIZE 256 +bool ' Extended instrumentation' CONFIG_MAGNET_EXTENDED +bool ' Debugging code' CONFIG_MAGNET_DEBUG +bool ' Benchmarking code' CONFIG_MAGNET_BENCHMARK + +bool ' Network instrumentation' CONFIG_MAGNET_NET +if [ "$CONFIG_MAGNET_NET" = "y" ]; then + bool ' Socket layer' CONFIG_MAGNET_SOCK + if [ "$CONFIG_MAGNET_SOCK" = "y" ]; then + if [ "$CONFIG_MAGNET_EXTENDED" = "y" ]; then + bool ' Extended socket instrumentation' CONFIG_MAGNET_SOCK_EXT + fi # CONFIG_MAGNET_EXTENDED + fi # CONFIG_MAGNET_SOCK + + bool ' TCP layer' CONFIG_MAGNET_TCP + if [ "$CONFIG_MAGNET_TCP" = "y" ]; then + if [ "$CONFIG_MAGNET_EXTENDED" = "y" ]; then + bool ' Extended TCP instrumentation' CONFIG_MAGNET_TCP_EXT + fi # CONFIG_MAGNET_EXTENDED + fi # CONFIG_MAGNET_TCP + + bool ' UDP layer' CONFIG_MAGNET_UDP + if [ "$CONFIG_MAGNET_UDP" = "y" ]; then + if [ "$CONFIG_MAGNET_EXTENDED" = "y" ]; then + bool ' Eextended UDP instrumentation' CONFIG_MAGNET_UDP_EXT + fi # CONFIG_MAGNET_EXTENDED + fi # CONFIG_MAGNET_UDP + + bool ' IP layer' CONFIG_MAGNET_IP + if [ "$CONFIG_MAGNET_IP" = "y" ]; then + if [ "$CONFIG_MAGNET_EXTENDED" = "y" ]; then + bool ' Extended IP instrumentation' CONFIG_MAGNET_IP_EXT + fi # CONFIG_MAGNET_EXTENDED + fi # CONFIG_MAGNET_IP + + bool ' Generic network device' CONFIG_MAGNET_DEV_NET + + bool ' Ethernet devices' CONFIG_MAGNET_DEV_ETH + if [ "$CONFIG_MAGNET_DEV_ETH" = "y" ]; then + if [ "$CONFIG_MAGNET_EXTENDED" = "MKG" ]; then + bool ' Extended ethernet instrumentation' CONFIG_MAGNET_DEV_ETH_EXT + fi # CONFIG_MAGNET_EXTENDED + fi # CONFIG_MAGNET_DEV_ETH +fi # CONFIG_MAGNET_NET + +bool ' Task scheduling instrumentation' CONFIG_MAGNET_TASK +if [ "$CONFIG_MAGNET_EXTENDED" = "y" ]; then + if [ "$CONFIG_MAGNET_TASK" = "y" ]; then + bool ' Extended TASK instrumentation' CONFIG_MAGNET_TASK_EXT + fi # CONFIG_MAGNET_TASK +fi # CONFIG_MAGNET_EXTENDED diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/GPL linux-2.4.19-magnet/magnet/GPL --- linux-2.4.19/magnet/GPL Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/GPL Thu Sep 16 11:44:00 1999 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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. diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/Makefile linux-2.4.19-magnet/magnet/Makefile --- linux-2.4.19/magnet/Makefile Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/Makefile Thu Nov 14 14:24:37 2002 @@ -0,0 +1,63 @@ +# +# MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +# +# Version: @(#)Makefile 2.0.0 2002/10/22 +# +# Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +# +# History: +# +# 2001-03-06 1.0.0 internal release +# 2002-10-22 2.0.0 public release +# +# License: +# +# Copyright 2002. The Regents of the University of California. +# +# This material was produced under U.S. Government contract +# W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +# by the University of California for the U.S. Department of Energy. +# The Government is granted for itself and other acting on its behalf +# a paid-up, non-exclusive, irrevocable worldwide license in the +# material to reproduce, prepare derivative works, and perform +# publicly and display publicly. Beginning five (5) years after +# November 6, 2002, subject to additional five-year worldwide +# renewals, the Government is granted for itself and others acting on +# its behalf a paid-up, nonexclusive, irrevocable worldwide license +# in this material to reproduce, prepare derivative works, distribute +# copies to the public, perform publicly and display publicly, and to +# permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +# STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +# ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +# ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +# COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +# OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +# PRIVATELY OWNED RIGHTS. +# +# Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + + +# Note1! Dependencies are done automagically by 'make dep', which also +# removes any old dependencies. DON'T put your own dependencies here +# unless it's something special (ie not a .c file). +# +# Note 2! The CFLAGS definition is now in the main makefile... + +O_TARGET := libmagnet.a + +export-objs = magnet.o + +obj-y = magnet.o + +include $(TOPDIR)/Rules.make diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/Makefile.tools linux-2.4.19-magnet/magnet/Makefile.tools --- linux-2.4.19/magnet/Makefile.tools Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/Makefile.tools Thu Nov 14 14:24:52 2002 @@ -0,0 +1,117 @@ +# +# MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +# +# Version: @(#)Makefile.tools 2.0.0 2002/10/22 +# +# Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +# +# History: +# +# 2001-03-06 1.0.0 internal release +# 2002-10-22 2.0.0 public release +# +# License: +# +# Copyright 2002. The Regents of the University of California. +# +# This material was produced under U.S. Government contract +# W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +# by the University of California for the U.S. Department of Energy. +# The Government is granted for itself and other acting on its behalf +# a paid-up, non-exclusive, irrevocable worldwide license in the +# material to reproduce, prepare derivative works, and perform +# publicly and display publicly. Beginning five (5) years after +# November 6, 2002, subject to additional five-year worldwide +# renewals, the Government is granted for itself and others acting on +# its behalf a paid-up, nonexclusive, irrevocable worldwide license +# in this material to reproduce, prepare derivative works, distribute +# copies to the public, perform publicly and display publicly, and to +# permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +# STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +# ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +# ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +# COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +# OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +# PRIVATELY OWNED RIGHTS. +# +# Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. +# + +CC = gcc +CFLAGS = -g -O3 -Wall -I../include +#CFLAGS = -g -Wall -I../include +LDFLAGS = + +TARGETS = mkmagnet magnet-read magnet-parse magnet-dump + +HDR = +SRC = mkmagnet.c magnet-read.c magnet-parse.c magnet-dump.c eswap.c +OBJ = $(SRC:.c=.o) + +FILES = $(SRC) $(HDR) +DEPEND += $(SRC:.c=.d) + +#=============================================================================== +# +# targets +# +#=============================================================================== + +#.SUFFIXES: +#.SUFFIXES: .c .h .o +.PHONY: all + +all: $(TARGETS) + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +%: %.o eswap.o + $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $^ + +install: $(TARGETS) + /usr/bin/install -p -s -o root -g root -m 0755 $? /usr/sbin + +#=============================================================================== +# +# dependencies, clean, backup, installation ... +# +#=============================================================================== + +.PHONY: clean distclean + +%.d: %.c + @echo Recreating $@ + @$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \ + | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ + [ -s $@ ] || rm -f $@' 2> /dev/null + +# automatically generate dependencies +depend: $(DEPEND) + +# clean +clean: + -rm -f core $(OBJ) + +# really clean +distclean: clean + -rm -f *~ $(DEPEND) $(TARGETS) + +# include the file created by "make depend" that contains all the dependencies +-include $(DEPEND) + +################################################################################ +# +# End of Makefile +# +################################################################################ diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/eswap.c linux-2.4.19-magnet/magnet/eswap.c --- linux-2.4.19/magnet/eswap.c Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/eswap.c Thu Nov 14 14:25:06 2002 @@ -0,0 +1,81 @@ +/* +-- MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +-- +-- Version: @(#)eswap.c 2.0.0 2002/10/22 +-- +-- Authors: Jeff Hay and Mark K. Gardner, radiant-software@lanl.gov +-- +-- History: +-- +-- 2002-10-22 2.0.0 public release +-- +-- License: +-- +-- Copyright 2002. The Regents of the University of California. +-- +-- This material was produced under U.S. Government contract +-- W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +-- by the University of California for the U.S. Department of Energy. +-- The Government is granted for itself and other acting on its behalf +-- a paid-up, non-exclusive, irrevocable worldwide license in the +-- material to reproduce, prepare derivative works, and perform +-- publicly and display publicly. Beginning five (5) years after +-- November 6, 2002, subject to additional five-year worldwide +-- renewals, the Government is granted for itself and others acting on +-- its behalf a paid-up, nonexclusive, irrevocable worldwide license +-- in this material to reproduce, prepare derivative works, distribute +-- copies to the public, perform publicly and display publicly, and to +-- permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +-- STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +-- ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +-- ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +-- COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +-- OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +-- PRIVATELY OWNED RIGHTS. +-- +-- Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +-- Boston, MA 02111-1307, USA. +*/ + +#include "eswap.h" + +/* +-- Performs big<->little endian translation of a generic buffer +*/ +void eswap(unsigned char *buffer, int length) { + int count, temp; + + for (count = 0; count < (length >> 1); count++) { + temp = buffer[length - count - 1] & 0x0FF; + buffer[length - count - 1] = buffer[count] & 0x0FF; + buffer[count] = temp & 0x0FF; + } + + return; +} + +/* +-- Performs big<->little endian translation of int-sized values +*/ +int eswap_int(int value) { + eswap((char *) &value, sizeof(int)); + return value; +} + +/* +-- Performs big<->little endian translation of longlong-sized values +*/ +long long eswap_longlong(long long value) { + eswap((unsigned char *) &value, sizeof(long long)); + return value; +} + diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/eswap.h linux-2.4.19-magnet/magnet/eswap.h --- linux-2.4.19/magnet/eswap.h Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/eswap.h Thu Nov 14 14:25:19 2002 @@ -0,0 +1,56 @@ +/* +-- MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +-- +-- Version: @(#)eswap.h 2.0.0 2002/10/22 +-- +-- Authors: Mark K. Gardner, radiant-software@lanl.gov +-- +-- History: +-- +-- 2002-10-22 2.0.0 public release +-- +-- License: +-- +-- Copyright 2002. The Regents of the University of California. +-- +-- This material was produced under U.S. Government contract +-- W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +-- by the University of California for the U.S. Department of Energy. +-- The Government is granted for itself and other acting on its behalf +-- a paid-up, non-exclusive, irrevocable worldwide license in the +-- material to reproduce, prepare derivative works, and perform +-- publicly and display publicly. Beginning five (5) years after +-- November 6, 2002, subject to additional five-year worldwide +-- renewals, the Government is granted for itself and others acting on +-- its behalf a paid-up, nonexclusive, irrevocable worldwide license +-- in this material to reproduce, prepare derivative works, distribute +-- copies to the public, perform publicly and display publicly, and to +-- permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +-- STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +-- ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +-- ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +-- COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +-- OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +-- PRIVATELY OWNED RIGHTS. +-- +-- Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +-- Boston, MA 02111-1307, USA. +*/ + +#ifndef _ESWAP_H +#define _ESWAP_H + +extern void eswap(unsigned char *buffer, int length); +extern int eswap_int(int value); +extern long long eswap_longlong(long long value); + +#endif /* _ESWAP_H */ Binary files linux-2.4.19/magnet/magnet-dump and linux-2.4.19-magnet/magnet/magnet-dump differ diff -NPBbruw --exclude=*.d --exclude=.* --exclude=*~ --exclude=*.vars --exclude=debian --exclude=soundmodem --exclude=asm --exclude=config --exclude=autoconf* --exclude=*.ver --exclude=modversions.h --exclude=version.h --exclude=xMake*.log* linux-2.4.19/magnet/magnet-dump.c linux-2.4.19-magnet/magnet/magnet-dump.c --- linux-2.4.19/magnet/magnet-dump.c Wed Dec 31 17:00:00 1969 +++ linux-2.4.19-magnet/magnet/magnet-dump.c Thu Nov 14 14:26:55 2002 @@ -0,0 +1,193 @@ +/* +-- MAGNET -- Monitoring Apparatus for General kerNel Event Tracing +-- +-- Version: @(#)magnet-dump.c 2.0.0 2002/10/22 +-- +-- Author: Mark K. Gardner, radiant-software@lanl.gov +-- +-- History: +-- +-- 2002-10-22 2.0.0 public release +-- +-- License: +-- +-- Copyright 2002. The Regents of the University of California. +-- +-- This material was produced under U.S. Government contract +-- W-7405-ENG-36 for Los Alamos National Laboratory, which is operated +-- by the University of California for the U.S. Department of Energy. +-- The Government is granted for itself and other acting on its behalf +-- a paid-up, non-exclusive, irrevocable worldwide license in the +-- material to reproduce, prepare derivative works, and perform +-- publicly and display publicly. Beginning five (5) years after +-- November 6, 2002, subject to additional five-year worldwide +-- renewals, the Government is granted for itself and others acting on +-- its behalf a paid-up, nonexclusive, irrevocable worldwide license +-- in this material to reproduce, prepare derivative works, distribute +-- copies to the public, perform publicly and display publicly, and to +-- permit others to do so. NEITHER THE UNITED STATES NOR THE UNITED +-- STATES DEPARTMENT OF ENERGY, NOR THE UNIVERSITY OF CALIFORNIA, NOR +-- ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR +-- ASSUMES ANY LEGAL LIABLITY OR RESPONSIBILITY FOR THE ACCURACY, +-- COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, +-- OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE +-- PRIVATELY OWNED RIGHTS. +-- +-- Additionally, this program is free software; you can distribute 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 any later version. Accordingly, 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., 59 Temple Place - Suite 330, +-- Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include "eswap.h" + + +#define error(fmt, args...) \ + fprintf(stderr, "-- Error: " fmt "\n" "", ## args) + + +static int verbose = 0; +static const char *helpstr = + "usage: %s