From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,fb8f99978b1c2397,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-01-08 20:25:35 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.mesh.ad.jp!newsfeed.stanford.edu!arclight.uoregon.edu!newsfeed.srv.cs.cmu.edu!cantaloupe.srv.cs.cmu.edu!not-for-mail From: Mihai-Dan Budiu Newsgroups: comp.unix.tru64 Subject: cycle counter register Date: 08 Jan 2001 23:16:38 -0500 Organization: Carnegie Mellon Univ. -- Computer Science Dept. Message-ID: NNTP-Posting-Host: crabapple.srv.cs.cmu.edu X-Trace: cantaloupe.srv.cs.cmu.edu 979013799 18446 128.2.206.189 (9 Jan 2001 04:16:39 GMT) X-Complaints-To: postmaster@cs.cmu.edu NNTP-Posting-Date: 9 Jan 2001 04:16:39 GMT X-Newsreader: Gnus v5.7/Emacs 20.6 Xref: supernews.google.com comp.unix.tru64:1374 Hello. I am sorry if this is not the right forum; I could not find many newsgroups related to Alpha. I am trying to get some performance measurements for programs running on Alpha. What I would like to do is to count the execution time of a program EXCEPT in a few portions of code. I have the source code of the programs I am measuring. I am interested in being as much "cycle-accurate" as possible. I am using 'gcc -O4'. I have tried to use ATOM, but it is too heavyweight: the code I am measuring is executed often, and the overhead of inserting procedure calls is too big (1000%). Now I have resorted to inserting just a few instructions to read the cycle counter register (using rpcc), and to make simple computations with it. I get the counters before and after the code I want to skip, and I accumulate only the time spent outside this code. My programs don't run too much, so the counters don't overflow. However, I encounter two problems with this approach: 1) the results vary from measurement to measurement, even on an unloaded system (around 10% variance I would say). 2) I believe that the compiler and the OOO execution actually reorder my instrumentation code, and thus I am not really measuring what I want. My questions are: a) is there a method to measure in a very lightweight fashion just the user-level runtime of a process? should I expect for such a value a variance of an order >10%, due to the unpredictable scheduling on OS and application code on the CPU? b) is there a way to avoid the reordering of the instrumentation instructions, without incurring a big overhead (i.e. >10%)? c) is there some documentation with guidelines on how to carry such measurements on Alphas (or perhaps any other Unix system)? Thank you very much for any hint. Mihai Budiu