Add forgotten put_cpu_var(). Parse in chunks of 65536 to improve locality.

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.
This commit is contained in:
Soren Sandmann
2006-12-09 06:29:43 +00:00
committed by Søren Sandmann Pedersen
parent 4ba672ee9f
commit bd1f064ad3
4 changed files with 29 additions and 4 deletions

View File

@ -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.

View 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}

View 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;
}

18
sfile.c
View File

@ -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))