Using prtpicl to get cache sizes

If you are on a SPARC system you can get cache size information using the command fpversion, which is provided with Studio:

$ fpversion
 A SPARC-based CPU is available.
 Kernel says main memory's clock rate is 1012.0 MHz.

 Sun-4 floating-point controller version 0 found.
 An UltraSPARC chip is available.

 Use "-xtarget=sparc64vii -xcache=64/64/2:5120/256/10" code-generation option.

The cache parameters are output exactly as you would want to pass them into the compiler - for each cache it describes the size in KB, the line size in bytes, and the associativity.

fpversion doesn't exist on x86 systems. The next best thing is to use prtpicl to output system configuration information, and inspect that output for cache size. Here's the cache output for the same SPARC system using prtpicl.

$ prtpicl -v |grep cache
              :l1-icache-size    0x10000
              :l1-icache-line-size       0x40
              :l1-icache-associativity   0x2
              :l1-dcache-size    0x10000
              :l1-dcache-line-size       0x40
              :l1-dcache-associativity   0x2
              :l2-cache-size     0x500000
              :l2-cache-line-size        0x100
              :l2-cache-associativity    0xa
Comments:

I tried this on a T5220 with Studio 12 and saw this :

eris-sparc-SunOS5.10 $ cc -V
cc: Sun C 5.9 SunOS_sparc Patch 124867-16 2010/08/11
usage: cc [ options] files. Use 'cc -flags' for details

eris-sparc-SunOS5.10 $ fpversion
A SPARC-based CPU is available.
Kernel says CPU's clock rate is 1165.4 MHz.

Sun-4 floating-point controller version 0 found.
An UltraSPARC chip is available.

Use "-xtarget=generic -xcache=generic" code-generation option.

There was also a "hostid" but that didn't seem to be much of a compiler option. Also, "generic" seems to hardly be of any use to me.

In truth I was trying to determine why a function declared like so :

__my_foo void *__my_foo_alloc __FOO_PROTO ((struct tmp_reentrant_t **, size_t)) ATTRIBUTE_MALLOC;

.. was the cause of a Compiler breakdown.

I checked here http://developers.sun.com/sunstudio/support/Ccompare.html and it looks like SS12 should support __attributes__ malloc but that just isn't the case.

Anyways ... thanks for the cool blog.

dc

ps: the whole issue is documented here : http://gmplib.org/list-archives/gmp-bugs/2011-June/002271.html

Posted by Dennis Clarke on February 19, 2012 at 06:33 PM PST #

Post a Comment:
Comments are closed for this entry.
About

Darryl Gove is a senior engineer in the Solaris Studio team, working on optimising applications and benchmarks for current and future processors. He is also the author of the books:
Multicore Application Programming
Solaris Application Programming
The Developer's Edge

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
5
6
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
The Developer's Edge
Solaris Application Programming
Publications
Webcasts
Presentations
OpenSPARC Book
Multicore Application Programming
Docs