2 * Copyright 1993 Jeff Hollingsworth. All rights reserved.
9 * $Log: metricFocusNode.h,v $
10 * Revision 1.1 1994/01/27 20:31:29 hollings
11 * Iinital version of paradynd speaking dynRPC igend protocol.
13 * Revision 1.9 1994/01/20 17:48:13 hollings
14 * dataReqNode overcome by events.
16 * Revision 1.8 1993/10/19 15:27:54 hollings
17 * AST based mini-tramp code generator.
19 * Revision 1.7 1993/10/01 21:29:41 hollings
20 * Added resource discovery and filters.
22 * Revision 1.6 1993/08/20 22:01:51 hollings
23 * added getMetricValue and returnCounterInstance.
25 * Revision 1.5 1993/08/11 01:52:55 hollings
26 * new build before use metrics.
28 * Revision 1.4 1993/06/22 19:00:01 hollings
31 * Revision 1.3 1993/06/08 20:14:34 hollings
32 * state prior to bc net ptrace replacement.
34 * Revision 1.2 1993/04/27 14:39:21 hollings
35 * signal forwarding and args tramp.
37 * Revision 1.1 1993/03/19 22:51:05 hollings
43 #include "dyninstRPC.h"
46 * internal representation of an inst. request.
49 typedef enum { intCounter, timer } dataObjectType;
52 class metricDefinitionNode;
56 dataReqNode(dataObjectType, process*, int, Boolean iReport, timerType);
58 float getMetricValue();
60 void insertInstrumentation(metricDefinitionNode *mi);
63 // return a pointer in the inferrior address space of this data object.
64 void *getInferriorPtr();
65 intCounterHandle *returnCounterInstance() {
66 return((intCounterHandle *) instance);
68 int getSampleId() { return(id.id); }
69 dataObjectType getType() { return(type); }
72 timerHandle *createTimerInstance();
73 intCounterHandle *createCounterInstance();
80 sampleId id; // unique id for this sample
87 instReqNode(process*, instPoint*, AstNode*, callWhen, callOrder order);
90 Boolean insertInstrumentation();
100 instInstance *instance;
104 Boolean firstSampleReceived; /* has first sample been recoreded */
105 sampleValue value; /* cumlative value */
106 timeStamp lastSampleStart; /* start time for last sample */
107 timeStamp lastSampleEnd; /* end time for last sample */
108 sampleValue lastSample; /* what was the last sample increment */
111 class metricDefinitionNode {
113 metricDefinitionNode(process *p);
114 metricDefinitionNode(metric m, List<metricDefinitionNode*> parts);
115 ~metricDefinitionNode();
117 void updateValue(time64, sampleValue);
119 Boolean match(resourceList l, metric m) {
120 return(resList == l && met == m);
122 Boolean insertInstrumentation();
124 // used by controller.
125 float getMetricValue();
126 dataReqNode *addIntCounter(int inititalValue, Boolean report) {
129 tp = new dataReqNode(intCounter, proc, inititalValue,
134 dataReqNode *addTimer(timerType type) {
136 tp = new dataReqNode(timer,proc,0,True,type);
140 void addInst(instPoint *point,AstNode *ast, callWhen when, callOrder o){
142 temp = new instReqNode(proc, point, ast, when, o);
146 int id; // unique id for this one
147 metric met; // what type of metric
148 resourceList resList; // what resource list is this for.
150 // is this a final value or a component of a larger metric.
155 void updateAggregateComponent(metricDefinitionNode *,
156 time64 time, sampleValue value);
161 /* for aggregate metrics */
162 List<metricDefinitionNode*> components;
164 /* for non-aggregate metrics */
165 List<dataReqNode*> data;
166 List<instReqNode*> requests;
168 // which metricDefinitionNode depend on this value.
169 List<metricDefinitionNode*> aggregators;
171 struct sampleInfo sampleData; /* actual data */
175 typedef AstNode *(*createPredicateFunc)(metricDefinitionNode *mn,
176 char *resource, AstNode *trigger);
178 typedef void (*createMetricFunc)(metricDefinitionNode*, AstNode *trigger);
181 createPredicateFunc creator;
182 } predicateDefinition;
184 typedef enum { invalidPredicate,
187 replaceBase } predicateType;
190 char *namePrefix; /* leading part of resource path */
192 createPredicateFunc creator; /* create a metric */
196 createMetricFunc baseFunc; /* base definition */
197 resourcePredicate *predicates; /* how to handle where refinements */
202 metricDefinition definition;
205 extern List<metricDefinitionNode*> allMIs;