Mailinglist Archive: opensuse-commit (1301 mails)

< Previous Next >
commit sysprof
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Wed, 04 Jul 2007 23:55:43 +0200
  • Message-id: <20070704215543.D3C56678186@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package sysprof
checked in at Wed Jul 4 23:55:43 CEST 2007.

--------
--- sysprof/sysprof.changes     2007-04-04 22:09:06.000000000 +0200
+++ /mounts/work_src_done/STABLE/sysprof/sysprof.changes        2007-07-04 16:57:14.317150000 +0200
@@ -1,0 +2,6 @@
+Wed Jul  4 16:56:51 CEST 2007 - coolo@xxxxxxx
+
+- adding patch to build sysprof-text to make profiling anything
+  else than firefox feasible
+
+-------------------------------------------------------------------

New:
----
  sysprof-text.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ sysprof.spec ++++++
--- /var/tmp/diff_new_pack.T15042/_old  2007-07-04 23:55:07.000000000 +0200
+++ /var/tmp/diff_new_pack.T15042/_new  2007-07-04 23:55:07.000000000 +0200
@@ -17,14 +17,15 @@
 %define kernel_version_  %(uname -r|tr - _)
 %define prefix /usr
 %define sysconfdir /etc
-Summary:        sampling CPU profiler
+Summary:        Sampling CPU profiler
 Version:        1.0.8
-Release:        11
-License:        GNU General Public License (GPL)
+Release:        39
+License:        GPL v2 or later
 Group:          Development/Tools/Debuggers
 URL:            http://www.daimi.au.dk/~sandmann/sysprof/
 Source:         %name-%version.tar.bz2
 Patch0:         %{name}-module-configh.patch
+Patch1:         %name-text.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %suse_kernel_module_package -n sysprof kdump um xen xenpae 
 
@@ -59,6 +60,7 @@
 %prep
 %setup -q
 %patch0
+%patch1 -p1
 
 %build
 export CFLAGS="$RPM_OPT_FLAGS"
