2 * Copyright (c) 1996 Barton P. Miller
4 * We provide the Paradyn Parallel Performance Tools (below
5 * described as Paradyn") on an AS IS basis, and do not warrant its
6 * validity or performance. We reserve the right to update, modify,
7 * or discontinue this software at any time. We shall have no
8 * obligation to supply such updates or modifications or any other
9 * form of support to you.
11 * This license is for research uses. For such uses, there is no
12 * charge. We define "research use" to mean you may freely use it
13 * inside your organization for whatever purposes you see fit. But you
14 * may not re-distribute Paradyn or parts of Paradyn, in any form
15 * source or binary (including derivatives), electronic or otherwise,
16 * to any other organization or entity without our permission.
18 * (for other uses, please contact us at paradyn@cs.wisc.edu)
20 * All warranties, including without limitation, any warranty of
21 * merchantability or fitness for a particular purpose, are hereby
24 * By your use of Paradyn, you understand and agree that we (or any
25 * other person or entity with proprietary rights in Paradyn) are
26 * under no obligation to provide either maintenance services,
27 * update services, notices of latent defects, or correction of
28 * defects for Paradyn.
30 * Even if advised of the possibility of such damages, under no
31 * circumstances shall we (or any other person or entity with
32 * proprietary rights in the software licensed hereunder) be liable
33 * to you or any third party for direct, indirect, or consequential
34 * damages of any character regardless of type of action, including,
35 * without limitation, loss of profits, loss of use, loss of good
36 * will, or computer failure or malfunction. You agree to indemnify
37 * us (and any other person or entity with proprietary rights in the
38 * software licensed hereunder) for any and all liability it may
39 * incur to third parties resulting from your use of Paradyn.
43 * inst-aix.C - AIX specifc code for paradynd.
45 * XXX - The following functions seem to be less than OS dependent, but I
46 * have included them here to reduce the number of files changed in the
47 * AIX port. - jkh 6/30/95.
48 * process::getProcessStatus()
49 * computePauseTimeMetric()
52 * Revision 1.1 1995/08/24 15:03:55 hollings
53 * AIX/SP-2 port (including option for split instruction/data heaps)
54 * Tracing of rexec (correctly spawns a paradynd if needed)
55 * Added rtinst function to read getrusage stats (can now be used in metrics)
57 * Improved Error reporting in MDL sematic checks
58 * Fixed MDL Function call statement
59 * Fixed bugs in TK usage (strings passed where UID expected)
63 #include "dyninstAPI/src/dyninstP.h" // isApplicationPaused
64 #include "dyninstAPI/src/os.h"
65 #ifndef BPATCH_LIBRARY
66 #include "paradynd/src/metric.h"
68 #include "dyninstAPI/src/dyninst.h"
70 #include "dyninstAPI_RT/h/trace.h"
72 #include "rtinst/h/trace.h"
74 #include "dyninstAPI/src/symtab.h"
75 #include "dyninstAPI/src/process.h"
76 #include "dyninstAPI/src/inst.h"
77 #include "dyninstAPI/src/instP.h"
78 #include "dyninstAPI/src/ast.h"
79 #include "dyninstAPI/src/ptrace_emul.h"
80 #include "dyninstAPI/src/util.h"
81 #include "dyninstAPI/src/stats.h"
84 #ifndef BPATCH_LIBRARY
85 #include "dyninstRPC.xdr.SRVR.h"
86 #include "paradynd/src/main.h"
87 #include "paradynd/src/perfStream.h"
88 #include "paradynd/src/context.h"
91 string process::getProcessStatus() const {
96 sprintf(ret, "%d running", pid);
99 sprintf(ret, "%d neonatal", pid);
102 sprintf(ret, "%d stopped", pid);
105 sprintf(ret, "%d exited", pid);
108 sprintf(ret, "%d UNKNOWN State", pid);
115 // All costs are based on Measurements on a SPARC station 10/40.
117 void initPrimitiveCost()
119 /* Need to add code here to collect values for other machines */
121 // these happen async of the rest of the system.
122 primitiveCosts["DYNINSTprintCost"] = 1;
124 // this doesn't really take any time
125 primitiveCosts["DYNINSTbreakPoint"] = 1;
127 // this happens before we start keeping time.
128 primitiveCosts["DYNINSTinit"] = 1;
130 // nene acutal numbers from 1/26/96 -- jkh
132 primitiveCosts["DYNINSTincrementCounter"] = 16;
134 //primitiveCosts["DYNINSTdecrementCounter"] = 16;
136 // 0.8 usec * 66 mhz (measured on a POWER-2 RS600)
137 //primitiveCosts["DYNINSTstartWallTimer"] = 53;
138 // 1.0 usec * 66 mhz (measured on a POWER-2 RS600)
139 //primitiveCosts["DYNINSTstopWallTimer"] = 66;
140 // 2.4 usec * 66 Mhz (measured on a POWER-2 RS600)
141 //primitiveCosts["DYNINSTstartProcessTimer"] = 160;
142 // 4.8 usec * 66 Mhz (measured on a POWER-2 RS600)
143 //primitiveCosts["DYNINSTstopProcessTimer"] = 317;
145 logLine("IBM platform\n");
146 // Updated calculation of the cost for the following procedures.
147 // Clock rate = 64 Mhz (rs6000) - naim
148 // NOTE: These measurements may need some tune up (02-09-96) - naim
149 // 1.5 usecs * 64 Mhz
150 primitiveCosts["DYNINSTstartWallTimer"] = 96;
151 // 3.01 usecs * 64 Mhz
152 primitiveCosts["DYNINSTstopWallTimer"] = 192;
153 // 10.09 usecs * 64 Mhz
154 primitiveCosts["DYNINSTstartProcessTimer"] = 645;
155 // 20.28 usecs * 64 Mhz
156 primitiveCosts["DYNINSTstopProcessTimer"] = 1297;
158 // These happen async of the rest of the system.
159 // 33.74 usecs * 64 Mhz
160 primitiveCosts["DYNINSTalarmExpire"] = 2159;
161 // 0.38 usecs * 64 Mhz
162 primitiveCosts["DYNINSTsampleValues"] = 24;
163 // 11.52 usecs * 64 Mhz
164 primitiveCosts["DYNINSTreportTimer"] = 737;
165 // 1.14 usecs * 64 Mhz
166 primitiveCosts["DYNINSTreportCounter"] = 72;
167 // 2.07 usecs * 64 Mhz
168 primitiveCosts["DYNINSTreportCost"] = 131;
169 // 0.66 usecs * 64 Mhz
170 primitiveCosts["DYNINSTreportNewTags"] = 42;
174 * Define the various classes of library functions to inst.
177 void initLibraryFunctions()
179 /* XXXX - This function seems to be obsolete with the addition of MDL.
180 * Why is it still here? - jkh 6/30/95
184 #ifndef BPATCH_LIBRARY
185 float computePauseTimeMetric(const metricDefinitionNode *) {
186 // we don't need to use the metricDefinitionNode
188 timeStamp elapsed=0.0;
190 now = getCurrentTime(false);
191 if (firstRecordTime) {
192 elapsed = elapsedPauseTime;
193 if (isApplicationPaused())
194 elapsed += now - startPause;
196 assert(elapsed >= 0.0);