From bd1f064ad3cd967c9f796104e7f8b92e0214e961 Mon Sep 17 00:00:00 2001 From: Soren Sandmann Date: Sat, 9 Dec 2006 06:29:43 +0000 Subject: [PATCH] Add forgotten put_cpu_var(). Parse in chunks of 65536 to improve locality. 2006-12-09 Soren Sandmann * module/sysprof-module.c: Add forgotten put_cpu_var(). * sfile.c (build_instructions): Parse in chunks of 65536 to improve locality. --- ChangeLog | 6 ++++++ module/Makefile | 2 +- module/sysprof-module.c | 7 ++++++- sfile.c | 18 ++++++++++++++++-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 342f3788..3922ff89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-12-09 Soren Sandmann + + * 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 * process.c (read_maps): Set inode for vdso to 0. diff --git a/module/Makefile b/module/Makefile index f89c2e31..b87e2a19 100644 --- a/module/Makefile +++ b/module/Makefile @@ -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} diff --git a/module/sysprof-module.c b/module/sysprof-module.c index 388f068d..59b79105 100644 --- a/module/sysprof-module.c +++ b/module/sysprof-module.c @@ -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 83217149..9fd90148 100644 --- 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))