Perfmon

Perfmon is a utility written by Bill Moore that allows you to read certain special registers on the cpu. For complete information, please see ~bill/perfmon.

To install perfmon

        <become root>
        cd ~bill/perfmon/pkgs
        pkgadd -d MSUperf MSUperf

In order to get meaningful information using perfmon, the process cannot be swapped out. One way of doing this is to run the process as a real time process. To allow normal users to do this, the following program rt was written.

/*
	priocntl -e -c RT su username -c 
*/

#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>

main(int argc, char *argv[])
{
	int uid;
	struct passwd *p;

	uid=getuid();
	if (argc<2)
	{
		printf("Usage:  %s command\n",argv[0]);
		exit(1);
	}
	if (uid!=0)
	{	
		p=getpwuid(uid);	

		setuid(0);

		execlp("/usr/bin/priocntl","priocntl","-e","-c","RT","su",
					p->pw_name,"-c",argv[1],0l);
	}
}
This program is installed in /usr/cpssbin/ and is setuid root. rt runs any program as a real time process. The program runs as a normal user.