summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--INSTALL182
-rw-r--r--Makefile110
-rw-r--r--Makefile.am50
-rw-r--r--NEWS0
-rw-r--r--TODO23
-rwxr-xr-xautogen.sh82
-rw-r--r--configure.ac72
-rw-r--r--module/Makefile34
-rw-r--r--module/sysprof-module.c (renamed from sysprof-module.c)0
-rw-r--r--module/sysprof-module.h (renamed from sysprof-module.h)0
-rw-r--r--sysprof.c8
12 files changed, 447 insertions, 115 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..a8d0fae
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Søren Sandmann (sandmann@redhat.com)
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..b42a17a
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
diff --git a/Makefile b/Makefile
deleted file mode 100644
index ac844a0..0000000
--- a/Makefile
+++ /dev/null
@@ -1,110 +0,0 @@
-ifneq ($(KERNELRELEASE),)
-
-obj-m := sysprof-module.o
-CFLAGS += $(MODCFLAGS) -DKERNEL26
-
-else
-
-ifeq ($(PREFIX),)
-PREFIX := /usr/local
-endif
-
-BINDIR := $(PREFIX)/bin
-GLADE_DIR := $(PREFIX)/share/sysprof
-PIXMAP_DIR := $(PREFIX)/share/pixmaps/sysprof
-
-CFLAGS := $(shell pkg-config --cflags gtk+-2.0 libglade-2.0) -Wall -g -DGLADE_DIR=\"$(GLADE_DIR)\" -DPIXMAP_DIR=\"$(PIXMAP_DIR)\"
-LIBS := $(shell pkg-config --libs gtk+-2.0 libglade-2.0) -lbfd -liberty
-C_FILES := sysprof.c binfile.c stackstash.c watch.c process.c \
-profile.c treeviewutils.c sfile.c
-OBJS := $(addsuffix .o, $(basename $(C_FILES)))
-BINARY := sysprof
-MODULE := sysprof-module
-KDIR := /lib/modules/$(shell uname -r)/build
-INCLUDE := -isystem $(KDIR)/include
-MODCFLAGS := -DMODULE -D__KERNEL__ -Wall ${INCLUDE}
-MODULE := sysprof-module
-
-KMAKE := $(MAKE) -C $(KDIR) SUBDIRS=$(PWD)
-
-all: binaries
- @echo ==========================================
- @echo
- @echo To install sysprof type
- @echo
- @echo \ \ \ make PREFIX=\<prefix\> install
- @echo
- @echo as root. For example:
- @echo
- @echo \ \ \ make PREFIX=/usr install
- @echo
-
-binaries: check $(BINARY) $(MODULE).o
-
-check:
- pkg-config gtk+-2.0 libglade-2.0
- @[ -r $(KDIR)/include/linux/kernel.h ] || (echo No kernel headers found; exit 1)
-# @[ -r /usr/include/bzlib.h ] || (echo bzip2 header file not found; exit 1)
- touch check
-
-$(BINARY): $(OBJS) depend
- $(CC) $(OBJS) $(LIBS) -o$(BINARY)
-clean:
- rm -f $(OBJS) $(BINARY) $(MODULE).o *~ core* depend.mk
-
-depend:
- $(CC) -MM $(CFLAGS) $(C_FILES) > depend.mk
-
-install: binaries
- @echo
- @echo Installing in $(PREFIX)
- @echo
-
-# binary
- @mkdir -p $(BINDIR)
- cp sysprof $(BINDIR)
-
-# glade file
- mkdir -p $(GLADE_DIR)
- cp sysprof.glade $(GLADE_DIR)
-
-# icon
- mkdir -p $(PIXMAP_DIR)
- cp sysprof-icon.png $(PIXMAP_DIR)
-
-# kernel module
- $(KMAKE) modules_install
-
- depmod
-
- @echo ======================================
- @echo
- @echo To run sysprof first insert the module by typing
- @echo
- @echo \ \ \ \ modprobe sysprof-module
- @echo
- @echo as root. Then run \"$(PREFIX)/bin/sysprof\".
- @echo
-
-insert_module: install
- modprobe -r sysprof-module
- modprobe sysprof-module
-
-depend.mk:
- touch depend.mk
- $(MAKE) depend
-
-include depend.mk
-
-.PHONY: depend all
-
-ifneq ($(shell (uname -r | grep 2.6) > /dev/null ; echo -n $$?),0)
- echo A 2.6 kernel is required; exit 1
-endif
-
-# build module
-
-$(MODULE).o: $(MODULE).c
- $(KMAKE) modules
-
-endif
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..03ea1e8
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,50 @@
+bin_PROGRAMS = sysprof
+pkgdata_DATA = sysprof.glade sysprof-icon.png
+
+sysprof_SOURCES = \
+ binfile.h \
+ binfile.c \
+ process.h \
+ process.c \
+ profile.h \
+ profile.c \
+ sfile.h \
+ sfile.c \
+ stackstash.h \
+ stackstash.c \
+ sysprof-module.h \
+ sysprof.c \
+ treeviewutils.h \
+ treeviewutils.c \
+ watch.h \
+ watch.c
+
+sysprof_LDADD = $(DEP_LIBS)
+
+INCLUDES = \
+ $(DEP_CFLAGS) \
+ -DDATADIR=\"$(pkgdatadir)\" \
+ -DPKGLIBDIR=\"$(pkglibdir)\"
+
+# memprof.desktop
+# memprof.spec.in
+
+EXTRA_DIST = \
+ sysprof.glade \
+ sysprof-icon.png
+
+pixmapsdir = $(datadir)/pixmaps
+pixmaps_DATA = sysprof-icon.png
+
+modulesdir = /lib/modules/`uname -r`/kernel/drivers
+modules_DATA = module/sysprof-module.ko
+
+CLEANFILES = \
+ module/sysprof-module.mod.c \
+ module/sysprof-module.mod.h \
+ module/sysprof-module.mod.o \
+ module/sysprof-module.o \
+ module/sysprof-module.ko
+
+module/sysprof-module.ko:
+ (cd module && $(MAKE))
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/TODO b/TODO
index e0ca570..6eaa629 100644
--- a/TODO
+++ b/TODO
@@ -21,8 +21,13 @@ Before 1.2:
- grep FIXME - not10
- translation should be hooked up
+- Consider adding "at least 5% inclusive cost" filter
+- Ability to generate "screenshots" suitable for mail/blog/etc
- Fixing the oops in kernels < 2.6.11
+ - Oops should be fixed in 1.0, but the stuff below may still
+ be worth thinking about.
+
- Make the process waiting in poll() responsible for extracting
the backtrace. Give a copy of the entire stack rather than doing
the walk inside the kernel. That would allow us to do more complex
@@ -120,7 +125,11 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html
for each leaf
add trace to tree (leaf, interesting)
- Consider adding KDE-style nested callgraph view
+ - probably need a dependency on gtk+ 2.8 for this.
- Add support for line numbers within functions
+ - Possibly a special "view details" mode, assuming that
+ the details of a function are not that interesting
+ together with a tree.
- consider caching [filename => bin_file]
- rethink caller list, not terribly useful at the moment.
@@ -131,6 +140,7 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html
- speedprof seems to report that lots of time is spent in
stack_stash_foreach() and also in generate_key()
- add an 'everything' object. It is really needed for a lot of things
+ - should be easy to do with stackstash reorganization.
- Non-GUI version that can save in a format the GUI can understand.
Could be used for profiling startup etc. Would preferably be able to
@@ -145,6 +155,7 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html
- possibly add dependency on glib 2.8 if it is released at that point.
(g_file_replace())
+- somehow get access to VSEnterprise profiler and see how it works.
Later:
@@ -167,7 +178,7 @@ Later:
Possible solution is for the script binaries to have a function
called something like
- __sysprof__generate_stacktrace (char **functions, int n_functions);
+ __sysprof__generate_stacktrace (char **functions, int *n_functions);
that the sysprof kernel module could call (and make return to the kernel).
@@ -199,6 +210,13 @@ Later:
Maybe also get rid of 'callers' by having a new "show details"
dialog or something.
+
+ The complete solution here degenerates into "expressions":
+
+ "foo" and ("malloc" or "free")
+
+ Having that would also take care of the "multiple functions"
+ above. Noone would understand it, though.
- figure out a way to deal with both disk and CPU. Need to make sure that
things that are UNINTERRUPTIBLE while there are RUNNING tasks are not
@@ -243,6 +261,9 @@ Later:
+
+
+
DONE:
- Sould just install the kernel module if it running as root, pop up
diff --git a/autogen.sh b/autogen.sh
index 666656a..813102c 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,2 +1,82 @@
#!/bin/sh
-make
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+PROJECT=sysprof
+TEST_TYPE=-f
+FILE=sysprof.c
+
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile $PROJECT."
+ echo "Install the appropriate package for your distribution,"
+ echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+ DIE=1
+}
+
+if automake-1.7 --version < /dev/null > /dev/null 2>&1 ; then
+ AUTOMAKE=automake-1.7
+ ACLOCAL=aclocal-1.7
+else
+ echo
+ echo "You must have automake 1.7.x installed to compile $PROJECT."
+ echo "Install the appropriate package for your distribution,"
+ echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+ DIE=1
+fi
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+test $TEST_TYPE $FILE || {
+ echo "You must run this script in the top-level $PROJECT directory"
+ exit 1
+}
+
+if test -z "$AUTOGEN_SUBDIR_MODE"; then
+ if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish "
+ echo "to pass any to it, please specify them on the $0 command line."
+ fi
+fi
+
+if test -z "$ACLOCAL_FLAGS"; then
+
+ acdir=`$ACLOCAL --print-ac-dir`
+ m4list="glib-2.0.m4 glib-gettext.m4"
+
+ for file in $m4list
+ do
+ if [ ! -f "$acdir/$file" ]; then
+ echo "WARNING: aclocal's directory is $acdir, but..."
+ echo " no file $acdir/$file"
+ echo " You may see fatal macro warnings below."
+ echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
+ echo " environment variable to \"-I /some/dir\", or install"
+ echo " $acdir/$file."
+ echo ""
+ fi
+ done
+fi
+
+$ACLOCAL $ACLOCAL_FLAGS || exit 1
+
+autoheader || exit 1
+
+$AUTOMAKE --add-missing || exit 1
+autoconf || exit 1
+cd $ORIGDIR
+
+if test -z "$AUTOGEN_SUBDIR_MODE"; then
+ $srcdir/configure --enable-maintainer-mode --enable-gtk-doc "$@"
+
+ echo
+ echo "Now type 'make' to compile $PROJECT."
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..df1a77e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,72 @@
+AC_PREREQ(2.54)
+
+AC_INIT([sysprof], [0.9])
+AC_CONFIG_SRCDIR(sysprof.glade)
+
+AM_INIT_AUTOMAKE(no-define)
+
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+
+changequote(,)dnl
+if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wall" ;;
+ esac
+fi
+changequote([,])dnl
+
+debugdir=${libdir}/debug
+
+# Separate debug dir
+
+dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
+dnl Version 1.3 (2001/03/02)
+dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
+
+AC_DEFUN([AC_DEFINE_DIR], [
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_define_dir=`eval echo [$]$2`
+ ac_define_dir=`eval echo [$]ac_define_dir`
+ ifelse($3, ,
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
+])
+
+AC_ARG_WITH(separate-debug-dir,
+[ --with-separate-debug-dir=path Look for global separate debug info in this path [LIBDIR/debug]],
+[debugdir="${withval}"])
+
+AC_DEFINE_DIR(DEBUGDIR, debugdir,
+ [Look for global separate debug info in this path])
+
+# Pkgconfig dependencies
+
+dep_modules="gtk+-2.0 > 2.6.0 gthread-2.0 gdk-pixbuf-2.0 pangoft2 libglade-2.0"
+
+PKG_CHECK_MODULES(DEP, $dep_modules, [],
+ AC_MSG_ERROR([sysprof dependencies not satisfied]))
+
+# libiberty and libbfd
+
+AC_CHECK_LIB(iberty, cplus_demangle,:,
+ AC_CHECK_LIB(iberty, cplus_demangle_opname, [],
+ AC_MSG_ERROR([libiberty is required to compile sysprof]), -ldl))
+
+AC_CHECK_LIB(bfd, bfd_get_error, [DEP_LIBS="$DEP_LIBS -lbfd -liberty"],
+ AC_MSG_ERROR([libbfd is required to compile sysprof]),
+ -liberty)
+
+# emit files
+
+AC_SUBST(DEP_LIBS)
+
+AC_CONFIG_FILES([
+Makefile
+])
+
+AC_OUTPUT
diff --git a/module/Makefile b/module/Makefile
new file mode 100644
index 0000000..560e460
--- /dev/null
+++ b/module/Makefile
@@ -0,0 +1,34 @@
+ifneq ($(KERNELRELEASE),)
+
+obj-m := sysprof-module.o
+CFLAGS += $(MODCFLAGS) -DKERNEL26
+
+else
+
+ifeq ($(PREFIX),)
+PREFIX := /usr/local
+endif
+
+MODULE := sysprof-module
+KDIR := /lib/modules/$(shell uname -r)/build
+INCLUDE := -isystem $(KDIR)/include
+MODCFLAGS := -DMODULE -D__KERNEL__ -Wall ${INCLUDE}
+
+KMAKE := $(MAKE) -C $(KDIR) SUBDIRS=$(PWD)
+
+modules: $(MODULE).o
+
+insert_module: install
+ modprobe -r sysprof-module
+ modprobe sysprof-module
+
+ifneq ($(shell (uname -r | grep 2.6) > /dev/null ; echo -n $$?),0)
+ echo A 2.6 kernel is required; exit 1
+endif
+
+# build module
+
+$(MODULE).o: $(MODULE).c
+ $(KMAKE) modules
+
+endif
diff --git a/sysprof-module.c b/module/sysprof-module.c
index c69d702..c69d702 100644
--- a/sysprof-module.c
+++ b/module/sysprof-module.c
diff --git a/sysprof-module.h b/module/sysprof-module.h
index 6d6255e..6d6255e 100644
--- a/sysprof-module.h
+++ b/module/sysprof-module.h
diff --git a/sysprof.c b/sysprof.c
index dd254db..ba96d7c 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -17,6 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <config.h>
+
#include <stdio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
@@ -28,7 +30,7 @@
#include "binfile.h"
#include "watch.h"
-#include "sysprof-module.h"
+#include "module/sysprof-module.h"
#include "stackstash.h"
#include "profile.h"
#include "treeviewutils.h"
@@ -1181,11 +1183,11 @@ build_gui (Application *app)
set_shadows (xml);
- xml = glade_xml_new (GLADE_DIR "/sysprof.glade", NULL, NULL);
+ xml = glade_xml_new (DATADIR "/sysprof.glade", NULL, NULL);
/* Main Window */
app->main_window = glade_xml_get_widget (xml, "main_window");
- app->icon = gdk_pixbuf_new_from_file (PIXMAP_DIR "/sysprof-icon.png", NULL);
+ app->icon = gdk_pixbuf_new_from_file (DATADIR"/pixmaps" "/sysprof-icon.png", NULL);
gtk_window_set_icon (GTK_WINDOW (app->main_window), app->icon);