This patch (v2.1.33) puts CONFIG_PROFILE to use by saving a few bytes here
and there, and also removes an extra if(...) from the scheduler.
Paul.
-----------------------
diff -ur linux-2133/fs/proc/array.c linux/fs/proc/array.c
--- linux-2133/fs/proc/array.c Thu Mar 27 22:21:13 1997
+++ linux/fs/proc/array.c Mon Apr 7 19:07:17 1997
@@ -123,7 +123,7 @@
&proc_kcore_operations,
};
-
+#ifdef CONFIG_PROFILE
/*
* This function accesses profiling information. The returned data is
* binary: the sampling step and the actual contents of the profile
@@ -175,6 +175,7 @@
struct inode_operations proc_profile_inode_operations = {
&proc_profile_operations,
};
+#endif
static int get_loadavg(char * buffer)
diff -ur linux-2133/fs/proc/root.c linux/fs/proc/root.c
--- linux-2133/fs/proc/root.c Mon Apr 7 18:07:54 1997
+++ linux/fs/proc/root.c Mon Apr 7 19:53:01 1997
@@ -529,11 +529,13 @@
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations
};
+#ifdef CONFIG_PROFILE
static struct proc_dir_entry proc_root_profile = {
PROC_PROFILE, 7, "profile",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_profile_inode_operations
};
+#endif
static struct proc_dir_entry proc_root_slab = {
PROC_SLABINFO, 8, "slabinfo",
S_IFREG | S_IRUGO, 1, 0, 0,
@@ -602,10 +604,12 @@
proc_register(&proc_root, &proc_root_slab);
+#ifdef CONFIG_PROFILE
if (prof_shift) {
proc_register(&proc_root, &proc_root_profile);
proc_root_profile.size = (1+prof_len) * sizeof(unsigned long);
}
+#endif
proc_tty_init();
}
diff -ur linux-2133/init/main.c linux/init/main.c
--- linux-2133/init/main.c Sun Apr 13 08:24:34 1997
+++ linux/init/main.c Sat Apr 12 18:42:41 1997
@@ -270,6 +270,7 @@
return(cur);
}
+#ifdef CONFIG_PROFILE
static void profile_setup(char *str, int *ints)
{
if (ints[0] > 0)
@@ -281,13 +282,16 @@
prof_shift = 2;
#endif
}
+#endif
struct {
const char *str;
void (*setup_func)(char *, int *);
} bootsetups[] = {
{ "reserve=", reserve_setup },
+#ifdef CONFIG_PROFILE
{ "profile=", profile_setup },
+#endif
#ifdef __SMP__
{ "nosmp", smp_setup },
{ "maxcpus=", smp_setup },
@@ -872,7 +876,6 @@
#else
prof_shift = 2;
#endif
-#endif
if (prof_shift) {
prof_buffer = (unsigned int *) memory_start;
/* only text is profiled */
@@ -881,6 +884,7 @@
memory_start += prof_len * sizeof(unsigned int);
memset(prof_buffer, 0, prof_len * sizeof(unsigned int));
}
+#endif
#ifdef CONFIG_SBUS
memory_start = sbus_init(memory_start,memory_end);
#endif
diff -ur linux-2133/kernel/sched.c linux/kernel/sched.c
--- linux-2133/kernel/sched.c Sun Apr 13 08:24:35 1997
+++ linux/kernel/sched.c Sun Apr 13 08:23:41 1997
@@ -16,6 +16,7 @@
* current-task
*/
+#include <linux/config.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/timer.h>
@@ -80,9 +81,12 @@
unsigned long event = 0;
extern int _setitimer(int, struct itimerval *, struct itimerval *);
+
+#ifdef CONFIG_PROFILE
unsigned int * prof_buffer = NULL;
unsigned long prof_len = 0;
unsigned long prof_shift = 0;
+#endif
#define _S(nr) (1<<((nr)-1))
@@ -1259,6 +1263,7 @@
* by default it's done in the global timer interrupt.
*/
+#ifdef CONFIG_PROFILE
static void default_do_profile (struct pt_regs * regs)
{
if (prof_buffer && current->pid) {
@@ -1272,6 +1277,7 @@
}
void (*do_profile)(struct pt_regs *) = default_do_profile;
+#endif
void do_timer(struct pt_regs * regs)
{
@@ -1280,8 +1286,10 @@
mark_bh(TIMER_BH);
if (!user_mode(regs)) {
lost_ticks_system++;
+#ifdef CONFIG_PROFILE
if (do_profile)
do_profile(regs);
+#endif
}
if (tq_timer)
mark_bh(TQUEUE_BH);