kernel profile init [patch]

Andrea Arcangeli (arcangeli@mbox.queen.it)
Mon, 8 Jun 1998 16:58:46 +0200 (CEST)


This patch fix the init stage of the kernel profiler. I don' t know if
this is the lighter implementation, but at least works and allow me to see
/proc/profile without had to explicit declare profile=2 at lilo prompt.
Since I was there I masked some procfs profiler code really not needed if
the kernel is configured without profiler.

Andrea[s] Arcangeli

--- /usr/src/linux/fs/proc/root.c Thu May 21 12:53:17 1998
+++ linux/fs/proc/root.c Mon Jun 8 15:57:53 1998
@@ -603,11 +603,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,
@@ -682,10 +684,12 @@
#endif
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 int);
}
+#endif

proc_tty_init();
#ifdef __powerpc__
--- /usr/src/linux/fs/proc/array.c Mon Jun 8 13:31:06 1998
+++ linux/fs/proc/array.c Mon Jun 8 15:59:18 1998
@@ -136,6 +136,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
@@ -203,6 +204,7 @@
struct inode_operations proc_profile_inode_operations = {
&proc_profile_operations,
};
+#endif


static int get_loadavg(char * buffer)
--- /usr/src/linux/init/main.c Mon Jun 8 13:31:06 1998
+++ linux/init/main.c Mon Jun 8 16:47:08 1998
@@ -345,16 +345,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;
@@ -1029,6 +1031,9 @@
init_IRQ();
sched_init();
time_init();
+#ifdef CONFIG_PROFILE
+ profile_init();
+#endif
parse_options(command_line);

/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu