From aaa38daad84acceac861d7e1f5aa764cd229e6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann?= Date: Sun, 8 May 2005 19:49:26 +0000 Subject: [PATCH] Restore lost wake_up(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sun May 8 15:45:08 2005 Søren Sandmann * sysprof-module.c (do_generate): Restore lost wake_up(). * sfile.c: Comment out use of bz2. * Makefile: Add an install target. Add GLADE_DIR and PIXMAP_DIR * sysprof.c (build_gui): use GLADE_DIR and PIXMAP_DIR here. * TODO: Updates. --- ChangeLog | 12 +++++++ Makefile | 82 +++++++++++++++++++++++++++++++++++++--------- TODO | 4 ++- autogen.sh | 2 ++ cdplayer-play.png | Bin 1246 -> 0 bytes cdplayer-stop.png | Bin 625 -> 0 bytes sfile.c | 8 ++++- sysprof-module.c | 17 ++++------ sysprof.c | 10 +++--- 9 files changed, 102 insertions(+), 33 deletions(-) create mode 100755 autogen.sh delete mode 100644 cdplayer-play.png delete mode 100644 cdplayer-stop.png diff --git a/ChangeLog b/ChangeLog index 69660e37..28ccea4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Sun May 8 15:45:08 2005 Søren Sandmann + + * sysprof-module.c (do_generate): Restore lost wake_up(). + + * sfile.c: Comment out use of bz2. + + * Makefile: Add an install target. Add GLADE_DIR and PIXMAP_DIR + + * sysprof.c (build_gui): use GLADE_DIR and PIXMAP_DIR here. + + * TODO: Updates. + Sat May 7 13:57:17 2005 Søren Sandmann * sfile.c (sfile_output_free): Implement this function diff --git a/Makefile b/Makefile index d87da903..ac844a0e 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,16 @@ CFLAGS += $(MODCFLAGS) -DKERNEL26 else -CFLAGS := $(shell pkg-config --cflags gtk+-2.0 libglade-2.0) -Wall -g -LIBS := $(shell pkg-config --libs gtk+-2.0 libglade-2.0) -lbfd -liberty -lbz2 +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))) @@ -17,12 +25,26 @@ INCLUDE := -isystem $(KDIR)/include MODCFLAGS := -DMODULE -D__KERNEL__ -Wall ${INCLUDE} MODULE := sysprof-module -all: check $(BINARY) $(MODULE).o +KMAKE := $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) + +all: binaries + @echo ========================================== + @echo + @echo To install sysprof type + @echo + @echo \ \ \ make 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) +# @[ -r /usr/include/bzlib.h ] || (echo bzip2 header file not found; exit 1) touch check $(BINARY): $(OBJS) depend @@ -33,6 +55,41 @@ clean: 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 @@ -41,20 +98,13 @@ include depend.mk .PHONY: depend all -ifeq ($(shell (uname -r | grep 2.6) > /dev/null ; echo -n $$?),0) +ifneq ($(shell (uname -r | grep 2.6) > /dev/null ; echo -n $$?),0) + echo A 2.6 kernel is required; exit 1 +endif -# if kernel 2.6 -$(MODULE).o: $(MODULE).c -# echo modcflags $(MODCFLAGS) - - $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules -else - -MODCFLAGS += -DKERNEL24 +# build module $(MODULE).o: $(MODULE).c - $(CC) $(MODCFLAGS) $(MODULE).c -c -o$(MODULE).o - + $(KMAKE) modules endif -endif diff --git a/TODO b/TODO index 21b93013..21ebb3f5 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ Before 1.0: * Correctness - - grep FIXME - When the module is unloaded, kill all processes blocking in read - or block unloading until all processes have exited @@ -30,6 +29,7 @@ Before 1.0: Before 1.2: +- grep FIXME - not10 - translation should be hooked up - Fixing the oops in kernels < 2.6.11 @@ -252,6 +252,8 @@ Later: DONE: +- grep FIXME + - give profiles on the command line - Hopefully the oops at the end of this file is gone now that diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..666656ac --- /dev/null +++ b/autogen.sh @@ -0,0 +1,2 @@ +#!/bin/sh +make diff --git a/cdplayer-play.png b/cdplayer-play.png deleted file mode 100644 index 2090665cfd7b263fe41c3943f2d07d8369811ae6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1246 zcmV<41R?v0P)JoF(WM^03d*y_}pJgSfajvd}ML^Z^7A%V2Q4m6a94nl)<}BqdQw(apr@1qh%4j{zqq zCx%U%HlaHnRIxP>qaPrE2Gj#?Zf@X^7Zw&q7G4f*vHm2+41fR{Fb{y56f0J&U=S2U zX+eNGJc-1ne-Ho&paJnfR8$nh%9Sh89X}C>Q-}?D7yt+$x_bcB>7PG;J_8#Y8?tZ@ zwBJnfP&q&V(bWT)nVHxe-vAxCAPWEl5ZydbQc}V&ZQ3*jW@cveA(uu<%moM_x_F?u zxtXE6yBk>ul+LrDNrxf;5I{7q$UqJUg+5vh3mRfsL=E!+0*Iy_=t?@bq{cGa4^i8H49u^B7slPp_DDu zwhthHsOkY;US5VdbLN1@Mv=fvAdUp${j`W}fB>S{1FWo&p-v$oA#fS*=jVqk4H}XQ z2I6D1%4Yxp#7O2mG00)y#{28nufdp~pPxZm8l@Nb6zcesv@9q90*Ks+g?R*~m+k?v zKDxet|Nc>Zf&(Cc$kiwg#D{P={yY$?A*=uLP##7cOL&Iddk%?c28*Qd3i@o`L`Zh>}bUD%aOylK?p! zl%Xe1oCxl)!!sNs^=Fv?0*K;L=*Ep340rC_VPIilVfgUj1H;*~XBn0*UCQwM`E$B7 z5&;5;Vh?~St^WT00qd3m1Q59%;9#K6tRo||arcK@0{{XH0FJNb!mIMw-T(jq07*qo IM6N<$f?JLHB>(^b diff --git a/cdplayer-stop.png b/cdplayer-stop.png deleted file mode 100644 index 1bac22231b15cc6816da1d61d26637721c4f47f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 625 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmUKs7M+Sy#H?H_c7y}1{rUgj{%`;r1LKh+ z21ghj7c0ChnM-zme{dl$BS3D-rwJE zykqB1!z0I!A8tw6u#y?1>;<#Vy`th`$3PPW3rkB$OU}K=Kt?J>a2Xo%zH8!AXlSc3 z`^3gR(H5(fG8@ay`-o(mTO*j!y**~-ewcJ2Ch zeSJL7uV24TIMqY^DJ=85;YQ(vqX!%n${Zj8w1Tr^KabM!|16L6a)f}f(4jtAin&lr zK--AtjmrIGwi7J(3&EjXxI*8Qfn$MUJTQI)xD{Dfhp$h&u`O4cSzTQ{R+eqnlj5?n zw2scsgRA)z8VY #include #include +#if 0 #include +#endif #include "sfile.h" typedef struct State State; @@ -1468,6 +1470,7 @@ file_replace (const gchar *filename, gssize length, GError **error); +#if 0 static void disaster (int status) { @@ -1530,6 +1533,7 @@ bz2_compress (const guchar *input, int input_length, if (output_length) *output_length = compressed_size; } +#endif gboolean sfile_output_save (SFileOutput *sfile, @@ -1593,12 +1597,14 @@ sfile_output_save (SFileOutput *sfile, } } - /* FIMXE: bz2 compressing the output is probably +#if 0 + /* FIXME - not10: bz2 compressing the output is probably * interesting at some point. For now just make sure * it works without actually using it. */ bz2_compress (output->str, output->len, &compressed, &compressed_size); +#endif g_free (compressed); diff --git a/sysprof-module.c b/sysprof-module.c index 2497fa7d..c69d7021 100644 --- a/sysprof-module.c +++ b/sysprof-module.c @@ -331,20 +331,17 @@ do_generate (void *data) struct task_struct *task = data; generate_stack_trace(task, head); - wake_up_process (task); if (head++ == &stack_traces[N_TRACES - 1]) head = &stack_traces[0]; - /* This is crack, what we actually want is "put_task_struct()", - * but that macros uses __put_task_struct() which is not exported. - * - * It does look to me like the worst that will happen is a rare - * leak, which is certainly better than an oops. + wake_up (&wait_for_trace); + + /* If a task dies between the time we see it in on_timer and + * the time we get here, it will be leaked. If __put_task_struct9) + * was exported, then we could do this properly */ - if (atomic_dec_and_test(&(task)->usage)) { - free_task (task); - } + atomic_dec (&(task)->usage); mod_timer(&timer, jiffies + INTERVAL); } @@ -357,7 +354,7 @@ on_timer(unsigned long dong) if (current && current->state == TASK_RUNNING && current->pid != 0) { get_task_struct (current); - + INIT_WORK (&work, do_generate, current); schedule_work (&work); diff --git a/sysprof.c b/sysprof.c index 635d1f8c..cbc2908b 100644 --- a/sysprof.c +++ b/sysprof.c @@ -105,7 +105,7 @@ show_samples_timeout (gpointer data) { Application *app = data; char *label; - + switch (app->state) { case INITIAL: @@ -446,9 +446,9 @@ on_start_toggled (GtkWidget *widget, gpointer data) { sorry (app->main_window, "Can't open /proc/sysprof-trace. You need to insert\n" - "the sysprof kernel module. Type \n" + "the sysprof kernel module. Type\n" "\n" - " insmod sysprof-module.ko\n" + " modprobe sysprof-module\n" "\n" "as root."); @@ -1162,11 +1162,11 @@ build_gui (Application *app) set_shadows (xml); - xml = glade_xml_new ("./sysprof.glade", NULL, NULL); + xml = glade_xml_new (GLADE_DIR "/sysprof.glade", NULL, NULL); /* Main Window */ app->main_window = glade_xml_get_widget (xml, "main_window"); - app->icon = gdk_pixbuf_new_from_file ("sysprof-icon.png", NULL); + app->icon = gdk_pixbuf_new_from_file (PIXMAP_DIR "/sysprof-icon.png", NULL); gtk_window_set_icon (GTK_WINDOW (app->main_window), app->icon);