There are two sections for profiling:
	A) userland profiling.
	B) kernel profiling.

------------------------------------------------------------------------------
A) userland profiling of programs.
   1) The program gprof located in uClinux/brecis/usr-src/gprof analyzes the
      gathered data. It runs on the machine that does the cross-compiling.
      Move into the directory and "make" it.
   2) The library must be generated to have profiling in it.
      But, you do not wish to have all programs run with profiling.  As such,
      you will wish to "individually" make programs, and get them into the
      MIPS without re-making the userland programs.  I would suggest something
      like the following method:
	a) cd uClinux/brecis/compilescripts
	   make linuxall		# with your ${TYPE_SYSTEM} selected.
	b) cd uClinux/uclibc
	   vi Config			# symbolic link to real file.
	 # If profiling (gcc -pg) version of uclibc is desired.
	 DOPROF = true
	    (Comment in DOPROF=true.)
	c) set up your path to have right cross-tools.
	   cd ../brecis/tools/mipsisa32-brecis-uclinux/bin
	   set path=(`pwd` $path) && rehash	## whatever for your shell.
	d) cd uClinux/uclibc
	   make clean
	   make
   3) Notice that "2" did not make any userland programs, and that "1" already
      made all of the userland programs without profiling.
   4) Compile the program with -pg.
	a) cd uClinux/brecis/init
	   vi Makefile
	   CFLAGS += -pg
	b) If the tool path still remains set, compile and link.
	   make
	c) get program to MIPS in an appropriate manner:
	   ftp, or nfs mounted, or romdisk --
	   (cd uClinux/brecis/compilescripts; make romdisk)
	-------------------------------------------------------------------
	d) If profiling a program that "make linuxall" compiles, and it's
	   set up for "make src" (probably is), then a "make src" should
	   work, which puts it into romdisk, image.bin, etc.
	-------------------------------------------------------------------
   5) Run the program.
   6) Move the file gmon.out (hopefully you ran it in /var or someplace
      that can create the file gmon.out, and you have enough space in the
      filesystem for it) to the i386 machine. (Assumed i386 is the cross-
      compiling machine.)  ftp is an easy way to move the file.
   7) In directory uClinux/brecis/usr-src/gprof run the gprof program.
      a) ./gprof ../../brecis/init/ledflash ~/gmon.out
      Change program and location of the profiled data file as appropriate.

There is a "man page" in the directory that tells the different options to
the program gprof.

NOTE: Do not forget to run off DOPROF=true in uclibc before doing any of these:
	make linuxall
	make uclibc
	make libc
	make ucsrc
------------------------------------------------------------------------------

B) kernel profiling.
   1) Select the configuration option "CONFIG_GMON_PROF=y" in the kernel
      configuration file.
   2) Select userland program "CONFIG_BRECIS_USR_SRC_GPROF_KERNEL=y" in
      uC-src configuration file, or ".config".
   3) Select the type of "performance data" you wish to collect.
      *choke, gasp*
      a) cd uClinux/linux/arch/mipsnommu/brecis/additional
	 vi gmon.c	# very end of the file.
/* Initialize saved counter */
/* PERF_MON_CTL_REG_Instruction_Complete */
/*  *((unsigned int* volatile)(0xBC000140)) = 0x01; */  /* Instruction_Complete */
/*  *((unsigned int* volatile)(0xBC000140)) = 0x02; */  /* Data_Cache_Hit */
/*  *((unsigned int* volatile)(0xBC000140)) = 0x04; */  /* Data_Cache_Miss */
/*  *((unsigned int* volatile)(0xBC000140)) = 0x08; */  /* Instruction_Cache_Hit */
 *((unsigned int* volatile)(0xBC000140)) = 0x10;        /* Instruction_Cache_Miss */
	Comment in only one (1) of these, and comment out the others.
	Supposedly, the register is zero upon powerup, and that the
	lowest bit set is the one that is done.  Only one is done.
   4) You must re-compile the kernel, and add "gprof_kernel" to userland.
      Suggest "cd uClinux/brecis/compilescripts; make linuxall".
   5) After booting the image, you might wish to log in and take a look
      at what the system profile looks like before anything is happening.
      a) run "gprof_kernel" (probably in directory /var, so that a file
	 can be written).
      b) Move the file kernel.gmon.out to the cross-compiling machine (i386
	 probably).  Probably ftp it there.
      c) You might wish to do a "mv kernel.gmon.out kernel.gmon.out.pre".
	 Then when you do your test and run gprof_kernel again.  Move both
	 kernel.gmon.out.pre and kernel.gmon.out to the cross-compiling
	 machine.
   6) Go into uClinux/brecis/usr-src/gmondecode and make the program and
      run it.  ("make" should compile it, and "make test" is an example of
      one way to run it.)
------------------------------------------------------------------------------
