Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: lueck@gurgi.zk3.dec.com (Greg Lueck Development Environment)
Subject: Re: Alpha Cycle Count
Date: 1995/07/14	[thread overview]
Message-ID: <3u662k$joe@lead.zk3.dec.com> (raw)
In-Reply-To: BURGER.95Jul11113914@garlic.ece.ucdavis.edu


In article <BURGER.95Jul11113914@garlic.ece.ucdavis.edu>, burger@ece.ucdavis.edu (Julian Burger) writes:
|> In my research I have the need to determine the runtime cycle count of the
|> functions in a program.  Ideally, pixie would do this, but I have only been
|> able to get dynamic instruction counts from pixie.  If ATOM is capable of
|> this, I have not figured out how.
|> 
|> Does anyone have a tool that works similar to pixie but reports the cycle
|> count instead of the instruction count?
|> -- 
|> JB @ ECE.UCD
|> 


Here's some possible ways to get the cycle count for procedures in an
application.

1) Use the pixie tool to instrument your application, and pass the
   "-truecycles 2" switch to prof.  This switch causes prof to estimate
   the number of machine cycles spent in each function, rather than
   reporting the dynamic instruction count.

   The estimate takes into account pipeline stalls and multiple issues,
   but nothing else.  No time is reported for cache misses, page
   faults, I/O, kernel traps, etc.

   There are three levels of "-truecycles" output.  "-truecycles 0" is
   the default where each instruction is assumed to take one machine
   cycle.  "-truecycles 1" accounts for pipeline stalls and multiple
   issues within each basic block, but not across basic blocks.
   "-truecycles 2" also looks for effects between adjacent basic
   blocks.

2) If you want a simple flat profile of the time spent in each
   function, use the standard PC-sampling technique.  Link with the -p
   switch, run your application, then run prof.  You can determine the
   number of machine cycles from the procedure time and the CPU's clock
   rate.

   Since this method operates by interrupting your application
   periodically and recording the PC, it is not appropriate for
   applications that run for a short time.  It is also not appropriate
   if you are looking for exact timings rather than a statistical
   analysis.

3) Finally, you can write an Atom tool to get exactly what you want, I
   suspect.  Atom allows you to read the CPU's cycle counter register
   at arbitrary points in the application.  You could write an Atom
   tool to add instrumentation to the start and end of each procedure,
   reading the cycle counter at both points.  This gives you the number
   of cycles spent in the procedure (and all procedures called by that
   procedure).

   One potential problem with this approach is that the cycle counter
   wraps around fairly quickly, every 20-30 seconds or so.  You will
   have to devise some mechanism for detecting this wrap around,
   perhaps by making use of one of the courser-grained timers.

   The Atom documentation describes how to access the cycle counter.
   Basically, you just read it like you would read any other register.
   Prototype an analysis routine with the REGV (register value)
   parameter, and pass the constant REG_CC.  For example:

	Instrument()
	{
	    Proc *	p;

	    AddCallProto("foo(REGV)");
	    AddCallProc(ProcBefore, p, "foo", REG_CC);
	}

I hope you find some of this useful.

-- 
-------------------------------------------------------------------------------
Greg Lueck                              Opinions expressed herein are my own.
lueck@zk3.dec.com
-------------------------------------------------------------------------------
-- 
-------------------------------------------------------------------------------
Greg Lueck                              Opinions expressed herein are my own.
lueck@zk3.dec.com
-------------------------------------------------------------------------------



      reply	other threads:[~1995-07-14  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-07-11  4:00 Alpha Cycle Count Julian Burger
1995-07-14  4:00 ` Greg Lueck Development Environment [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox