source: trunk/src/testing/include/appInstance.h @ 4

Revision 4, 4.4 KB checked in by ajaworski, 13 years ago (diff)

Added modified SAGE sources

Line 
1/******************************************************************************
2 * SAGE - Scalable Adaptive Graphics Environment
3 *
4 * Module: appInstance.h
5 * Author : Byungil Jeong
6 *
7 * Copyright (C) 2004 Electronic Visualization Laboratory,
8 * University of Illinois at Chicago
9 *
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 *  * Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 *  * Redistributions in binary form must reproduce the above
18 *    copyright notice, this list of conditions and the following disclaimer
19 *    in the documentation and/or other materials provided with the distribution.
20 *  * Neither the name of the University of Illinois at Chicago nor
21 *    the names of its contributors may be used to endorse or promote
22 *    products derived from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or
37 * http://www.evl.uic.edu/cavern/forum/
38 *
39 *****************************************************************************/
40 
41#ifndef APPINSTANCE_H_
42#define APPINSTANCE_H_
43
44#include "sageDisplay.h"
45#include "sage.h"
46#include "sageSync.h"
47#include "sageConfig.h"
48#include "sageTcpModule.h"
49#include "sageUdpModule.h"
50#include "streamInfo.h"
51#include "sageStreamer.h"
52
53class appInstance;
54class sagePixelReceiver;
55class bridgeSharedData;
56class sageBlockPartition;
57
58#define ALLOC_LOAD_BALANCING 0
59#define ALLOC_SINGLE_NODE    1
60
61class nodeAllocInfo {
62public:
63   int nodeID;
64   int blockID;
65   
66   nodeAllocInfo() : nodeID(-1), blockID(-1) {}
67};
68
69class appInstance : public appInExec {
70public:
71   int instID;
72protected:
73   bridgeSharedData *shared;
74   sagePixelReceiver *recv;
75   bridgeStreamer *streamerList[MAX_ENDPOINT_NUM];
76   float slaveFRate[MAX_ENDPOINT_NUM];
77   int maxStreamerIdx;
78   
79   streamerConfig sConfig;
80   
81   bool initialized;
82   int nodeNum;
83   int blockSize, groupSize;
84   int blockX, blockY;
85   sageBlockBuf *blockBuf;
86   int blockNum;
87   std::vector<nodeAllocInfo> allocInfoList;
88   
89   sageRect imageMap;
90   sageMessage nodeAlloc;
91   syncGroup *firstSyncGroup;
92   int firstSyncID;
93   
94   std::vector<int> fsList;
95   int waitNodes;
96   int validIdx;  // a vaild streamer index
97
98   sageTimer perfTimer;
99   int reportRate;
100   float slaveBandWidth, accBandWidth, curBandWidth;
101   unsigned packetLoss;
102   float accLoss, slaveLoss;
103   int  reportCnt;
104   
105   /**
106    * if greater than 1 , then it's parallel app
107    */
108   int numOfSenders;
109
110   int sendPerformanceInfo();
111   int addStreamer(int fsIdx, int orgIdx = 0, syncGroup *sGroup = NULL, int syncID = 0);
112   
113   int shutdownAllStreams();   
114   int startPerformanceReport(sageMessage &msg);
115   int findValidIdx();
116   
117public:
118   appInstance(char *msgStr, int id, bridgeSharedData *sh);
119   ~appInstance();
120
121   /**
122    * sageBridget::initStreams()
123    * receiver buffer(sageBlockBuf) and sageReceiver object is created here
124    */
125   int init(char *msg, streamProtocol *nwObj);
126
127   /**
128    * bridgeStreamer object is created here
129    */
130   int addStream(int senderID);
131   void fillAppInfo(char *msgStr);
132   int connectToFSManager();
133   int connectToFSManager(char *fsIP, int fsPort);   
134   int parseMessage(sageMessage &msg, int fsIdx);
135   bool isActive();
136   int accumulateBandWidth(char *data);
137   int allocateNodes(int policy, int nodeID = 0);
138   friend class sageBridge;
139};
140
141#endif
Note: See TracBrowser for help on using the repository browser.