Accessing Ultra's performace counters and TICK counter

Accessing Ultra's performace counters and TICK counter

Post by myk » Fri, 14 Jun 1996 04:00:00



Hello,
I have two questions regarding the access of some privileged registers
on an UltraSPARC. The capabilities of the following registers are described
in Sun's "UltaSPARC-I User's Manual" Rev 1.0.

1) Ultra has a 64-bit register (split into 2 32-bit counters) for counting
   certain "events". This register is called the PIC (performance
   instrumentation counter). What the pair of counters count, is controlled
   by setting the PCR (performance control register). Unfortunately, access
   to the PCR (RDASR/WRASR) is privileged as is reading the PIC.

   My question is, does anyone know what calls are available (and in what
   package) that will allow me to change the PCR and read the PIC?

2) Ultra has a 64-bit register called the TICK register which is incremented
   every cycle. However, one bit in this register is called the NPT bit
   (non privileged trap) which when set permits only privileged uses to
   read the register. This bit is set at power-on.

   My question is does anyone know what calls are available that will
   either allow me to clear the NPT bit and read the register in user
   mode or make a call to some privileged code that will return the
   TICK count. Using gethrtimer has too much overhead for real tight
   code. Reading the TICK in user mode would take care of that problem.

Thanks in advance.

--myke smith

 
 
 

Accessing Ultra's performace counters and TICK counter

Post by Christian Kuehnk » Sat, 15 Jun 1996 04:00:00



>I have two questions regarding the access of some privileged registers
>on an UltraSPARC. The capabilities of the following registers are described
>in Sun's "UltaSPARC-I User's Manual" Rev 1.0.

Where can this Manual be ordered? How much does ist cost? (My personal
opinion: Sun *really* should make such material available on-line with-
out a fee).

Quote:>1) Ultra has a 64-bit register (split into 2 32-bit counters) for counting
>   certain "events". This register is called the PIC (performance
>   instrumentation counter). What the pair of counters count, is controlled
>   by setting the PCR (performance control register). Unfortunately, access
>   to the PCR (RDASR/WRASR) is privileged as is reading the PIC.
>   My question is, does anyone know what calls are available (and in what
>   package) that will allow me to change the PCR and read the PIC?

I don't think there is kernel support for it in a production
kernel. And as there is no kernel support and the registers
are available only in previliged mode you are probably on your own.

Quote:>2) Ultra has a 64-bit register called the TICK register which is incremented
>   every cycle. However, one bit in this register is called the NPT bit
>   (non privileged trap) which when set permits only privileged uses to
>   read the register. This bit is set at power-on.
>   My question is does anyone know what calls are available that will
>   either allow me to clear the NPT bit and read the register in user
>   mode or make a call to some privileged code that will return the
>   TICK count. Using gethrtimer has too much overhead for real tight
>   code. Reading the TICK in user mode would take care of that problem.

Somebody from Sun once mentioned in a Newsgroup that the TICK.NPT bit
will probably be reset by future revisions of Solaris so that there
will be access to %TICK from user space.

As I wanted to play [and that is *play*, where you probably want to do
some work ;-)] with this feature as well, I thought about writing a
small kernel module which would clear out TICK.NPT. Up to now, I
didn't investigate this further.

Regards,
Christian
--

                                             |Tel.: +49 441 798 2978 (work)
Feeding /dev/mouse to the cat(1).            |Fax : +49 441 798 2980 (work)

 
 
 

Accessing Ultra's performace counters and TICK counter

Post by Toerless Ecke » Sun, 23 Jun 1996 04:00:00




>>I have two questions regarding the access of some privileged registers
>>on an UltraSPARC. The capabilities of the following registers are described
>>in Sun's "UltaSPARC-I User's Manual" Rev 1.0.

You may want to get the "Sun SunFire Hardware Performance Monitor"
tool, tiggtiggrperf. We've used it successfully on SS12/170E with SunOS 5.5.
It contains kernel modules that will inhibit the denial of access to the
counter registers from user level programs.

Ask your Sun SE about it, he should be able to get it for you.
--

    /C=de/A=d400/P=uni-erlangen/OU=informatik/S=Eckert/G=Toerless/
                   ATM - Another Terrible Mistake
    Disclaimer: please reply by mail onto the article if you need a response