Increase the max number of addresses to 1021, reorganise SysprofMmapArea
authorSoren Sandmann <sandmann@daimi.au.dk>
Thu, 2 Nov 2006 06:54:12 +0000 (06:54 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Thu, 2 Nov 2006 06:54:12 +0000 (06:54 +0000)
2006-10-26  Soren Sandmann <sandmann@daimi.au.dk>

        * module/sysprof-module.h (struct SysprofStackTrace): Increase the
        max number of addresses to 1021, reorganise SysprofMmapArea to
        make the traces naturally page aligned.

        * TODO: Update

ChangeLog
TODO
module/sysprof-module.h
process.c
profile.c
sysprof.c

index 34bc14a..0888e13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2006-10-26  Soren Sandmann <sandmann@daimi.au.dk>
 
+       * module/sysprof-module.h (struct SysprofStackTrace): Increase the
+       max number of addresses to 1021, reorganise SysprofMmapArea to
+       make the traces naturally page aligned.
+
+       * TODO: Update
+
+2006-10-26  Soren Sandmann <sandmann@daimi.au.dk>
+
        * collector.c (resolve_symbols): Combine processes with identical
        commandlines here.
 
diff --git a/TODO b/TODO
index 8267beb..45538fc 100644 (file)
--- a/TODO
+++ b/TODO
@@ -158,11 +158,6 @@ Before 1.2:
        - etc.
   done: HEAD will not load files with the wrong inode now.
 
-* Consider deleting cmdline hack in process.c and replace with something at 
-  the symbol resolution level. Will require more memory though. DONE: in
-  head, processes are no longer coalesced based on cmdline. Need to add something
-  at the symbol level.
-
 * Add spew infrastructure to make remote debugging easier.
 
 * Make it compile and work on x86-64
@@ -436,7 +431,27 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html
        Probably better to send a list of maps with each trace. Which 
        shouldn't really be that expensive. We already walk the list of
        maps in process_ensure_map() on every trace. And we can do hashing
-       if it turns out to be a problem.
+       if it turns out to be a problem. 
+               Maybe replace the SysprofStackTrace with a union, so that
+       it can be either a list of maps, or a stacktrace. Both map lists and
+       stacktraces would come with a hashcode.allowing userspac. This avoids
+       the problem that maps could take up a lot of extra bandwidth.
+
+               struct MapInfo
+               {
+                       long start;
+                       long end;
+                       long offset;    
+                       long inode;
+               }
+
+               struct Maps
+               {
+                       int hash_code;
+                       int n_maps;
+                       MapInfo info [127];
+                       char filenames [2048];
+               }
 
 - Figure out how Google's pprof script works. Then add real call graph 
   drawing. (google's script is really simple; uses dot from graphviz).
@@ -620,7 +635,8 @@ Later:
 
    - Optimization usecases:
 
-       - A lot of stuff is read synchronously, but it is possible to read it asynchronously.
+       - A lot of stuff is read synchronously, but it is possible to read
+         it asynchronously.
          Visualization: A timeline with alternating CPU/disk activity. 
 
        - What function is doing all the synchronous reading, and what files/offsets is
@@ -667,6 +683,11 @@ Later:
 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=- ALREADY DONE -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
+* Consider deleting cmdline hack in process.c and replace with something at 
+  the symbol resolution level. Will require more memory though. DONE: in
+  head, processes are no longer coalesced based on cmdline. Need to add something
+  at the symbol level.
+
 * don't loop infinitely if there are cycles in the debuglink graph.
 
 * Add "sysprof --version"
index 47268e8..9b7e4df 100644 (file)
@@ -24,8 +24,8 @@ typedef struct SysprofStackTrace SysprofStackTrace;
 typedef struct SysprofStackInfo SysprofStackInfo;
 typedef struct SysprofMmapArea SysprofMmapArea;
 
-#define SYSPROF_N_TRACES 256
-#define SYSPROF_MAX_ADDRESSES 512
+#define SYSPROF_N_TRACES 64
+#define SYSPROF_MAX_ADDRESSES 1021     /* to make it one page wide */
 
 struct SysprofStackTrace
 {
@@ -39,9 +39,9 @@ struct SysprofStackTrace
 
 struct SysprofMmapArea
 {
-    unsigned int       head;
-
     SysprofStackTrace  traces[SYSPROF_N_TRACES];
+
+    unsigned int       head;
 };
 
 #endif
index a33173e..5a4ca96 100644 (file)
--- a/process.c
+++ b/process.c
@@ -49,14 +49,14 @@ struct Map
 
 struct Process
 {
-    char *cmdline;
+    char *     cmdline;
 
-    int n_maps;
-    Map *maps;
+    int                n_maps;
+    Map *      maps;
     
-    GList *bad_pages;
+    GList *    bad_pages;
     
-    int pid;
+    int                pid;
 
     const char *undefined;
 };
@@ -352,10 +352,6 @@ get_statname (int pid)
     char *stat;
     char *filename = idle_free (g_strdup_printf ("/proc/%d/stat", pid));
     
-#if 0
-    g_print ("stat %d\n", pid);
-#endif
-    
     if (g_file_get_contents (filename, &stat, NULL, NULL))
     {
        char result[200];
@@ -365,9 +361,6 @@ get_statname (int pid)
        if (sscanf (stat, "%*d %200s %*s", result) == 1)
            return g_strndup (result, 200);
     }
-#if 0
-    g_print ("return null\n");
-#endif
     
     return NULL;
 }
index 3c0b2c9..4aa076f 100644 (file)
--- a/profile.c
+++ b/profile.c
@@ -363,8 +363,8 @@ profile_caller_new (void)
 }
 
 ProfileCaller *
-profile_list_callers (Profile       *profile,
-                     char          *callee_name)
+profile_list_callers (Profile *profile,
+                     char    *callee_name)
 {
     StackNode *node;
     StackNode *callees;
@@ -379,11 +379,12 @@ profile_list_callers (Profile       *profile,
 
     for (node = callees; node != NULL; node = node->next)
     {
+       ProfileCaller *caller;
+       
        if (!node->parent)
            continue;
        
-       ProfileCaller *caller =
-           g_hash_table_lookup (callers_by_name, node->parent->address);
+       caller = g_hash_table_lookup (callers_by_name, node->parent->address);
        
        if (!caller)
        {
index 7f3a836..fdf30fa 100644 (file)
--- a/sysprof.c
+++ b/sysprof.c
@@ -757,7 +757,6 @@ overwrite_file (GtkWindow *window,
     gtk_widget_destroy (msgbox);
     
     return (ret == GTK_RESPONSE_YES);
-    
 }
 
 static void