profile patch for 2.1.114

Andrea Arcangeli (arcangeli@mbox.queen.it)
Tue, 4 Aug 1998 17:31:11 +0200 (CEST)


The init.c patch is needed to run the kernel with the profiler without
specify profiler=x at lilo. I also masked out the x86_do_profile() call in
the code to save some clock cycle per timer interrupt. I had to guess that
nobody other me is running profiling from ages (2.1.??)...

The patch is against your latest patch against 114.

--- linux/arch/i386/kernel/time.c Fri Jul 17 14:51:50 1998
+++ /home/andrea/linux/arch/i386/kernel/time.c Tue Aug 4 17:16:40 1998
@@ -386,8 +386,10 @@
* system, in that case we have to call the local interrupt handler.
*/
#ifndef __SMP__
+#ifdef CONFIG_PROFILE
if (!user_mode(regs))
x86_do_profile(regs->eip);
+#endif
#else
if (!smp_found_config)
smp_local_timer_interrupt(regs);
--- linux/arch/i386/kernel/smp.c Sat Aug 1 19:55:16 1998
+++ /home/andrea/linux/arch/i386/kernel/smp.c Tue Aug 4 17:17:13 1998
@@ -1428,6 +1428,7 @@
{
int cpu = smp_processor_id();

+#ifdef CONFIG_PROFILE
/*
* The profiling function is SMP safe. (nothing can mess
* around with "current", and the profiling counters are
@@ -1436,6 +1437,7 @@
*/
if (!user_mode(regs))
x86_do_profile (regs->eip);
+#endif

if (!--prof_counter[cpu]) {
int user=0,system=0;
--- linux/init/main.c Tue Aug 4 17:17:49 1998
+++ /home/andrea/linux/init/main.c Tue Aug 4 16:39:52 1998
@@ -364,16 +364,18 @@
{
if (ints[0] > 0)
prof_shift = (unsigned long) ints[1];
- else
+}
+
+static void profile_init(void)
+{
#ifdef CONFIG_PROFILE_SHIFT
- prof_shift = CONFIG_PROFILE_SHIFT;
+ prof_shift = CONFIG_PROFILE_SHIFT;
#else
- prof_shift = 2;
+ prof_shift = 2;
#endif
}
#endif

-
static struct dev_name_struct {
const char *name;
const int num;
@@ -1071,6 +1073,9 @@
init_IRQ();
sched_init();
time_init();
+#ifdef CONFIG_PROFILE
+ profile_init();
+#endif
parse_options(command_line);

/*

Andrea[s] Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html