@@ -104,6 +106,9 @@
 %prefix/share/pixmaps/*.png
 
 %changelog
+* Wed Jul 04 2007 - coolo@xxxxxxx
+- adding patch to build sysprof-text to make profiling anything
+  else than firefox feasible
 * Wed Apr 04 2007 - lrupp@xxxxxxx
 - added module-init-tools to BuildRequires
 * Mon Jan 15 2007 - aj@xxxxxxx

++++++ sysprof-text.diff ++++++
diff -ruN sysprof-1.0.8.orig/Makefile.am sysprof-1.0.8/Makefile.am
--- sysprof-1.0.8.orig/Makefile.am      2005-10-10 20:37:11.000000000 +0200
+++ sysprof-1.0.8/Makefile.am   2007-07-03 11:42:12.892787000 +0200
@@ -1,7 +1,7 @@
 SUBDIRS = $(MODULE_SUBDIR)
 DIST_SUBDIRS = module
 
-bin_PROGRAMS = sysprof
+bin_PROGRAMS = sysprof sysprof-text
 pkgdata_DATA = sysprof.glade sysprof-icon.png
 
 sysprof_SOURCES =              \
@@ -22,8 +22,26 @@
        watch.h                 \
        watch.c
 
+sysprof_text_SOURCES =         \
+       binfile.h               \
+       binfile.c               \
+       process.h               \
+       process.c               \
+       profile.h               \
+       profile.c               \
+       sfile.h                 \
+       sfile.c                 \
+       stackstash.h            \
+       stackstash.c            \
+       module/sysprof-module.h \
+       sysprof-text.c          \
+       watch.h                 \
+       watch.c
+
 sysprof_LDADD = $(DEP_LIBS)
 
+sysprof_text_LDADD = -lglib-2.0 -lbfd -lopcodes -liberty
+
 INCLUDES =                                        \
        $(DEP_CFLAGS)                              \
        -DDATADIR=\"$(pkgdatadir)\"              \
diff -ruN sysprof-1.0.8.orig/sysprof-text.c sysprof-1.0.8/sysprof-text.c
--- sysprof-1.0.8.orig/sysprof-text.c   1970-01-01 01:00:00.000000000 +0100
+++ sysprof-1.0.8/sysprof-text.c        2007-07-03 11:45:01.074436000 +0200
@@ -0,0 +1,114 @@
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <glib.h>
+#include "stackstash.h"
+#include "module/sysprof-module.h"
+#include "profile.h"
+#include "process.h"
+#include "watch.h"
+
+#define SYSPROF_FILE "/proc/sysprof-trace"
+
+int fd;
+StackStash *gStash;
+GMainLoop *loop;
+char *outfile;
+
+void read_trace(StackStash *stash, SysprofStackTrace *trace, GTimeVal now)
+{
+       Process *process = process_get_from_pid (trace->pid);
+       int i;
+       for (i = 0; i < trace->n_addresses; ++i)
+       {
+           process_ensure_map (process, trace->pid, 
+                               (gulong)trace->addresses[i]);
+       }
+       
+       stack_stash_add_trace (
+           stash, process,
+           (gulong *)trace->addresses, trace->n_addresses, 1);
+       
+}
+
+void on_read(gpointer data)
+{
+    SysprofStackTrace trace;
+    int bytesread;
+    GTimeVal now;
+
+    bytesread = read (fd, &trace, sizeof (trace));
+    g_get_current_time (&now);
+
+    if(bytesread < 0)
+    {
+        perror("read");
+        return;
+    }
+
+    if(bytesread > 0)
+    {
+        read_trace(gStash, &trace, now);
+    }
+
+}
+
+void
+dump_data (StackStash *stash)
+{
+    GError *err = NULL;
+    Profile *profile = profile_new (stash);
+
+    profile_save(profile, outfile, &err);
+
+    if(err) {
+        fprintf(stderr, "%s: %s\n", outfile, err->message);
+        exit(1);
+    }
+}
+
+void sighandler(int sig)
+{
+    signal(SIGTERM, SIG_DFL);
+    signal(SIGINT, SIG_DFL);
+
+    dump_data(gStash);
+    g_main_loop_quit(loop);
+}
+
+int main(int argc, char *argv[])
+{
+    if(argc < 2)
+    {
+        fprintf(stderr, "\
+Usage: %s <outfile>\n\
+Activates sysprof profiling and dumps it to outfile on SIGTERM or SIGINT.\n\
+",
+                argv[0]);
+        return 0;
+    }
+
+    fd = open(SYSPROF_FILE, O_RDONLY);
+    if(fd < 0)
+    {
+        perror(SYSPROF_FILE);
+        fprintf(stderr, "Have you loaded the sysprof module?");
+        return 1;
+    }
+
+    outfile = argv[1];
+
+    gStash = stack_stash_new ();
+    signal(SIGTERM, sighandler);
+    signal(SIGINT, sighandler);
+
+    loop = g_main_loop_new(NULL, 0);
+    fd_add_watch (fd, gStash);
+    fd_set_read_callback (fd, on_read);
+    g_main_loop_run(loop);
+
+    return 0;
+}
--- sysprof-1.0.8.orig/profile.c        2005-08-16 02:40:26.000000000 +0200
+++ sysprof-1.0.8/profile.c     2007-07-03 16:33:25.000000000 +0200
@@ -113,7 +113,11 @@
 
     sfile_begin_add_record (output, "object");
 
-    sfile_add_string (output, "name", object->name);
+    if (!g_utf8_validate (object->name, -1, NULL)) {
+        sfile_add_string (output, "name", "brokenname");
+    } else {
+        sfile_add_string (output, "name", object->name);
+    }
     sfile_add_integer (output, "total", object->total);
     sfile_add_integer (output, "self", object->self);
     

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages