Add forgotten put_cpu_var(). Parse in chunks of 65536 to improve locality.
authorSoren Sandmann <sandmann@daimi.au.dk>
Sat, 9 Dec 2006 06:29:43 +0000 (06:29 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Sat, 9 Dec 2006 06:29:43 +0000 (06:29 +0000)
2006-12-09  Soren Sandmann <sandmann@daimi.au.dk>

        * module/sysprof-module.c: Add forgotten put_cpu_var().
        * sfile.c (build_instructions): Parse in chunks of 65536 to
        improve locality.

ChangeLog
module/Makefile
module/sysprof-module.c
sfile.c

index 342f378..3922ff8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-09  Soren Sandmann <sandmann@daimi.au.dk>
+
+       * module/sysprof-module.c: Add forgotten put_cpu_var(). 
+       * sfile.c (build_instructions): Parse in chunks of 65536 to
+       improve locality.
+
 2006-11-23  Soren Sandmann <sandmann@daimi.au.dk>
 
        * process.c (read_maps): Set inode for vdso to 0.
index f89c2e3..b87e2a1 100644 (file)
@@ -10,7 +10,7 @@ PREFIX        := /usr/local
 endif
 
 MODULE    := sysprof-module
-KDIR      := /lib/modules/$(shell uname -r)/build
+KDIR      := /lib/modules/$(shell uname -r)/build # /home/ssp/linux-2.6.19/
 INCLUDE   := -isystem $(KDIR)/include
 MODCFLAGS := -DMODULE -D__KERNEL__ -Wall ${INCLUDE}
 
index 388f068..59b7910 100644 (file)
@@ -126,8 +126,12 @@ timer_notify (struct pt_regs *regs)
 #if 0
        int stacksize;
 #endif
+       int n;
 
-       if (((++get_cpu_var(n_samples)) % INTERVAL) != 0)
+       n = ++get_cpu_var(n_samples);
+       put_cpu_var(n_samples);
+
+       if (n % INTERVAL != 0)
                return 0;
        
        /* 0: locked, 1: unlocked */
@@ -216,6 +220,7 @@ timer_notify (struct pt_regs *regs)
 
 out:
        atomic_inc(&in_timer_notify);
+       
        return 0;
 }
 
diff --git a/sfile.c b/sfile.c
index 8321714..9fd9014 100644 (file)
--- a/sfile.c
+++ b/sfile.c
@@ -628,11 +628,25 @@ build_instructions (const char *contents,
     build.instructions = g_array_new (TRUE, TRUE, sizeof (Instruction));
     
     parse_context = g_markup_parse_context_new (&parser, 0, &build, NULL);
+
+    while (length)
+    {
+        int bytes = MIN (length, 65536);
+
+        if (!g_markup_parse_context_parse (parse_context, contents, bytes, err))
+        {
+            free_instructions ((Instruction *)build.instructions->data, build.instructions->len);
+            return NULL;
+        }
+
+        contents += bytes;
+        length -= bytes;
+    }
     
-    if (!g_markup_parse_context_parse (parse_context, contents, length, err))
+    if (!g_markup_parse_context_end_parse (parse_context, err))
     {
         free_instructions ((Instruction *)build.instructions->data, build.instructions->len);
-       return NULL;
+        return NULL;
     }
     
     if (!scontext_is_finished (build.context))