use datagrid method functions MetricId and ResourceId
[dyninst.git] / visi / h / visualization.h
1 #ifndef _visualization_h
2 #define _visualization_h
3 /*
4  * Copyright (c) 1993, 1994 Barton P. Miller, Jeff Hollingsworth,
5  *     Bruce Irvin, Jon Cargille, Krishna Kunchithapadam, Karen
6  *     Karavanic, Tia Newhall, Mark Callaghan.  All rights reserved.
7  * 
8  * This software is furnished under the condition that it may not be
9  * provided or otherwise made available to, or used by, any other
10  * person, except as provided for by the terms of applicable license
11  * agreements.  No title to or ownership of the software is hereby
12  * transferred.  The name of the principals may not be used in any
13  * advertising or publicity related to this software without specific,
14  * written prior authorization.  Any use of this software must include
15  * the above copyright notice.
16  *
17  */
18
19 /* $Log: visualization.h,v $
20 /* Revision 1.7  1994/09/25 01:58:16  newhall
21 /* changed interface definitions to work for new version of igen
22 /* changed AddMetricsResources def. to take array of metric/focus pairs
23 /*
24  * Revision 1.6  1994/08/13  20:34:07  newhall
25  * removed all code associated with class visi_MRList
26  *
27  * Revision 1.5  1994/05/23  20:55:21  newhall
28  * To visi_GridCellHisto class: added deleted flag, SumValue
29  * method function, and fixed AggregateValue method function
30  *
31  * Revision 1.4  1994/05/11  17:11:10  newhall
32  * changed data values from double to float
33  *
34  * Revision 1.3  1994/04/13  21:23:15  newhall
35  * added routines: GetMetsRes, StopMetRes, NamePhase
36  *
37  * Revision 1.2  1994/03/17  05:13:41  newhall
38  * change callback type
39  *
40  * Revision 1.1  1994/03/14  20:27:33  newhall
41  * changed visi subdirectory structure
42  *  */ 
43 /////////////////////////////////////////////////////////
44 //  This file should be included in all visualizations.
45 //  It contains definitions for all the Paradyn visi
46 //  interface routines.  
47 /////////////////////////////////////////////////////////
48
49 #include "datagrid.h"
50 #include "visiTypes.h"
51
52 #define FILETABLESIZE  64
53 #define EVENTSIZE      FOLD+1
54
55 //
56 // global variables assoc. with histo datagrid
57 //   dataGrid: use visi_DataGrid method functions to access current
58 //             data values and information about metrics and resources 
59 //   metricList, resourceList: use visi_MRList method functions to 
60 //             access current metric and resource lists (changes to this
61 //             list do not affect the datagrid) primarly, these are used
62 //             to obtain and modify the parameters to GetMetsRes()
63 //   
64 extern visi_DataGrid  dataGrid;   
65 extern int            lastBucketSent;
66
67 //
68 // file descriptor array: 1st file desc. is assoc. w/ Paradyn
69 // remaining file descriptors are assigned by user when user
70 // uses main routine provided by Paradyn
71 //
72 extern int fileDesc[FILETABLESIZE];
73
74 //
75 // array of callback routines assoc. with file descriptors when
76 // user uses main routine provided by Paradyn
77 //
78 extern int (*fileDescCallbacks[FILETABLESIZE])();
79
80 //
81 // array of procedure pointers for callback routines assoc.
82 // with paradyn events  (ex. DATAVALUES,INVALIDMETRICSRESOURCES...)
83 // events types are defined in visiTypes.h
84 //
85 extern int (*eventCallbacks[EVENTSIZE])(int);
86
87 //
88 // callback associated with paradyn-visualization interface routines
89 //
90 extern int visi_callback();
91
92 /////////////////////////////////////////////////////////////
93 // these functions invoke upcalls to a visi interface client
94 // (call from visualization process to paradyn)
95 /////////////////////////////////////////////////////////////
96 //
97 // get a new set of metrics and resources from Paradyn
98 //
99 extern void GetMetsRes(char *metres,  // predefined list met-res pairs 
100                        int numElements,  
101                        int type);      // 0-histogram, 1-scalar
102
103 //
104 // stop data collection for a metric/resource pair
105 // arguments are the datagrid indicies associated with the
106 // metric and resource to stop
107 //
108 extern void StopMetRes(int metricIndex,    // datagrid index of metric
109                        int resourceIndex); // datagrid index of resource
110
111 //
112 // define a new phase to paradyn
113 //
114 extern void NamePhase(timeType begin,  // start of phase in seconds
115                       timeType end,    // end of phase in seconds
116                       char *name);     // name of phase 
117
118
119 ////////////////////////////////////////////////////////////////
120 //   initialization routines 
121 ////////////////////////////////////////////////////////////////
122 //
123 // connects to parent socket and registers the mainLoop routine
124 // as a callback on events on fileDesc[0]
125 // This routine should be called before entering the visualization's
126 // main loop, and before calling any other visi-interface routines
127 //
128 extern int  VisiInit();
129 extern int  initDone;
130
131
132 //
133 //  Makes initial call to get Metrics and Resources.
134 //  For visualizations that do not provide an event that
135 //  invokes the GetMetsRes upcall this routine should be
136 //  called by the visualization before entrering the mainloop.
137 //  (this will be the only chance to get metrics and resources
138 //  for the visualization).
139 //  For other visualizaitons, calling this routine before
140 //  entering the mainloop is optional. 
141 //
142 extern int  StartVisi(int argc,char *argv[]);
143
144 //
145 // registration callback routine for paradyn events
146 // sets eventCallbacks[event] to callback routine provided by user
147 //
148 extern int RegistrationCallback(msgTag event,int (*callBack)(int));
149
150 //
151 // main loop provided by paradyn (not currently supported)
152 //
153 extern void ParadynMain();
154
155 //
156 // fd registration and callback routine registration for user
157 // to register callback routines when they use the provided main routine
158 //
159 extern int RegFileDescriptors(int *fd, int (*callBack)()); 
160
161 #endif